Kops / Kubernetes: No context set in kubecfg, name is required
Someone else in my org did the initial setup Kubernetes setup with Kops on AWS, so we already have the S3 bucket config and the cluster running.
My local env KOPS_STATE_STORE
is pointing to the previously setup S3 bucket. The CLUSTER_NAME
env is set to: [name].k8s.local
since it's a gossip-based cluster.
I'm trying to get kops and kubectl setup locally to work with this pre-made cluster. I have AWS credentials setup, and when i run kops get cluster
I see sitenamecom.k8s.local aws us-west-1a
.
When I do kubectl config get-clusters
or kubectl config get-contexts
it prints nothing except blank columns.
When I do kops validate cluster
it says: root.go:227] no context set in kubecfg --name is required
Solution 1:
I figured it out, had to run:
kops get clusters
Next, set the KOPS_CLUSTER_NAME
variable, if you haven't set it already
export KOPS_CLUSTER_NAME=<your_cluster_name>
To set the context just run
kops export kubecfg