Deploying k8s Cluster 05 with KUBEADM-Configuring KUBECTL Access Kube-apiserver
2018/1/4
Configuring KUBECTL Access Kube-apiserver
- Switch master node to connect to the Apiserver of this node
- Confirm Cluster Information
Switch master node to connect to the Apiserver of this node
### in order to perform kubectl on these 2 new nodes requires configuration admin.yaml[[email protected] ~]# mkdir-p ~/k8s_ Install/master/admin[[email protected] ~]# CD!$[[email protected] admin]# cp-a/etc/kubernetes/admin.conf Tvm-01.admin.conf[[email protected] admin]# sed-i ' s#10.10.9.67:6443#10.10.9.68:6443# ' tvm-01.admin.conf[[ Email protected] admin]# SCP tvm-01.admin.conf 10.10.9.68:/etc/kubernetes/admin.conf[[email protected] ~] # mkdir-p $HOME/.kube[[email protected] ~]# cp-i/etc/kubernetes/admin.conf $HOME/.kube/config### the same operation, Execute on another node: [[email protected] admin]# cp-a/etc/kubernetes/admin.conf tvm-02.admin.conf[[email protected] admin]# sed-i ' s#10.10.9.67:6443#10.10.9.69:6443# ' tvm-02.admin.conf[[email protected] admin]# SCP tvm-02.admin.conf 10.10.9.69:/etc/kubernetes/admin.conf[[email protected] ~]# mkdir-p $HOME/.kube[[email protected] ~]# cp-i/etc/kubernetes/admin.conf $HOME/.kube/config
Confirm Cluster Information
[[email protected] ~]# kubectl cluster-infoKubernetes master is running at https://10.10.9.68:6443KubeDNS is running at https://10.10.9.68:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxyTo further debug and diagnose cluster problems, use ‘kubectl cluster-info dump‘.[[email protected] ~]# kubectl cluster-infoKubernetes master is running at https://10.10.9.69:6443KubeDNS is running at https://10.10.9.69:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxyTo further debug and diagnose cluster problems, use ‘kubectl cluster-info dump‘.### 上述信息显示,每个节点已经连接到本机的 apiserver 上
Deploying k8s Cluster 05 with KUBEADM-Configuring KUBECTL Access Kube-apiserver