Apple M1 minikube no service URL
Asked Answered
B

1

1

I'm working on Apple Silicon M1 Max and I'm trying to access service through web browser, but minikube service nginx opens blank web browser tab with some address (for example http://192.168.49.2:31542/) which fails to load. In log below you can notice output from minikube service list has no URL in URL column. Command minikube service nginx --url does not return any URL as well.

$ minikube start --driver=docker
πŸ˜„  minikube v1.25.2 on Darwin 12.3 (arm64)
    β–ͺ MINIKUBE_ACTIVE_DOCKERD=minikube
✨  Using the docker driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ’Ύ  Downloading Kubernetes v1.23.3 preload ...
    > preloaded-images-k8s-v17-v1...: 419.07 MiB / 419.07 MiB  100.00% 22.15 Mi
πŸ”₯  Creating docker container (CPUs=2, Memory=7903MB) ...
🐳  Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
    β–ͺ kubelet.housekeeping-interval=5m
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”Ž  Verifying Kubernetes components...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

 $ kubectl create deployment nginx --image=nginx && kubectl create service nodeport nginx --tcp=80:80
deployment.apps/nginx created
service/nginx created

 $ kubectl get service
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP        12m
nginx        NodePort    10.104.191.210   <none>        80:31542/TCP   12m

 $ minikube service list
|-------------|------------|--------------|-----|
|  NAMESPACE  |    NAME    | TARGET PORT  | URL |
|-------------|------------|--------------|-----|
| default     | kubernetes | No node port |
| default     | nginx      | 80-80/80     |     |
| kube-system | kube-dns   | No node port |
|-------------|------------|--------------|-----|

$ minikube service nginx --url

πŸƒ  Starting tunnel for service nginx.
❗  Because you are using a Docker driver on darwin, the terminal needs to be open to run it.

Any ideas why there is no service URL and I am not able to access service from web browser?

Beyrouth answered 29/3, 2022 at 19:10 Comment(2)
I replicated it on Minikube on Linux and its worked. Unfortunately I don't have a Macbook to check and it could be issue with Docker Desktop. You can try Enable Kubernetes option in Docker Desktop in Settings>Kubernetes. Cluster will be created automatically and you will be able use kubectl commands in few minutes in terminal. After your Deployment will be created, you will be able to open web browser and check using URL localhost:port_number. Let me know if it will solve your issue! – Veracruz
try kubectl port-forward service/service-name, it will work also refer to following on GIT github.com/kubernetes/minikube/issues/11193 – Electroencephalograph
F
1

The network is limited if using the Docker driver on Darwin, Windows, or WSL, and the Node IP is not reachable directly.

Run service tunnel

minikube service nginx

Check ssh tunnel in another terminal

$ ps -ef | grep [email protected]
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -N [email protected] -p 55972 -i /Users/FOO/.minikube/machines/minikube/id_rsa -L TUNNEL_PORT:CLUSTER_IP:TARGET_PORT

Open in your browser

http://127.0.0.1:TUNNEL_PORT

ref: https://minikube.sigs.k8s.io/docs/handbook/accessing/#using-minikube-service-with-tunnel

Footfall answered 21/5, 2022 at 13:18 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.