Minikube with basic-auth fails to start

12/9/2018

I am trying to test basic authentication with latest minikube and it fails to start.

First I start minikube with the following

minikube --cpus 6 --memory 10000 --alsologtostderr start --kubernetes-version="v1.13.0" --vm-driver=virtualbox

Once running I then use minikube ssh and create the file /var/lib/minikube/certs/mini/users.csv with the contents somepassword,johndoe,johndoe123,developers

ie.

$ ls -lat /var/lib/minikube/certs/mini/users.csv
-rw-r--r-- 1 root root 43 Dec  9 21:31 /var/lib/minikube/certs/mini/users.csv
$ more /var/lib/minikube/certs/mini/users.csv 
somepassword,johndoe,johndoe123,developers

I then minikube stop and restart as follows

minikube --cpus 6 --memory 10000 --alsologtostderr start --kubernetes-version="v1.13.0" --vm-driver=virtualbox \
--extra-config=apiserver.basic-auth-file=/var/lib/minikube/certs/mini/users.csv

This resulted in the following error

I1209 21:33:34.716833    7099 ssh_runner.go:57] Run: sudo mkdir -p /var/lib/minikube/certs/
I1209 21:33:34.775015    7099 ssh_runner.go:57] Run: sudo rm -f /var/lib/minikube/certs/proxy-client.key
I1209 21:33:34.820764    7099 ssh_runner.go:57] Run: sudo mkdir -p /var/lib/minikube/certs/
I1209 21:33:34.878749    7099 ssh_runner.go:57] Run: sudo rm -f /var/lib/minikube/kubeconfig
I1209 21:33:34.928998    7099 ssh_runner.go:57] Run: sudo mkdir -p /var/lib/minikube
Connecting to cluster...
Setting up kubeconfig...
I1209 21:33:35.231167    7099 config.go:125] Using kubeconfig:  /home/paulhopkins/.kube/config
Starting cluster components...
I1209 21:33:35.235662    7099 ssh_runner.go:57] Run: 
sudo kubeadm alpha phase certs all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase kubeconfig all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase controlplane all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase etcd local --config /var/lib/kubeadm.yaml

E1209 21:33:35.268920    7099 start.go:302] Error restarting cluster:  running cmd: 
sudo kubeadm alpha phase certs all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase kubeconfig all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase controlplane all --config /var/lib/kubeadm.yaml &&
sudo /usr/bin/kubeadm alpha phase etcd local --config /var/lib/kubeadm.yaml
: Process exited with status 1

I can still ssh into minikube and kubeadm.yaml is as follows:

$ sudo more /var/lib/kubeadm.yaml 
apiEndpoint:
  advertiseAddress: 192.168.99.107
  bindPort: 8443
apiVersion: kubeadm.k8s.io/v1alpha3
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
kind: InitConfiguration
nodeRegistration:
  criSocket: /var/run/dockershim.sock
  name: minikube
  taints: []
---
apiServerExtraArgs:
  basic-auth-file: "/var/lib/minikube/certs/mini/users.csv"
  enable-admission-plugins: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"

apiVersion: kubeadm.k8s.io/v1alpha3
certificatesDir: /var/lib/minikube/certs/
clusterName: kubernetes
controlPlaneEndpoint: localhost:8443
etcd:
  local:
    dataDir: /data/minikube
kind: ClusterConfiguration
kubernetesVersion: v1.13.0
networking:
  dnsDomain: cluster.local
  podSubnet: ""
  serviceSubnet: 10.96.0.0/12$ 

Minikube version is v0.30.0. What am I doing wrong?

-- P Hopkins
kubernetes
minikube

0 Answers