1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

eksでkubectlの管理対象コンテキストを切り替える

Last updated at Posted at 2023-01-10

前提

動作確認環境

  • k8sバージョン 1.23
  • aws cliバージョン 2.7.31
  • eksctlバージョン 0.122.0
  • kubectlバージョン 1.25.2

本題

コンテキスト一覧確認

kubectl config get-contexts

目的のコンテキストがkubeconfigに未登録の場合

以下のコマンドでkubeconfigを更新する(クラスター名、リージョンは適宜修正)

# クラスター一覧参照
aws eks list-clusters
# kubeconfig更新
aws eks update-kubeconfig --region ap-northeast-1 --name hoge-cluster

操作したいコンテキストに切り替える

kubectl config use-context arn:aws:eks:ap-northeast-1:111122223333:cluster/hoge-cluster

現在のコンテキストを確認

kubectl config current-context 
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?