ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Add protocol prefix to Metrics port (Helm)

Open anders-swanson opened this issue 3 years ago • 14 comments

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

Screen Shot 2022-06-02 at 7 18 21 AM

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 avatar Jun 03 '22 13:06 anders-swanson

@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.

k8s-ci-robot avatar Jun 03 '22 13:06 k8s-ci-robot

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:

k8s-ci-robot avatar Jun 03 '22 13:06 k8s-ci-robot

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.

k8s-ci-robot avatar Jun 03 '22 13:06 k8s-ci-robot

cc: @longwuyuan

anders-swanson avatar Jun 03 '22 13:06 anders-swanson

@anders-swanson thank you very much for this contribution. /ok-to-test

longwuyuan avatar Jun 03 '22 14:06 longwuyuan

/lgtm

longwuyuan avatar Jun 03 '22 14:06 longwuyuan

/assign @ChiefAlexander

anders-swanson avatar Jun 03 '22 21:06 anders-swanson

@tao12345666333 please review/approve

longwuyuan avatar Jun 04 '22 07:06 longwuyuan

Hi, @tao12345666333 any blockers to getting this PR in?

anders-swanson avatar Jun 14 '22 14:06 anders-swanson

/assign

Let me take a look

tao12345666333 avatar Jun 14 '22 14:06 tao12345666333

Hi, @tao12345666333 did you get a chance to look at this?

anders-swanson avatar Jun 28 '22 18:06 anders-swanson

@longwuyuan @tao12345666333 could you help me find a reviewer for this? Thank you!

anders-swanson avatar Jul 28 '22 14:07 anders-swanson

yes. I will finish it today

tao12345666333 avatar Jul 28 '22 14:07 tao12345666333

/lgtm /approve Thanks

rikatz avatar Aug 22 '22 23:08 rikatz

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Aug 22 '22 23:08 k8s-ci-robot

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

oprudkyi avatar Aug 25 '22 15:08 oprudkyi

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.

anders-swanson avatar Aug 25 '22 16:08 anders-swanson

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 avatar Sep 12 '22 12:09 nissessenap

@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 avatar Sep 12 '22 13:09 longwuyuan

@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.

anders-swanson avatar Sep 12 '22 14:09 anders-swanson

see: #9046

anders-swanson avatar Sep 12 '22 14:09 anders-swanson