Member-only story
Switch Between Kubernetes Clusters Quickly
If you have more than one cluster to deal with, this can save you some time
Context is Key
If you use kubectl
, most of your commands are going to rely on what your current kubeconfig
is set up with.
When you have more than one Cluster you have to switch between, you’ll probably see something like this when you run kubectl config get-contexts
CURRENT NAME CLUSTER
cluster-1 arn:aws:eks:us-east-1:X:cluster/cluster-1
cluster-2 arn:aws:eks:us-east-1:X:cluster/cluster-2
* cluster-3 arn:aws:eks:us-east-2:X:cluster/cluster-3
Granted, you’ll have a few more columns and they’ll wrap, but this is probably the most important part of the output: the cluster and the name. The star next to the context name lets you know which one is the current one.
So what would you do to set your contexts normally? Well you might…
List Your Configs, Then Pick One
This was my standard workflow for a long time. I would run:
$ kubectl config get-contexts
CURRENT NAME CLUSTER
cluster-1 arn:aws:eks:us-east-1:X:cluster/cluster-1…