1

I am trying to run validate cluster command as per the documentation kops validate

Strangely it fails with following error

$ AWS_ACCESS_KEY_ID=<my_legit_key> AWS_SECRET_ACCESS_KEY=<my_legit_secret_key> kops validate cluster --wait 10m --state="s3://<my_bucket_name>" --name=<my_cluster_name>
Validating cluster <my_cluster_name>


Validation failed: cannot load kubecfg settings for "<my_cluster_name>": context "<my_cluster_name>" does not exist

1

I loaded the kubeconfig before and the error disappeared.

$ export KUBECONFIG=~/workspace/myrepo/_kube/dev/kubeconfig
$ AWS_ACCESS_KEY_ID=<my_legit_key> AWS_SECRET_ACCESS_KEY=<my_legit_secret_key> kops validate cluster --wait 10m --state="s3://<my_bucket_name>" --name=<my_cluster_name>
## And it worked

If the kubeconfig does not exist yet, then we can export it as well.

$ kops export kubecfg --admin=87600h0m0s --kubeconfig ~/workspace/myrepo/_kube/dev/kubeconfig --state=s3://my-kops-dev-v4 --name=k8.mydomain.com
0

Try running the kops get command to see if kOps can read the configuration stored in the s3 bucket correctly. If you get an error then you probably have missed a required configuration in your environment. I had a similar issue but I was using Named profiles for AWS. I had to set an extra variable export AWS_SDK_LOAD_CONFIG=1 for kOps to pick up the settings (I think it was AWS_REGION) correctly. If it's just kops validate that is failing then make sure you are using the correct context.

1
  • Actually its able to read S3 configuration. What its not able to do is load the kubeconfig. What really helped me is loading the kubeconfig earlier. Jun 7 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.