Unable to read client-cert and client-key when trying to run kubectl get pods with minikube

6/6/2020

I'm on Ubuntu linux VM and trying to run minikube on it.

I installed kubectl via homebrew and then installed minikube by following below installation guides:<br> kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-linux<br> minikube: https://kubernetes.io/docs/tasks/tools/install-minikube/

I started minikube as sudo minikube start --driver=none which has the following output:<br> enter image description here

When I run the command: kubectl get pods, I get an error:

Error in configuration:
* unable to read client-cert /home/jenkins/.minikube/profiles/minikube/client.crt for minikube due to open /home/jenkins/.minikube/profiles/minikube/client.crt: permission denied
* unable to read client-key /home/jenkins/.minikube/profiles/minikube/client.key for minikube due to open /home/jenkins/.minikube/profiles/minikube/client.key: permission denied

The user I'm installing all above is /home/jenkins. I'm not sure what's going wrong. Can someone help?

-- Abhijeet Vaikar
jenkins
kubernetes
minikube
ubuntu

1 Answer

12/22/2021

There are 2 typical scenarios for such situations: either your keys were not created during minikube installation either you dont have proper permissions from your user.

For 1st case(not your) - you will clearly see in logs no such file or directory. To know more and how to resolve it - please refer to Unable to read client-cert/key Post Minikube Update

2nd is yours: client.crt: permission denied. Your current user doesnt have proper rights to read the file.

Resolution inside your screenshot. You should run below commands after cluster was created.

enter image description here

-- Vit
Source: StackOverflow