Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to update kubectl to see a new Kubernetes cluster
# This is something that I always forget and had a surprisingly hard time finding (or better yet, understanding). Here's the
# scenario: a colleague creates a new kubernetes cluster, named"". You want to look at it (for
# troubleshooting, updating the deployment, whatever). To get your kubectl installation to "see" the new cluster, take the
# following steps:
# ASSUMPTION: You have pointed kops to some location where the cluster configurations are stored
# (I have this in my ~/.bash_profile):
export KOPS_STATE_STORE=s3://example-state-store
# Use kops to get the list of clusters
$ kops get clusters
NAME CLOUD ZONES aws us-west-2a aws us-west-2a aws us-west-2a
# Export the configuration of the cluster you care about; this will update your ~/.kube/config file, so kubectl knows about it:
$ kops export kubecfg
Kops has set your kubectl context to
# Now you should see the in your list of kubectl contexts:
$ kubectl config get-contexts

This comment has been minimized.

Copy link

yuriatgoogle commented Mar 15, 2019

Thank you for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.