In k8s, you can make a service which represents some ports being exposed to the cluster. These can further be shown to the public via ingress. When you create a service, other pods can discover the urls and ports for those services using environment variables.

Assuming you have this service..

apiVersion: v1
kind: Service
metadata:
  name: ipfs
spec:
  selector:
    app: cloudctl
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080

you would be able to discover the IP via IPFS_SERVICE_HOST and the port via IPFS_SERVICE_PORT. Unfortunately, if you have a multi-port service, this discovery breaks. Instead, you’re required to query for and parse out SRV records. This is fine, but it leaks a little too much information about our deployment into the underlying binary.

Instead, we should be able to generate multiple services and then use those for routing.