apiVersion: v1 kind: ConfigMap metadata: name: tcp-services namespace: ingress-nginx data: "5432": "database/postgres:5432" # ─── Manual one-time steps after applying this ConfigMap ───────────────────── # # 1. Expose port 5432 on the ingress-nginx-controller Service: # # kubectl patch svc ingress-nginx-controller -n ingress-nginx \ # --type='json' \ # -p='[{"op":"add","path":"/spec/ports/-","value":{"name":"postgres","port":5432,"targetPort":5432,"protocol":"TCP"}}]' # # 2. Add --tcp-services-configmap arg to the ingress-nginx-controller Deployment: # # kubectl patch deployment ingress-nginx-controller -n ingress-nginx \ # --type='json' \ # -p='[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--tcp-services-configmap=ingress-nginx/tcp-services"}]' # # 3. Add to /etc/hosts on your host machine: # # 192.168.49.2 postgres.local # # ─────────────────────────────────────────────────────────────────────────────