1.7 KiB · text History a0ebd53
# Three services with distinct roles:
#
#   ircd-headless — used by libcluster (Cluster.Strategy.Kubernetes) to
#                   discover peer pods. Headless = no clusterIP, returns
#                   pod IPs from DNS.
#
#   ircd-web      — internal ClusterIP fronting the Phoenix HTTP endpoint.
#                   The Ingress (60-ingress.yaml) targets this.
#
#   ircd-irc      — external LoadBalancer exposing the IRC ports (6667
#                   plain + 6697 TLS). Adjust `type:` to NodePort or
#                   ClusterIP+ingress-nginx TCP services if you prefer.
apiVersion: v1
kind: Service
metadata:
  name: ircd-headless
  namespace: ircd
  # Labels here propagate to the Endpoints object. libcluster's K8s
  # strategy filters endpoints by labelSelector (not by service name),
  # so without `app: ircd` here the Endpoints have no matching label
  # and discovery silently returns zero peers.
  labels:
    app: ircd
spec:
  clusterIP: None
  publishNotReadyAddresses: true
  selector:
    app: ircd
  ports:
    - { name: epmd, port: 4369, targetPort: 4369 }
    - { name: dist, port: 9100, targetPort: 9100 }
---
apiVersion: v1
kind: Service
metadata:
  name: ircd-web
  namespace: ircd
spec:
  selector:
    app: ircd
  ports:
    - { name: http, port: 80, targetPort: 4000 }
---
apiVersion: v1
kind: Service
metadata:
  name: ircd-irc
  namespace: ircd
spec:
  type: LoadBalancer
  selector:
    app: ircd
  ports:
    - { name: irc,  port: 6667, targetPort: 6667 }
    - { name: ircs, port: 6697, targetPort: 6697 }
  # If your load balancer supports it, prefer Local so client IPs are
  # preserved end-to-end (important for ban masks).
  externalTrafficPolicy: Local