导出配置文件
kubeadm config print init-defaults > kubernetes-config.yaml
修改配置文件
vim kubernetes-config.yaml
#配置信息
apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: abcdef.0123456789abcdef
ttl: 24h0m0s
usages: - signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 192.168.100.10
bindPort: 6443
nodeRegistration:
criSocket: /var/run/dockershim.sock
name: master01
taints: -
effect: NoSchedule
key: node-role.kubernetes.io/masterapiServer:
timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns:
type: CoreDNS
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: v1.15.1
networking:
dnsDomain: cluster.local
podSubnet: 10.244.0.0/16
serviceSubnet: 10.96.0.0/12
scheduler: {}apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
featureGates:
SupportIPVSProxyMode: true
mode: ipvs
安装master
kubeadm init --config=kubernetes-config.yaml --experimental-upload-certs | tee kubeadm-init.log
*此处可以将包提前下载好导入到docker中
创建相应配置目录
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
安装flannel管理网络
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
sed -i s#'quay.io/coreos'#'registry.cn-hangzhou.aliyuncs.com/kube-iamges'#g kube-flannel.yml
在node节点上执行
kubeadm join 192.168.100.10:6443 --token abcdef.0123456789abcdef \
--discovery-token-ca-cert-hash sha256:d343c8af1afc768ee1f64d2c5cc9225ecf7140d53a5fd7072ab920a7138446fe
kubectl apply -f kube-flannel.yml
- system:bootstrappers:kubeadm:default-node-token
来源:oschina
链接:https://my.oschina.net/u/4409965/blog/4305873