kubectl get svc
$ kc get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube1 LoadBalancer 10.96.184.178 10.96.184.178 8080:30791/TCP 40s
Note that without minikube tunnel, Kubernetes will show the external IP as “pending”.
Try in your browser
Open in your browser (ensure there is no proxy set)
http://REPLACE_WITH_EXTERNAL_IP:8080
Each service will get its own external IP.
DNS resolution (experimental)
If you are on macOS, the tunnel command also allows DNS resolution for Kubernetes services from the host.
NOTE: docker driver doesn’t support DNS resolution
Cleaning up orphaned routes
If the minikube tunnel
shuts down in an abrupt manner, it may leave orphaned network routes on your system. If this happens, the ~/.minikube/tunnels.json file will contain an entry for that tunnel. To remove orphaned routes, run:
minikube tunnel --cleanup
NOTE: --cleanup
flag’s default value is true
.
Avoiding password prompts
Adding a route requires root privileges for the user, and thus there are differences in how to run minikube tunnel
depending on the OS. If you want to avoid entering the root password, consider setting NOPASSWD for “ip” and “route” commands:
https://superuser.com/questions/1328452/sudoers-nopasswd-for-single-executable-but-allowing-others
Access to ports <1024 on Windows requires root permission
If you are using Docker driver on Windows, there is a chance that you have an old version of SSH client you might get an error like - Privileged ports can only be forwarded by root.
or you might not be able to access the service even after minikube tunnel
if the access port is less than 1024 but for ports greater than 1024 works fine.
In order to resolve this, ensure that you are running the latest version of SSH client. You can install the latest version of the SSH client on Windows by running the following in a Command Prompt with an Administrator Privileges (Requires chocolatey package manager)
The latest version (OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
) which is available on Windows 10 by default doesn’t work. You can track the issue with this over here - https://github.com/PowerShell/Win32-OpenSSH/issues/1693
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.