-
Notifications
You must be signed in to change notification settings - Fork 319
Description
I have 1.14 kubernetes version on GCE so the ingress-gce version is v1.6.0. with many services deployed. One of then is named trazelab-broker that expose the 9001 port of MQTT container throw the 80 ingress port service. I configured ingress but ingress always create a Healh check for this backen service to use HTTP port and not TCP, so the status is UNHEALTHY always and the port is closed for any communication from internet to this websocket.
If I set the correct port using the GCE UI and set the port to TCP the backen service status will convert to HEALTH after some seconds and the port is active correctly. Nevertheless some seconds later 60 seconds aprox, the status of the backend service come back again to UNHEALTHY and the port again is set to HTTP.
My questions is:
- How could I set the TCP connection for this health check asocaited to the backend service created by ingrees and not the default HTTP?
- Why if I set this port to TCP from UI later ingress or GCE set again the default type to HTTP?
These are the manifests for this service:
BackendConfig;
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
name: config-broker-ws
namespace: trazelab-mefasa
spec:
timeoutSec: 300
connectionDraining:
drainingTimeoutSec: 300
healthCheck:
type: TCP
port: 80
Deployment and Service
apiVersion: v1
kind: Service
metadata:
name: trazelab-broker
namespace: trazelab-mefasa
annotations:
beta.cloud.google.com/backend-config: '{"ports": {"80": "config-broker-ws"}}'
labels:
app: trazelab-mefasa
spec:
selector:
app: trazelab-mefasa
tier: broker
type: NodePort
ports:
- name: tcp-port
port: 1883
targetPort: 1883
protocol: TCP
- name: tcp-ws-port
port: 80
targetPort: 9001
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: trazelab-broker
namespace: trazelab-mefasa
labels:
app: trazelab-mefasa
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: trazelab-mefasa
tier: broker
template:
metadata:
labels:
app: trazelab-mefasa
tier: broker
spec:
containers:
- name: mosquitto
image: eclipse-mosquitto:latest
imagePullPolicy: Always
ports:
- containerPort: 9001
- containerPort: 1883
livenessProbe:
tcpSocket:
port: 9001
readinessProbe:
tcpSocket:
port: 9001
volumeMounts:
- name: trazelab-broker-config
mountPath: /mosquitto/config
volumes:
- name: trazelab-broker-config
configMap:
name: trazelab-broker-config
items:
- key: broker-config
path: mosquitto.conf
Ingress manifest:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: trazelab-ingress
namespace: trazelab-mefasa
labels:
app: trazelab-mefasa
spec:
rules:
- host: mefasa.trazelab.io
http:
paths:
- path: /*
backend:
serviceName: trazelab-ui
servicePort: 80
- host: api.mefasa.trazelab.io
http:
paths:
- path: /*
backend:
serviceName: trazelab-api
servicePort: 3000
- host: gateway.mefasa.trazelab.io
http:
paths:
- path: /*
backend:
serviceName: trazelab-gateway
servicePort: 1880
- host: broker-ws.mefasa.trazelab.io
http:
paths:
- path: /*
backend:
serviceName: trazelab-broker
servicePort: 80