Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kops - get wrong kubectl context

I use kops create kubernetes cluster in aws.

I want to validate the cluster using this command:

kops validate cluster

The stdout give me: Using cluster from kubectl context: minikube

I think the problem is the wrong context, but why I kops does not create context for me?

This is my contexts:

kubectl config get-contexts
CURRENT   NAME       CLUSTER    AUTHINFO   NAMESPACE
*         minikube   minikube   minikube

there is no aws kubernetes cluster context.

How do I solve this?

like image 997
slideshowp2 Avatar asked Jun 26 '26 22:06

slideshowp2


2 Answers

Works like charm

kops export kubecfg --name=clustername.com

kops has set your kubectl context to k9s.finddeepak.com

like image 192
Deepak Sharma Avatar answered Jun 28 '26 16:06

Deepak Sharma


kops helps you to create, destroy, upgrade and maintain production-grade, highly available Kubernetes clusters from the command line. AWS (Amazon Web Services) is currently officially supported, with GCE in beta support , and VMware vSphere in alpha, and other platforms planned.

Your actual configuration uses minikube config file from the previous installation. And it is fine. It’s useful to have a few clusters in one config and switch between them.

The extended configuration will be saved into a ~/.kube/config file, you may try:

kops export kubeconfig ${CLUSTER_NAME}

like image 23
d0bry Avatar answered Jun 28 '26 14:06

d0bry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!