apiVersion:kubeadm.k8s.io/v1beta1 kind:ClusterConfiguration etcd: # one of local or external local: imageRepository:"registry.aliyuncs.com/google_containers"# origin is "k8s.gcr.io" imageTag:"3.3.15-0" networking: serviceSubnet:"10.96.0.0/12" podSubnet:"10.244.0.0/16"# for flannel dnsDomain:"cluster.local" kubernetesVersion:"v1.16.2" imageRepository:"registry.aliyuncs.com/google_containers"# origin is "k8s.gcr.io"
这里我们用到了阿里云的 k8s 镜像源。上面的 kubernetesVersion 写明自己的 kubeadm 版本,不然会去 google 官方请求版本,可能会卡住。然后运行
1
kubeadm init --config kubeadm.conf
即可初始化集群。
完成之后,初始化成功,会输出类似于下面的信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Your Kubernetes master has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of machines by running the following on each node as root: