Hi all. We are migrating from Swarm orchestration to Kubernetes orchestration and I’m having a heck of a time getting Consul Service registration sorted out. We have an external Consul cluster and I’ve successfully deployed the Consul agents and the consul-k8s Catalog sync. My new service successfully registers to the Consul cluster; however, it always registers with the port/targetPort instead of the nodePort. We do no want to get into the business of managing static ports so we do not specify a port in our Kubernetes service manifest and let the cluster assign a free port to nodePort. I need to force it to register with the nodePort that gets assigned by the K8 cluster. Anyone have any ideas on how to force a service to register with nodePort instead of port?
apiVersion: v1 kind: Service metadata: name: k8-consul-test namespace: vcs-lab annotations: "consul.hashicorp.com/service-name": k8-consul-test "consul.hashicorp.com/service-port": spec.ports.nodePort "consul.hashicorp.com/service-sync": "true" spec: type: NodePort ports: - nodePort: targetPort: 80 port: 80 selector: app: k8-consul-test