kubeadm을 이용해 kubectl 클라이언트 인증서 재발급
평소와 같이 kubectl 명령어를 이용하여 쿠버네티스 클러스터를 관리하고자 할 때,
$ kubectl get pods
E0203 14:57:20.027306 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
E0203 14:57:20.044586 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
E0203 14:57:20.074710 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
E0203 14:57:20.091019 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
E0203 14:57:20.112078 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
E0203 14:57:20.133508 2127013 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: the server has asked for the client
to provide credentials"
error: You must be logged in to the server (Unauthorized)
와 같은 오류가 발생한다면,
/etc/kubernetes
가 존재하는 쿠버네티스 컨트롤 플레인 노드에서
sudo kubeadm kubeconfig user --client-name=kubernetes-admin --org system:masters
를 이용해 클라이언트 인증서를 새로 만들고, 이를 클라이언트 노드의 ~/.kube/config
에 넣어주면 해결이 될 수도 있습니다.