一,场景
无法通过kubectl 命令查看应用pod日志,报error: You must be logged in to the server (the server has asked for the client to provide credentials ( pods/log nginx-test-795d659f45-k7gn5))错误。
二,排错步骤
(1)首先查看节点状态是否Ready状态,状态显示为Ready,这里大概率说明客户端没有问题。
(2)查看kubelet是否禁掉匿名访问,一般kubelet默认允许匿名访问,即--anonymous-auth=true,如果将--anonymous-auth设置为false,即--anonymous-auth=false,那么kubelet作为服务端时,即其他服务访问kubelet的10250端口时需要提供证书,所以先查看kubelet是否禁掉了匿名访问。
vim /etc/kubernetes/kubelet-conf.yml