Kubernetes: Kubectl still pointing to Minikube after removal

1/22/2020

I had Minikube installed on my Mac and then I removed it and replaced it with a 3-node cluster using Multipass and K3s. Now my issue is that kubectl is still referring to Minikube when I execute its commands in terminal.

For instance when I run kubectl get nodes I get the following error:

Error in configuration: 
* unable to read client-cert /Users/hemodd/.minikube/client.crt for cluster1 due to open /Users/hemodd/.minikube/client.crt: no such file or directory
* unable to read client-key /Users/hemodd/.minikube/client.key for cluster1 due to open /Users/hemodd/.minikube/client.key: no such file or directory
* unable to read certificate-authority /Users/hemodd/.minikube/ca.crt for cluster1 due to open /Users/hemodd/.minikube/ca.crt: no such file or directory

I have followed these steps to remove Minikube but I am still getting the same error:

minikube delete 
brew uninstall minikube
rm -rf ~/.minikube

Any help is much appreciated.

-- HemOdd
kubectl
kubernetes
minikube

2 Answers

1/22/2020

Your error are mostly about the wrong setting in kubeconfig, please double check local file ~/.kube/confg

This is the default kubectl configuration file, it includes three parts: clusters, contexts and users

If you have two kubernetes clusters (one is minikube, and the other is k3s), you should be fine to set up them in same file without conflict.

Read this first: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

Each cluster should have related certificates (and user certificates) set properly.

then you are fine to set the current context with below command

kubectl config set-context XXXX
-- BMW
Source: StackOverflow

1/22/2020

Uninstall minikube on MacOS

These are the following Steps

minikube delete
rm /usr/local/bin/minikube
rm -rf ~/.minikube
-- decent owais
Source: StackOverflow