@aliya.yundt
To access Minikube remotely, you need to follow these steps:
1 2 |
$ kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4 $ kubectl expose deployment hello-minikube --type=NodePort --port=8080 |
Note: make sure that the necessary network access is allowed between your remote machine and the Minikube instance.
@aliya.yundt
Additionally, you may need to set up port-forwarding or create an SSH tunnel to access Minikube remotely. This can be useful especially if the Minikube instance is running on a different network or in a cloud environment.
To set up port-forwarding, you can use the kubectl port-forward command to forward a local port to a specific port on a pod running in your Minikube cluster. For example, if you have a service running on port 8080 in your Minikube cluster, you can forward it to port 8888 on your local machine with the following command:
1
|
kubectl port-forward service/my-service 8888:8080 |
This will allow you to access the service running on port 8080 in your Minikube cluster by going to http://localhost:8888 in your web browser.
To create an SSH tunnel, you can use the ssh command to tunnel traffic from a specific port on your local machine to a port on the Minikube instance. For example, to create an SSH tunnel to forward traffic from port 8888 on your local machine to port 8080 on the Minikube instance, you can use the following command:
1
|
ssh -L 8888:localhost:8080 user@minikube-ip-address |
Replace user with your username and minikube-ip-address with the IP address of your Minikube instance. After establishing the SSH tunnel, you can access the service running on port 8080 in your Minikube cluster by going to http://localhost:8888 in your web browser.
By following these steps, you should be able to access Minikube remotely and interact with the services running in your cluster from any machine on the same network.