1.k8s无法登陆到容器
[root@K8S1 work]# kubectl exec -it fgedu-nginx-6d9fc8974d-tgnn2 -- bash
error: unable to upgrade connection: Unauthorized
[root@K8S1 ~]# kubectl get csr
No resources found
[root@K8S1 work]# kubectl logs fgedu-nginx-654c99fbf-mnwsx
error: You must be logged in to the server (the server has asked for the client
to provide credentials ( pods/log fgedu-nginx-654c99fbf-mnwsx))
2.原因分析
Kubelet不允许匿名用户访问。这里改成 true,所有的Kubelet部署节点都修改,然后重启Kubelet即可。
3.登陆 nginx容器
[root@K8S1 work]# kubectl exec -it fgedu-nginx-654c99fbf-2p9w4 -- bash
root@fgedu-nginx-654c99fbf-2p9w4:/#
root@fgedu-nginx-654c99fbf-2p9w4:/# ls
bin docker-entrypoint.d home media proc sbin tmp
boot docker-entrypoint.sh lib mnt root srv usr
dev etc lib64 opt run sys var