問題
Amazon EKSクラスターのkubeconfigが取得できない
# クラスターの kubeconfig を作成または更新
$ aws eks update-kubeconfig --name <cluster_name>
Could not connect to the endpoint URL: "https://eks.ap-northeast-1.amazonaws.com/clusters/<cluster_name>"
補足:
<cluster_name>
は事前に作成したEKSクラスター名
調査
AWS CLIの設定を確認
$ aws configure
AWS Access Key ID [****************WVJA]:
AWS Secret Access Key [****************LD/m]:
Default region name [ap-northeast-1]:
Default output format [None]:
原因
AWS CLIで設定しているリージョンとEKSクラスターを作成したリージョンが不一致だった。
- AWS CLIで設定しているリージョン:ap-northeast-1
- EKSクラスターを作成したリージョン:us-west-2
補足
ap-northeast-1:アジアパシフィック (東京)
us-west-2:オレゴン
対処
EKSクラスターを作成したリージョンをAWS CLIで設定する
aws configure
AWS Access Key ID [****************WVJA]:
AWS Secret Access Key [****************LD/m]:
Default region name [ap-northeast-1]: us-west-2
Default output format [None]:
Amazon EKSクラスターのkubeconfigが取得できるようになったことを確認
$ aws eks update-kubeconfig --name <cluster_name>
Added new context arn:aws:eks:us-west-2:xxxxx:cluster/<cluster_name> to /Users/<username>/.kube/config