症状
Azure のチュートリアルどおりにやれば失敗しないはず…なのだが、ちょっと間違えると、こういう羽目に陥る可能性がある。
az aks get-credentials -g <AKSのリソースグループ> -n <AKSのクラスタ名>
を行い
A different object named clusterUser_camino_camino-wus-2 already exists in your kubeconfig file.
Overwrite? (y/n):
に気軽く y
し
Merged "camino-wus-2" as current context in /home/monaka/.kube/config
と表示されているにも関わらず危機感なく
$ kubectl get po -n kube-system
からの
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code S4GMR4BN2 to authenticate.
など言われるので、言われたとおりに認証してみると
Error from server (Forbidden): pods is forbidden: User "monaka@example.com" cannot list resource "pods" in API group "" in the namespace "kube-system"
default
namespace にある pod も読めない。kubectl get nodes
も通らない。かなり焦る。
解決手段
az aks get-credentials -g <AKSのリソースグループ> -n <AKSのクラスタ名> --admin
--admin
がミソ。リソースグループ名は MC_
が付かないほう。
右も左もわからない状態で get po
さえ通らない状態になると、割と動転するので、メモ。