集群02"/>
安装 Kubernetes 集群02
1、初始化Master
# kubeadm init --image-repository registry.aliyuncs/google_containers --kubernetes-version v1.18.2 --apiserver-advertise-address 192.168.1.246 --pod-network-cidr=10.244.0.0/16
--image-repository string:这个用于指定从什么位置来拉取镜像(1.13版本才有的),默认值是k8s.gcr.io,我们将其指定为国内镜像地址:registry.aliyuncs/google_containers
--kubernetes-version string:指定kubenets版本号,默认值是stable-1,会导致从.txt下载最新的版本号,我们可以将其指定为固定版本1.18.2来跳过网络请求。
--apiserver-advertise-address 指明用 Master 的哪个 interface 与 Cluster 的其他节点通信(Master的IP地址)。如果 Master 有多个 interface,建议明确指定,如果不指定,kubeadm 会自动选择有默认网关的 interface。
--pod-network-cidr指定 Pod 网络的范围。Kubernetes 支持多种网络方案,而且不同网络方案对 --pod-network-cidr有自己的要求,这里设置为10.244.0.0/16 是因为我们将使用 flannel 网络方案,必须设置成这个 CIDR。
初始化成功的标志:
Your Kubernetes master has initialized successfully! To start using your cluster, you need to run the following as a regular user: mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config You should now deploy a pod network to the cluster. Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: / You can now join any number of machines by running the following on each node as root: kubeadm join 172.20.10.2:6443 --token rn816q.zj0crlasganmrzsr --discovery-token-ca-cert-hash sha256:e339e4d
更多推荐
安装 Kubernetes 集群02
发布评论