So, i'm trying to work with kubernetes (minikube). I'm a total beginner, with some basic experience with docker. It turns out, i installed kubernetes 2 days ago and haven't managed to do a single thing. I barely managed to connect to the dashboard, and spent an ungodly amount of time finding how to get authenticated for that.
All i'm trying to do is to deploy a single docker image but I can't even do a basic hello world tutorial, as pretty much whatever command i type, i get an error message about not being authorized.
At the moment, I'm trying to write a deployment file, but i'm getting this "unauthorized" error as soon as i use "kubectl create". I'm totally at a loss as to what to do.
kubectl create -f deployment.yaml
error: unable to recognize "deployment.yaml": Unauthorized
I don't know what information to give you. Here is the minikube status:
minikube status
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
Minikube version : v1.2.0
Docker version : 18.06.3-ce, build d7080c1
kubectl version :
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:40:16Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Do you guys have any idea what to do? The issue here is really that i don't understand what is happening: - Why do i need to authenticate? - What do i need to authenticate myself against? - Why is it not self evident what to do?
I find that most pages about the topic online are either outdated, or ask me to perform action that just end up returning "enable to recognize ... : Unauthorized". The tutorials online don't address this problem. They all seem to automatically be able to use "kubectl create" without any need for authentication.
Do you know what i'm supposed to do? Have you had this problem?
I solved the problem by deleting ~/.kube and removing the minikube and kubectl binaries at /usr/local/bin.
I re-downloaded and re-installed minikube and kubectl. I then launched minikube start
, and everything is now working fine.
The origin of my problem seem to have been the installation of the dashboard. I followed some indications online, not knowing exactly what i was doing. In the process, i had to create some security roles, and something involving a token. I managed to connect to the dashboard, but from then on, every kubectl command told me that i was unauthorized.