Consul Services Register with port instead of nodePort

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

Hi, looking at the code it should be registering with the first-defined node port. Have you tried not using the service-port annotation?

If that’s not working then I think this is a bug and could you please then open up a github issue here: https://github.com/hashicorp/consul-k8s/issues

I removed the service-port annotation and redeployed. Same issue - it registered port 80 instead of the assigned nodePort. I will open a github issue. Thanks!