-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consul Services Register with port instead of nodePort #299
Comments
Hi @reddog335 - I'm having some difficulty in reproducing the issue, could you provide a bit more information on the specifics of what you're seeing? I was able to use the following workflow, deploying using similar yaml to what you've provided, a Service as well as a deployment which references it and then able to reach it using the ServicePort referenced in Consul.
Inside the metadata for the service which is registered in Consul
I was then able to curl to the externalIP:servicePort from my laptop :
Is this an accurate reproduction of your environment? |
Hi @kschoche Thank you for your response and I apologize for the delayed update, I just got back from vacation. It appears the issue must be with my consul agent. I copy/pasted your deployment/service yaml and deployed it into my Kubernetes cluster. Unlike your test which correctly registered the assigned nodePort, mine registered the targetPort instead of the nodePort. curl -k https://consul-sandbox.mutualofomaha.com/v1/catalog/service/k8-consul-test | jq . Below is the yaml for my consul agent daemon set: `
updateStrategy: |
Hi @reddog335! thank you for getting back, I don't see anything obvious in your agent config, do you think you could pass along your custom values file that you used when installing via helm? If there is a misconfiguration it is likely there. |
Hi @kschoche! I've attached the values.yaml file I used when installing via helm. |
@kschoche Do you need any additional information? |
Hi @reddog335! Sorry for the delayed response, I actually have not been able to reproduce this issue yet in house but I think I just stumbled on what might be going on here after coming back to it. There are a couple syntax errors in your yaml file which appear to have let you setup a configuration which I believe shouldn't be functional. Because of the syntax errors you probably have deployed servers which allowed you to proceed in the first place, but in a weird config, without these servers you'd have noticed the consul-clients never come online. You have If I swap these back to valid syntax of I suspect if you set this up correctly you'll probably be good to go. Also as a friendly tip, with helm you only need to maintain a custom values file which contains the deltas from the default helm values, it is much easier to read and maintain in this fashion, eg :
If you're able to get up and running with this please do let me know! |
Hey @kschoche! Thank you for your response. Man, I jacked that up by the numbers. I'll try your suggestions and get back to you. Thanks for the pro-tip on helm and for all of your help! |
I'm going to close this for now but if that's not working let us know and we'll re-open. |
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:
targetPort: 80
port: 80
selector:
app: k8-consul-test
`
I originally opened a Consul Discussion Topic (https://discuss.hashicorp.com/t/consul-services-register-with-port-instead-of-nodeport/11566) and was directed to open an issue here as it appears to be a bug.
The text was updated successfully, but these errors were encountered: