Hello All,
I made a mistake during registration of my service and it looks like stf_app:http://something.abc.com:3100/ now
I need to remove it, but neither consul services deregister, nor API, nor ansible consul module (which was used for registration) do not work:
consul services deregister --token=123 -id=stf_app:http://something.abc.com:3100/ : Error registering service “”: Unexpected response code: 405 (method GET not allowed)
ansible playbook: msg: 500 Unknown service {“stf_app:http:/something.abc.com:3100/” {}}
curl --request PUT --data @deregister_stf.json http://127.0.0.1:8500/v1/catalog/deregister ( { "Datacenter": "dc1", "ServiceID": "stf_app", "Node": "node.abc.com" } ) : rpc error making call: Unknown service ‘stf_app’
There is some magic how Consul replaces http:// to http:/ in my case and this happens only if I put :3100/ at the end.
I’ve checked similar topics on the net, but nothing seems to be related to my case.
Does anyone have a clue how to fix this? Appreciate any help.
Could you check that the ID in the output of curl http://localhost:8500/v1/agent/service/stf_app (when queried from node.abc.com) matches the ID of the service that you’re trying to de-register?
If not, try the de-registration with the ID returned from the command. It should successfully remove the service.
Maybe anyone else has a clue.
This issue seems to be odd and I’m confused if it is something that needs to be addressed in Consul itself or a well-known case that has a workaround?
Apologies for the very delayed reply. I just wanted to share an update on this.
I believe the issue you reported will be fixed in the next release of Consul, 1.11.2. The API has been changed in that release to allow de-registration of services that have a / in the name (among other things).