UNHEALTHY state probe when expose a MQTT service from GKE Ingress

3/31/2020

I'm using Google Kubernets Engine (GKE) to deploy a simple MQTT Server (Mosquitto) and the GKE Ingress to expose the Websocket of the MQTT Server to be cosumend from my javascript cliente side. This is the archiecture related with the previous services:

1) I Have a Pod with a replica 1 of container with a MQTT Server (Mosquitto). This container expose the ports: - 1883: MQTT Port to connect from server side (nodeJS App) - 9001: Websocket Port to connect from any cliente side (Javascript App from my Browse).

2) I Have a kubernetes service that expose both ports 1883 --> 1883 and 9001 --> 9001 that connect with the previous Pod. 3) I create a kubernetes ingress object to expose some ports including the 9001 port to be used from my Client side from internet.

When I deploy my ingress object in GKE Google, this create the loadbalancer correctly and expose all ports of my app correctly excepted the port 9001 and show me a warning like this:

'Some backend services are in UNHEALTHY state'

The service relationated with this waring is the service connected with the pod containing the MQTT Service and this is detected like UNHEALTHY. This is normal because reading the GKE Ingress documentation this service the MQTT Server not expose any endpoint from where the service could send a health probe and obtain any 200 result, it's a MQTT Server not a Web Server of course!.

So my question is how could I configure the GKE Ingress object or the service or the container MQTT Service to resolve this UNHEALTHY status and publish my 9001 WebSocket port to be used from my cliente side??.

Regards.

-- Miguel Salinas
google-kubernetes-engine
kubernetes-ingress
websocket

0 Answers