I am following a simple Kuberentes Minikube tutorial on Linux Mint 18.3, trying to to create a volume from the following get started tutorial :
https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/
minikube start --vm-driver=virtualbox
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.
kubectl config use-context minikube
Switched to context "minikube"
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-pv.yaml
error: You must be logged in to the server (the server has asked for the client to provide credentials)
Why do I receive that error ? Searched thoroughly through the docs and github but could not find an answer.
I could successfully try out the above example in minikube v0.23.0 with Kuberebtes version 1.8. But the reason for failing in v1.10 as I guess is the default Authentication and Authorization to Kubelet's API is not set properly. You should set legacy default values to the KubeletConfiguration to preserve the command line API.
This is the Kubernetes source snippet that sets up those legacy defaults. https://github.com/kubernetes/kubernetes/blob/de8cc313554b7f7d41509ca620f71439cd8729eb/cmd/kubelet/app/options/options.go#L281-L293
Running the below command should set those values:
minikube start --extra-config=kubelet.Authentication.Anonymous.Enabled=true
--extra-config=kubelet.Authentication.Webhook.Enabled=false
--extra-config=kubelet.Authorization.Mode=AlwaysAllow