Distributed Services with Go: Loadbalancing the service from outside the k8s network

Distributed Services with Go (pg. 207 && pg. 228)

Looking for suggestions to allow load-balancing to work from outside the k8s network… this would allow users (outside GCP) to use a client with load balancing.

  • Today there are external-IPs generated for each node. Without loadbalancing we could use a node to query the service (pg. 228). But with load balancing, it cannot resolve the k8s dsn.
  • However, with load balancing, it cannot resolve, since, GetServers returns the k8s dns e.g. $HOSTNAME.proglog.{{.Release.Namespace}}.svc.cluster.local:{{.Values.serfPort}}

If one were to update the statefulset bind-addr

      ID=$(echo $HOSTNAME | rev | cut -d- -f1 | rev)
      cat > /var/run/proglog/config.yaml <<EOD
      data-dir: /var/run/proglog/data
      rpc-port: {{.Values.rpcPort}}
      bind-addr: \
        "$HOSTNAME.proglog.{{.Release.Namespace}}.\svc.cluster.local:\
          {{.Values.serfPort}}"  ### <-- change each to the external IP from the service
      bootstrap: $([ $ID = 0 ] && echo true || echo false)
      $([ $ID != 0 ] && echo 'start-join-addrs: \
        "proglog-0.proglog.{{.Release.Namespace}}.svc.cluster.local:\
          {{.Values.serfPort}}"') 

Would that allow for load balancing to work from outside the k8s network without forwarding?
If yes, Any suggestions for a better way to do this?

Btw, again many thanks for a great book (shortened the init learning curve from year(s) to months imo!