LoginSignup
1
1

More than 3 years have passed since last update.

AKS と Azure AD とを統合している途中でクレデンシャルを失ったときのリカバリ手段

Last updated at Posted at 2021-03-14

症状

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 さえ通らない状態になると、割と動転するので、メモ。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1