ingress-nginx
ingress-nginx copied to clipboard
Add protocol prefix to Metrics port (Helm)
What this PR does / why we need it:
Kiali/Istio uses protocol prefixed ports for discovering service mesh metrics. The port for the controller metrics service was missing the necessary port prefix.
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation only
Which issue/s this PR fixes
fixes #8660
How Has This Been Tested?
Deployed Kiali, Istio, and ingress-controller (using helm chart), ingress-controller was installed within the Istio mesh. Checking Kiali UI, the service now shows as green instead of red.
Metrics Service Describe
Name: ingress-controller-ingress-nginx-controller-metrics
Namespace: ingress-nginx
Labels: app.kubernetes.io/component=controller
app.kubernetes.io/instance=ingress-controller
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=ingress-nginx
app.kubernetes.io/part-of=ingress-nginx
app.kubernetes.io/version=1.2.1
helm.sh/chart=ingress-nginx-4.1.3
Annotations: meta.helm.sh/release-name: ingress-controller
meta.helm.sh/release-namespace: ingress-nginx
Selector: app.kubernetes.io/component=controller,app.kubernetes.io/instance=ingress-controller,app.kubernetes.io/name=ingress-nginx
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.96.244.30
IPs: 10.96.244.30
Port: http-metrics 10254/TCP
TargetPort: http-metrics/TCP
Endpoints: 10.244.0.118:10254
Session Affinity: None
Events: <none>
Ports of controller deployment
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
- containerPort: 10254
name: http-metrics
protocol: TCP
Kiali UI showing metrics service

Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I've read the CONTRIBUTION guide
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
@anders-swanson: This issue is currently awaiting triage.
If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Welcome @anders-swanson!
It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes/ingress-nginx has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @anders-swanson. Thanks for your PR.
I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
cc: @longwuyuan
@anders-swanson thank you very much for this contribution. /ok-to-test
/lgtm
/assign @ChiefAlexander
@tao12345666333 please review/approve
Hi, @tao12345666333 any blockers to getting this PR in?
/assign
Let me take a look
Hi, @tao12345666333 did you get a chance to look at this?
@longwuyuan @tao12345666333 could you help me find a reviewer for this? Thank you!
yes. I will finish it today
/lgtm /approve Thanks
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: anders-swanson, longwuyuan, rikatz
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~charts/ingress-nginx/OWNERS~~ [rikatz]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
When used gke managed prometheus PodMonitoring (monitoring.googleapis.com/v1alpha1) then this is breaking change, as it uses port name to collect data from pods ideally would be mention it in release notes
When used gke managed prometheus PodMonitoring (monitoring.googleapis.com/v1alpha1) then this is breaking change, as it uses port name to collect data from pods ideally would be mention it in release notes
GKE requires metrics port to always be named metrics? If that is the case we probably need to parameterize the metrics port name. Istio/Kiali requires the port to be prefixed with the protocol, so they seem to be conflicting.
This is defiantly a breaking change. There are multiple integrations that is dependent on this setting and changing forces an change of those settings. For example all of us that monitoring ingress-nginx have to update our servicemonitor/datadog or how ever we are getting this data.
I think this should be reverted and created as a variable instead with metric as the default value.
This way you can overwrite the name for your use case and the rest of the world don't have to update our monitoring settings.
@NissesSenap , after reading your comment, I realized that all places where the portname is expected to be the old one will break.
Would it be possible for you to submit a PR to change the name back to the old one.
@anders-swanson , is it possible to find a way to make the portname change optional.
@longwuyuan I can submit a PR to parameterize the port names. That should allow users to configure the port names depending on their environment. In the meantime I will revert this change, since it has the side effect of breaking an existing use case.
see: #9046