[root@linux-node1 opt]# kubectl run nignx --image=nginx --port=80 --replicas=3 [root@linux-node1 opt]# kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE nignx-69789fbff-22vbd 1/1 Running 0 33m 172.17.84.3 192.168.56.12 <none> nignx-69789fbff-glw9m 1/1 Running 0 33m 172.17.75.2 192.168.56.13 <none> nignx-69789fbff-nj25r 1/1 Running 0 33m 172.17.84.2 192.168.56.12 <none> #会有一个授权的问题 [root@linux-node1 opt]# kubectl logs pods/nignx-69789fbff-22vbd Error from server (Forbidden): Forbidden (user=system:anonymous, verb=get, resource=nodes, subresource=proxy) ( pods/log nignx-69789fbff-22vbd) #授权 [root@linux-node1 opt]# kubectl create clusterrolebinding cluster-system-anonymous --clusterrole=cluster-admin --user=system:anonymous clusterrolebinding.rbac.authorization.k8s.io/cluster-system-anonymous created #再次查看 [root@linux-node1 opt]# kubectl logs pods/nignx-69789fbff-22vbd 172.17.84.1 - - [17/Feb/2020:17:46:28 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.29.0" "-"