I am trying to switch my local dev environment to run in minikube. I have all the container images built and I have all the YAML configs and I have all the services I need running and I can access them using the URL returned from minikube service web --url
(web is the name of my front facing nginx server). But there is one thing that I have not been able to figure out. The project I am working on requires smart external devices communicating with the backend. I have a few devices sitting on my bench, connected to the local LAN, but I cannot figure out how to expose services running inside minikube to the outside, i.e. so a device can connect to a service using my laptop's external IP. Is there a standard way of doing this?
Edit: I have attempted to configure an ingress for my service. Here is my ingress config.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web
spec:
backend:
serviceName: web
servicePort: 80
The web service is accessible via minikube service web
command and is exposed as type NodePort. All I get is "default backend 404" when I try to access the ingress. On the other hand, even if it did work, I would still have a problem, since ingress is exposing the service on the VM internal subnet and is not accessible from outside of the host machine. I am starting to consider running a proxy or accelerator of some sort to forward things from the host to the minikube vm. Still need to have ingress running to have a persistent endpoint for the proxy.
The minikube VM is exposed to the host system via a host-only IP address, that can be obtained with the minikube ip command. Any services of type NodePort can be accessed over that IP address, on the NodePort.
Access the application Now you know the IP address and port to be used to access the nginx application. In this case, 192.168. 64.7 is the IP address of minikube which you can also retrieve using the command `minikube ip`. Open a browser and check your nginx application.
Create a Service The --type=LoadBalancer flag indicates that you want to expose your Service outside of the cluster. The application code inside the image registry.k8s.io/echoserver only listens on TCP port 8080. If you used kubectl expose to expose a different port, clients could not connect to that other port.
Use the Minikube Ingress add-on, for example, see this blog post how to set it up and use it.
There are multiple ways. But i found out solution this way.
~ → 🐳 $ minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
Here we can connect with the service using 192.168.99.100 and nodeport. Say for Dashboard with node port 30000 the url will be: http://192.168.99.100:30000/
one can get the service port by using below commands:
~ → 🐳 $ kubectl get svc --all-namespaces
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With