Skip to content

devices-service.yaml

Download devices-service.yaml as it is.

deploy/kubernetes/devices-service.yaml
# The device ports, exposed by a Service of type LoadBalancer in front of
# the gateway pods. Exposure is deploy config, listeners are runtime config
# (kept in Postgres): a listener on a new port needs a port entry here too
# (`hourctl export lb k8s` prints this Service from the listeners).
# Endpoints added on an existing port, by path, need no change.
#
# Balancing: kube-proxy spreads connections over the ready pods (round
# robin in IPVS mode, random in iptables and nftables mode); any pod handles
# any request, so nothing is sticky. Health: the pods' readinessProbe
# (GET /api/ready on the admin port) takes a starting or draining pod out of
# the endpoints; the cloud load balancer checks the nodes
# (healthCheckNodePort), and with Local only nodes running a ready gateway
# pod pass.
#
# Client address: externalTrafficPolicy Local delivers each connection to
# a pod on the node it reached, without SNAT, so with a passthrough network
# balancer (GCP and Azure network load balancers, AWS NLB with instance
# targets, MetalLB) the gateway sees the clock's own address and
# trusted_proxies stays empty. A balancer that sends the PROXY protocol
# instead needs proxy_protocol = true on the listener, and that only when
# nothing else can reach the port. See the Kubernetes guide, Client addresses.
apiVersion: v1
kind: Service
metadata:
name: houradvantage-devices
labels:
app.kubernetes.io/name: houradvantage
app.kubernetes.io/component: gateway
# Cloud-specific settings go here, for example an internal balancer:
# service.beta.kubernetes.io/aws-load-balancer-scheme: internal
# networking.gke.io/load-balancer-type: Internal
# service.beta.kubernetes.io/azure-load-balancer-internal: "true"
# annotations: {}
spec:
type: LoadBalancer
externalTrafficPolicy: Local
selector:
app.kubernetes.io/name: houradvantage
app.kubernetes.io/component: gateway
ports:
# The HTTP listener of houradvantage-setup.toml. One entry per device port.
# No MQTT port: MQTT listeners connect out to their broker.
- { name: http-8080, protocol: TCP, port: 8080, targetPort: 8080 }