[Azure] ERROR: A different object named 'x' already exists in clusters in your kubeconfig file.
원인
az aks get-credentials -g [리소스그룹 name] -n [aks name]
AKS를 만들어준 다음 kubectl을 사용하기 위해 클러스터에 연결해줬다.
그랬더니 ERROR: A different object named 'x' already exists in clusters in your kubeconfig file. 라는 오류가 나왔다.
이유는 만든 AKS 이름과 동일하게 kubeconfig 파일이 있기 때문이다.
나의 경우 예전에 만들어둔 AKS를 삭제할 때 제대로 kubeconfig 파일까지 삭제하지 않아 생긴 현상이었다.
해결
az aks get-credentials -g [리소스그룹 name] -n [aks name] --overwrite-existing
해결방법은 의외로 간단하다.
뒤에 --overwrite-existing 만 해주면 된다.
기본값은 false이기 때문에 꼭 넣어줘야 오버라이딩이 가능하다.
참고
https://github.com/Azure/azure-cli/issues/7670
az aks get-credentials error: A different object named {{ name }} already exists in clusters · Issue #7670 · Azure/azure-cli
Describe the bug I have a script that deletes and recreates an AKS cluster. Unfortunately it doesn't work since when I'm trying to recreate cluster and get it creds i receive a following error: A d...
github.com