mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown ( i d − u ) : (id -u): (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:
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:
kubeadm join 192.168.119.157:6443 --token jtoche.kcb0kvylmdyfh089 --discovery-token-ca-cert-hash sha256:76090108cf1281c3c2b82b315f25d85380fadfa545581745c13600a0800016df
请将最后一整行的内容"kubeadm join 192.168.119.157:6443 …"保存好,这是node节点加入kubernates环境时用到的;
mkdir -p $HOME/.kube \
&& cp -i /etc/kubernetes/admin.conf $HOME/.kube/config \
&& chown ( i d − u ) : (id -u): (id−u):(id -g) $HOME/.kube/config
如上图红框所示,安装Flannel需要执行如下命令:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml
执行成功后控制台输入如下:
[root@localhost ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de
《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》
【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享
4c0d86c5cd2643275/Documentation/kube-flannel.yml
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.extensions/kube-flannel-ds-amd64 created
daemonset.extensions/kube-flannel-ds-arm64 created
daemonset.extensions/kube-flannel-ds-arm created
daemonset.extensions/kube-flannel-ds-ppc64le created
daemonset.extensions/kube-flannel-ds-s390x created
kubectl get pods --all-namespaces
控制台输出如下,如果您的pod信息少于以下内容,则有可能是某些:
[root@localhost ~]# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-576cbf47c7-564dg 1/1 Running 0 164m
kube-system coredns-576cbf47c7-snqkd 1/1 Running 0 164m
kube-system etcd-localhost.localdomain 1/1 Running 0 164m
kube-system kube-apiserver-localhost.localdomain 1/1 Running 0 163m
kube-system kube-controller-manager-localhost.localdomain 1/1 Running 0 163m
kube-system kube-flannel-ds-amd64-r8wbb 1/1 Running 0 4m17s
kube-system kube-proxy-z7kn2 1/1 Running 0 164m
kube-system kube-scheduler-localhost.localdomain 1/1 Running 0 163m
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
k8s.gcr.io/kube-proxy v1.12.2 15e9da1ca195 10 days ago 96.5 MB
k8s.gcr.io/kube-apiserver v1.12.2 51a9c329b7c5 10 days ago 194 MB
k8s.gcr.io/kube-controller-manager v1.12.2 15548c720a70 10 days ago 164 MB
k8s.gcr.io/kube-scheduler v1.12.2 d6d57c76136c 10 days ago 58.3 MB
k8s.gcr.io/etcd 3.2.24 3cab8e1b9802 6 weeks ago 220 MB
k8s.gcr.io/coredns 1.2.2 367cdc8433a4 2 months ago 39.2 MB
quay.io/coreos/flannel v0.10.0-amd64 f0fad859c909 9 months ago 44.6 MB
k8s.gcr.io/pause 3.1 da86e6ba6ca1 10 months ago 742 kB
至此,master节点已经部署成功,下一章继续实战,将node加入集群环境;
《CentOS7环境部署kubenetes1.12版本五部曲之一:标准化机器》;
《CentOS7环境部署kubenetes1.12版本五部曲之二:创建master节点》;
《CentOS7环境部署kubenetes1.12版本五部曲之三:node节点加入》;
《CentOS7环境部署kubenetes1.12版本五部曲之四:安装dashboard》;
《CentOS7环境部署kubenetes1.12版本五部曲之五:安装kubectl》;
版本五部曲之三:node节点加入》]( );
《CentOS7环境部署kubenetes1.12版本五部曲之四:安装dashboard》;
《CentOS7环境部署kubenetes1.12版本五部曲之五:安装kubectl》;
[外链图片转存中…(img-BHPjFMCe-1638670964650)]