kubeadm init --kubernetes-version=v1.22.0 --control-plane-endpoint "192.168.75.100:6443" --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.75.100
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir-p$HOME/.kube
sudocp-i /etc/kubernetes/admin.conf $HOME/.kube/config
sudochown$(id-u):$(id-g)$HOME/.kube/config
Alternatively, if you are the root user, you can run:
exportKUBECONFIG=/etc/kubernetes/admin.conf
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/
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
"kubeadm init phase upload-certs --upload-certs" to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
# node节点执行
kubeadm join10.36.176.200:8443 --token 9t5hnx.zfmemmdbkraqkzrr \
--discovery-token-ca-cert-hash sha256:c1eab2b5dfb905cbbb65ee75a28a4a95b28ef2f9621c2079b7e1a15f68ade4af
# master 执行配置mkdir-p$HOME/.kube
sudocp-i /etc/kubernetes/admin.conf $HOME/.kube/config
sudochown$(id-u):$(id-g)$HOME/.kube/config
八、node节点加入集群[node]
kubeadm join10.36.176.200:8443 --token 9t5hnx.zfmemmdbkraqkzrr \
--discovery-token-ca-cert-hash sha256:c1eab2b5dfb905cbbb65ee75a28a4a95b28ef2f9621c2079b7e1a15f68ade4af
# 可以在master 上查看集群node的信息[root@kube-master1 kube-1.22.0]# kubectl get node
NAME STATUS ROLES AGE VERSION
kube-master NotReady control-plane,master 50m v1.22.0
kube-node1 NotReady <none> 46m v1.22.0
kube-node2 NotReady <none> 46m v1.22.0
九、安装网络插件[master]
[root@kub-k8s-master1 ~]# curl -L https://docs.projectcalico.org/v3.22/manifests/calico.yaml -O# 修改 文件4205 - name: IP_AUTODETECTION_METHOD
4206 value: "interface=ens33"[root@kub-k8s-master1 ~]# kubectl apply -f calico.yaml[root@kub-k8s-master1 ~]# kubectl get pod -A -w # 查看是否所有pod都是running状态# 所有节点状态应为Ready[root@kub-k8s-master1 ~]# kubectl get node