我有一个主节点和一个工作节点
在工作节点上,我只运行了2条命令
a)kubeadm reset
b)kubeadm join ......... ..... ..... ....
所以我需要做一些跟在主节点上一样的事情吗?
a)kubeadm init
b)kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
由于我尚未完成 kubeadm初始化,因为我认为它将成为主节点, 无论如何,我无法使用任何命令,例如kubectl获取节点,kubectl获取吊舱。
我的主节点和工作节点状态已准备好
我在主节点上部署了一个Pod,并且能够 ping www.google.com
但是当我使用
部署一个吊舱时spec:
nodeSelector :
nodeName : nodeName
所以我成功地使用标签将Pod部署在了工作节点上
但是我无法在Pod内ping
从主节点输出命令:-
aquilak8suser@ip-172-31-6-149:/$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-11-87 Ready <none> 4h35m v1.13.3
ip-172-31-6-149 Ready master 11h v1.13.3
aquilak8suser@ip-172-31-6-149:/$ kubectl get pods -n kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
calico-kube-controllers-5f454f49dd-75r5w 1/1 Running 0 11h 192.168.179.67 ip-172-31-6-149 <none> <none>
calico-node-298r4 0/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
calico-node-5979v 0/1 Running 0 4h37m 172.31.11.87 ip-172-31-11-87 <none> <none>
coredns-86c58d9df4-6rzt2 1/1 Running 0 11h 192.168.179.65 ip-172-31-6-149 <none> <none>
coredns-86c58d9df4-722tb 1/1 Running 0 11h 192.168.179.66 ip-172-31-6-149 <none> <none>
etcd-ip-172-31-6-149 1/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
kube-apiserver-ip-172-31-6-149 1/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
kube-controller-manager-ip-172-31-6-149 1/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
kube-proxy-496gh 1/1 Running 0 4h37m 172.31.11.87 ip-172-31-11-87 <none> <none>
kube-proxy-7684r 1/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
kube-scheduler-ip-172-31-6-149 1/1 Running 0 11h 172.31.6.149 ip-172-31-6-149 <none> <none>
aquilak8suser@ip-172-31-6-149:/$ kubectl logs coredns-86c58d9df4-6rzt2 --tail=200 -n kube-system
.:53
2019-06-06T04:20:31.271Z [INFO] CoreDNS-1.2.6
2019-06-06T04:20:31.271Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
[INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
root@spring-boot-demo-pricing-66f668cbb4-q5dc2:/# cat /etc/resolv.conf
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local us-east-2.compute.internal
options ndots:5
root@spring-boot-demo-pricing-66f668cbb4-q5dc2:/#
答案 0 :(得分:2)
否,您不需要在工作节点中运行kubeadm init
或kubectl apply -f "https://cloud.weave......
。 Check
要从工作程序节点使用kubectl命令,您需要将/etc/kubernetes/admin.conf文件传输到工作程序节点,并将其放入/ {username} /。kube / config
scp /etc/kubernetes/admin.conf {workerNoderUser}@{workerNoderIP}:/{username}/.kube/config
一旦您传输了配置,您就可以在工作节点上运行kubectl命令。