While working on a kubernetes based project, I had to set the $KUBECONFIG env variable in order to access a private cluster.
Later, I started minikube and ran kubectl config view. This resulted in all my kubectl calls to the private cluster failing.
The reason is due to the way kubectl config behaves when it detects the $KUBECONFIG env variable. According to the docs:
As stated in point 2 above, since my $KUEBCONFIG is still present, when I started minikube, it merges the minikube settings into file pointed to by $KUBECONFIG, updating it by merging the contents of minikube, and sets minikube as the current context. Which is why all the kubectl calls are going to the minikube cluster only.
As a note to self, I need to remember to