kops - get wrong kubectl context

2019-08-04 04:43发布

问题:

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?

回答1:

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}