最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

关于Kubernetes-v1.23.6-master节点的初始化操作|全球播报

来源:博客园


(资料图)

当我们在master节点、安装部署完docker与Kubernetes / k8s 相关的软件后,并启动(docker,kubelet)后,接下来就是需要对master节点进行初始化操作了

如下,这里笔者使用的版本的为 Kubernetes-v1.23.6,初始化是使用kubeadm init命令,详细的参数如下所示:

注意点:执行前需要先将docker的Cgroup Driver由默认的cgroupfs修改成systemd,并重启docker让配置生效

[root@k8s-master qq-5201351]# kubeadm init \> --apiserver-advertise-address 192.18.106.87 \> --image-repository registry.aliyuncs.com/google_containers \> --kubernetes-version v1.23.6 \> --service-cidr=10.96.0.0/12 \> --pod-network-cidr=10.224.0.0/16

如果没有相关的报错,就算是正常了,命令执行完成后,可以看到一段提示

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  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config  sudo chown $(id -u):$(id -g) $HOME/.kube/configAlternatively, if you are the root user, you can run:  export KUBECONFIG=/etc/kubernetes/admin.confYou 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/Then you can join any number of worker nodes by running the following on each as root:kubeadm join 192.18.106.87:6443 --token 8iz44r.cxj5duahe37wsdgq \        --discovery-token-ca-cert-hash sha256:08752ac13ae6f821c44abdf6eb1fa2481777b82d20335e4467829ac20b503e55

根据提示,如果要开始使用k8s cluster,还需要在master节点上执行如下几条命令,这里笔者是使用root用户,所以去掉了sudo,最终命令如下:

mkdir -p $HOME/.kubecp -i /etc/kubernetes/admin.conf $HOME/.kube/configchown $(id -u):$(id -g) $HOME/.kube/config

这样,master节点的初始化,就算是完成了,上面的都执行了,也才可以通过kubectl get nodes命令看到k8s集群中的master节点

其他说明:初始化后,我们可以也可以通过docker命令看出来,拉取了如下7个镜像:

[root@k8s-master ~]# docker imagesREPOSITORY                                                        TAG       IMAGE ID       CREATED         SIZEregistry.aliyuncs.com/google_containers/kube-apiserver            v1.23.6   8fa62c12256d   12 months ago   135MBregistry.aliyuncs.com/google_containers/kube-scheduler            v1.23.6   595f327f224a   12 months ago   53.5MBregistry.aliyuncs.com/google_containers/kube-proxy                v1.23.6   4c0375452406   12 months ago   112MBregistry.aliyuncs.com/google_containers/kube-controller-manager   v1.23.6   df7b72818ad2   12 months ago   125MBregistry.aliyuncs.com/google_containers/etcd                      3.5.1-0   25f8c7f3da61   18 months ago   293MBregistry.aliyuncs.com/google_containers/coredns                   v1.8.6    a4ca41631cc7   19 months ago   46.8MBregistry.aliyuncs.com/google_containers/pause                     3.6       6270bb605e12   20 months ago   683kB[root@k8s-master ~]#

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17381460.html

关键词: