kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.5k stars 4.89k forks source link

Headless minikube, help accessing the dashboard web page? #19704

Closed kelvtech-co-uk closed 1 week ago

kelvtech-co-uk commented 1 month ago

What Happened?

Just starting out so I'm expecting this is all user error sorry but I'd appreicate pointing in the right direction.

Running minikube with the docker driver and the courseware I'm following is trying to demonstrate the dashboard web interface. FWIW some of my other containers I put in a macvlan network but the rest are in a docker bridge network. Naively I thought I'd just be able to instruct minikube to use one of my custom docker macvlan networks and take an IP I'd specify?

Using minikube start --force --driver=docker --network=bridge works except inspecting the minikube container the HostIP for all the port assignments is 127.0.0.1. Also I'm noting that the dashboard url uses a socket where the port isn't within the range of mapped ports to the container.

I found the --listen-address start parameter which helps move the container to listen on say 0.0.0.0 but I'm still struggling then with the port mapping misalignment.

I also looked at kubectl proxy and changed the port and address values e.g. kubectl proxy -p 8100 --address 0.0.0.0 and I can reach that from my workstation and get a page just saying "Forbidden", not sure though I've understood the linkage to the dashboard correctly here yet so apols if this is superflous.

Thanks in advance.

Attach the log file

log.txt

Operating System

Other

Driver

Docker

kelvtech-co-uk commented 1 week ago

FWIW the above nearly works, I was missing the --accept-hosts parameters and I was also probably constructing the URL with an incorrect IP address.

kubectl proxy --address=0.0.0.0 --port=8050 --accept-hosts='.*'

http://ipaddress:8050/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ Using the server IP where the kubectl command was run and the port provided in the command then makes the dashboard url accessible.

Also worth to note that the --network and --listen-address parameters in the initial minikube command are superfluous and probably should be omitted.