The information contained in this article has been verified as up-to-date on the date of the original publication of the article. HashiCorp endeavors to keep this information up-to-date and correct, but it makes no representations or warranties of any kind, express or implied, about the ongoing completeness, accuracy, reliability, or suitability of the information provided.
All information contained in this article is for general information purposes only. Any reliance you place on such information as it applies to your use of your HashiCorp product is therefore strictly at your own risk.
Overview
If you encounter issues with mismatched protocols in the config entires, specifically between the Ingress Gateway and Service Defaults configurations. You can follow these steps to resolve the problem.
Issue Description
The problem arises when you attempt to modify, or delete, a service-defaults config entry while the protocol settings in the service-defaults and ingress-gateway configurations don't match.
Scenario
Here is an example scenario:
- A service named "dashboard" is registered, and its service-default protocol is set to http.
- An "ingress-gateway" is deployed with a listener explicitly defined to route traffic to the "dashboard" service using the http protocol (example below).
# An example of ingress gateway config entry for a dashboard service
Kind = "ingress-gateway"
Name = "dashboard-ingress"
Listeners = [
{
Port = 8888
Protocol = "http"
Services = [
{
Name = "dashboard"
}
]
}
]
Attempted Changes and Errors
- Changing the protocol in service-defaults to gRPC and overwriting the entry results in an error.
- Deleting the service-defaults entry leads to an error.
- Updating the protocol to gRPC in the ingress-gateway config entry and overwriting it fails with a similar error.
Example error output:
$ consul config write svc-defaults.hcl
Error writing config entry service-defaults/dashboard: Unexpected response code: 500 (service "dashboard" has protocol "grpc", which does not match defined listener protocol "http")
The issue occurs because Consul validates the listener protocol specified in the ingress-gateway configuration entry, ensuring it matches the protocol value (e.g., HTTP) in service-defaults. If these protocols do not align, you will be unable to modify or delete the service-defaults configuration, resulting in the aforementioned error message.
Solution
To successfully update and modify a config entry, you need to disassociate the service from the ingress gateway's listener before making changes by following the below steps.
- Remove the "dashboard" service from the ingress-gateway listener block.
# ingress-gw.hcl
Kind = "ingress-gateway"
Name = "dashboard-ingress"
Listeners = [
# Remove any existing listeners
] - Overwrite the ingress-gateway config entry
$ consul config write ingress-gw.hcl
- Update the protocol in the service-defaults config entry from HTTP to gRPC.
$ consul config write svc-defaults.hcl
- Now, you should be able to update config entry without encountering protocol mismatch errors. If you face any issues, feel free to reach out to our support team for further assistance.
References