3

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?

Lin Du
  • 88,126
  • 95
  • 281
  • 483

2 Answers2

5

Works like charm

kops export kubecfg --name=clustername.com

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

Deepak Sharma
  • 1,401
  • 19
  • 21
4

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}

d0bry
  • 2,232
  • 9
  • 16
  • additional, `kops create cluster --name example.cluster.k8s.local`, the CLUSTER_NAME is `example.cluster.k8s.local` – Lin Du May 30 '18 at 01:59
  • It does seem: `kubeconfig` is no longer available. There is a: `kubecfg` instead. Unfortunately I do get the: `cannot find CA certificate` error, but that seem to be problem related elsewhere. – Tom Raganowicz Mar 03 '19 at 11:20
  • @NeverEndingQueue what was the solution for cannot find CA certificate error – aryan singh May 17 '20 at 18:01
  • It is likely that you have not deployed the cluster and there is only the manifest stored on s3. If the cluster is not deployed you cannot actually use it's context in kubectl. – Piotr Ostrowski May 22 '22 at 15:12