Closed tasdikrahman closed 4 years ago
I feel we can add this piece of info, if it's missing here https://minikube.sigs.k8s.io/docs/handbook/config/#kubernetes-configuration, was wondering how I can pass that file on local machine to minkube for the key authorization-mode=BASICAUTH
, on another note, would that be the right key and value to enable basic auth?
Hey @tasdikrahman so the --extra-config
flag is for passing values to k8s components on startup. For the apiserver to read from a file, you'll need to make sure the file is accessible to the apiserver container and that you pass in the path to the file.
Could you try following the instructions in this comment and see if that fixes this for you? https://github.com/kubernetes/minikube/issues/3438#issuecomment-457067230
Hello @priyawadhwa ,
I tried what was mentioned in the comment here https://github.com/kubernetes/minikube/issues/3438#issuecomment-457067230
This is what I got
$ minikube start --extra-config=apiserver.basic-auth-file=/Users/tasdikrahman/workspace/work/jaach/minikube/users.csv
š minikube v1.2.0 on darwin (amd64)
š” Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
š Restarting existing virtualbox VM for "minikube" ...
ā Waiting for SSH access ...
š³ Configuring environment for Kubernetes v1.15.0 on Docker 18.09.6
āŖ apiserver.basic-auth-file=/Users/tasdikrahman/workspace/work/jaach/minikube/users.csv
š Relaunching Kubernetes v1.15.0 using kubeadm ...
š£ Error restarting cluster: waiting for apiserver: timed out waiting for the condition
šæ Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
š https://github.com/kubernetes/minikube/issues/new
ā Problems detected in "kube-apiserver":
error: invalid authentication config: open /Users/tasdikrahman/workspace/work/jaach/minikube/users.csv: no such file or directory
ā Problems detected in "kube-addon-manager":
error: unable to recognize "STDIN": Get https://localhost:8443/api?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
error: unable to recognize "STDIN": Get https://localhost:8443/api?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
I am passing the absolute path of the basic auth file here as mentioned in the comment
$ cat /Users/tasdikrahman/workspace/work/jaach/minikube/users.csv
somepassword,johndoe,johndoe123,developers
Here are the detailed logs with --alsologtostderr
flag passed while running the command
$ MINIKUBE_IN_STYLE=false minikube --alsologtostderr start --kubernetes-version="v1.13.0" --extra-config=apiserver.basic-auth-file=/Users/tasdikrahman/workspace/work/jaach/minikube/users.csv
Version 6.0.4 r128413 (Qt5.6.3)
$ minikube version
minikube version: v1.2.0
Let me know if you need any other details
@tasdikrahman I noticed your minikube version is very very old, do you mind trying it with a newer minikube and maybe our docker-driver?
Hey @tasdikrahman are you still seeing this issue? If so, could you please upgrade to the latest version of minikube?
I also noticed that you're passing in /Users/tasdikrahman/workspace/work/jaach/minikube/users.csv
as the path to the basic auth file -- this seems to be a path on your host machine (which won't be accessible to the apiserver in the minikube VM).
To make that file accessible, I would:
$ minikube start --extra-config=apiserver.basic-auth-file=/var/lib/minikube/certs/mini/users.csv # This command should fail
$ minikube ssh
mkdir -p /var/lib/minikube/certs/mini
cat > /var/lib/minikube/certs/mini/users.csv
<contents of /Users/tasdikrahman/workspace/work/jaach/minikube/users.csv>
exit
$ minikube stop
$ minikube start --extra-config=apiserver.basic-auth-file=/var/lib/minikube/certs/mini/users.csv # This should pass
Hey @tasdikrahman -- I'm going to go ahead and close this issue as some time has passed without an update. If you're still seeing this error, please reopen at any time by including /reopen
in your comment!
I am trying to start the apiserver with basic auth, by trying to pass BASICAUTH as extra config to minikube when doing minikube start
I want to pass a static basic auth file to the API server as documented here https://kubernetes.io/docs/reference/access-authn-authz/authentication/#static-password-file
But looks like the API server is still not picking up the basic auth after I checked my kubeconfig context.
Things I did
Steps to reproduce the issue: