I have deployed a mosquitto broker with kubernetes in my Linux machine. Now I want to connect this container with a MQTT client running on my smartphone. How could I do that? Which IP should I connect to?
I have connected to the mosquitto broker with a client inside my machine and it works perfectly.
EDIT: I'm using NodePort:
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/mosquitto-entrypoint NodePort 10.152.183.235 <none> 8080:30001/TCP 24hIf the host where your service runs is accessible from your smartphone, you could port map the service to Nodeport.
For example , if your machine IP is 192.168.x.y and you map your service to Hosts port/Nodeport 5000
And machine allows incoming connections from your phone when you are connected to allowed network.
You could reach the service on 192.168.x.y:5000
If your mobile app is on the same network, ideally NodePort must do good. You must be able to reach your service with IP 10.152.183.235.
But this might not be the scenario I believe
apiVersion: v1 kind: Service metadata: name: example-service spec: selector: app: example ports: - port: 8765 targetPort: 9376 type: LoadBalancer
Define a yml for your service, and apply it via kubectl kubectl apply -f <yourfile>
If you have a DNS server of your own, then you can prefer using an Ingress Controller and expose your service to outside network.