Skip to content

Conversation

@CecileRobertMichon
Copy link
Contributor

What type of PR is this?
/kind deprecation

What this PR does / why we need it: This should have been done as part of v1alpha4 per https://cluster-api.sigs.k8s.io/developer/providers/v1alpha3-to-v1alpha4, fixing now.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1707

Special notes for your reviewer: I verified that this does not affect our telemetry in tilt.

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Remove kube-rbac-proxy

@k8s-ci-robot k8s-ci-robot added kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 24, 2021
@k8s-ci-robot k8s-ci-robot added area/provider/azure Issues or PRs related to azure provider sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. labels Sep 24, 2021
@CecileRobertMichon
Copy link
Contributor Author

/retest

1 similar comment
@CecileRobertMichon
Copy link
Contributor Author

/retest

@CecileRobertMichon
Copy link
Contributor Author

/assign @mboersma @shysank

@CecileRobertMichon
Copy link
Contributor Author

/retest

@mboersma
Copy link
Contributor

I tested this locally, and it seems to break prometheus metrics, at least as viewed locally via the "metrics" link in Tilt. Switching back to the main branch fixes it. I hope I didn't give you bad advice--I didn't think there was a dependency there...

- args:
- --leader-elect
- "--metrics-bind-addr=127.0.0.1:8080"
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},AKS=${EXP_AKS:=false}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just fyi: In CAPI we kept that one (but with localhost:8080) so we can replace it in our e2e test (https://github.com/kubernetes-sigs/cluster-api/blob/89df9472d1678ed8ff59f4e124d48ad51ffd85c6/test/e2e/config/docker.yaml#L53-L54) and the e2e test framework is able to retrieve the metrics via proxy (https://github.com/kubernetes-sigs/cluster-api/blob/c55b5013fcb84841cc3705dfb250cdfd8b140447/test/framework/deployment_helpers.go#L200-L206)

Not sure if that's also relevant for CAPZ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added back with localhost

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbueringer
Copy link
Member

I tested this locally, and it seems to break prometheus metrics, at least as viewed locally via the "metrics" link in Tilt. Switching back to the main branch fixes it. I hope I didn't give you bad advice--I didn't think there was a dependency there...

Sounds like what I described here: #1707 (comment)

@CecileRobertMichon
Copy link
Contributor Author

I tested this locally, and it seems to break prometheus metrics, at least as viewed locally via the "metrics" link in Tilt. Switching back to the main branch fixes it. I hope I didn't give you bad advice--I didn't think there was a dependency there...

I'm surprised that is the case, we already have a patch for adding the metrid-bind-addr arg to the CAPZ manager: https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/hack/observability/opentelemetry/controller-manager-patch.yaml#L12 and that's what we use in tilt:

https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/main/Tiltfile#L154

Will test again and report back.

- name: manager
args:
- "--metrics-bind-addr=127.0.0.1:8080"
- "--metrics-bind-addr=:8080"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mboersma @sbueringer this fixes Prometheus metrics in tilt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that the ServiceMonitor still points to the https (8443) port.

One solution would be to adjust the auth_proxy_service.yaml (8443=>8080, scheme:https => scheme:http, port https => metrics (and also add the corresponding metrics port (8080) to the deployment)

@CecileRobertMichon
Copy link
Contributor Author

/retest

@CecileRobertMichon
Copy link
Contributor Author

/hold

@mboersma reported that metrics are still not getting collected

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2021
@CecileRobertMichon
Copy link
Contributor Author

@devigned @mboersma @sbueringer I think this time I fixed it for real... I realized from our testing earlier that I hadn't re-added the auth_proxy_service.yaml to kustomization.yaml so the changes I made in there had no impact 🤦‍♀️

kind: Service
metadata:
annotations:
prometheus.io/scrape: "true"
Copy link
Member

@sbueringer sbueringer Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this service only works in combination with the controller-manager-patch.yaml from the observability folder.

I think it would be good to either:

  • move the file to the observability folder
  • make it functional by changing the bind addr in config/manager/manager.yaml (As mentioned: that's something which was rejected for security reasons in the main repo, but I'll stay out of this discussion :))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbueringer thank you so much for your insights!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome

@mboersma
Copy link
Contributor

I can confirm metrics are flowing again in Tilt.

I like @sbueringer's suggestion of moving auth_proxy_service.yaml into the hack/observability folder, to make it more clear that the metrics aren't intended for use in production.

@devigned
Copy link
Contributor

/assign

With @CecileRobertMichon out of office, I'll make the changes and update the PR.

@devigned
Copy link
Contributor

@mboersma please give this a look when you have a minute. I've updated the PR by moving the service exposure to the observability folder.

@mboersma
Copy link
Contributor

/retest
(failed AKS cluster creation)

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

I tested this locally and prometheus was seeing metrics.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2021
@sbueringer
Copy link
Member

One nit: I don't think you need auth_proxy_client_clusterrole.yaml anymore. It was only required to make it possible to scrape metrics through the kube-rbac-proxy.

@devigned
Copy link
Contributor

One nit: I don't think you need auth_proxy_client_clusterrole.yaml anymore. It was only required to make it possible to scrape metrics through the kube-rbac-proxy.

I was thinking that. I could probably rip out some of the prom config, like the service account token, etc.

@sbueringer
Copy link
Member

One nit: I don't think you need auth_proxy_client_clusterrole.yaml anymore. It was only required to make it possible to scrape metrics through the kube-rbac-proxy.

I was thinking that. I could probably rip out some of the prom config, like the service account token, etc.

Yes, sgtm

@devigned devigned force-pushed the remove-kube-rbac-proxy branch from 9c069a0 to eb881cd Compare September 30, 2021 18:54
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 30, 2021
@devigned
Copy link
Contributor

@mboersma I've ripped out some of the prom auth config and slimmed down the PR to only the required resources. If you could give this a quick check, I'd appreciate it.

@mboersma
Copy link
Contributor

/lgtm

I retested, and prometheus looks good.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 30, 2021
@devigned
Copy link
Contributor

Thank you, @mboersma!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: devigned

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 30, 2021
@sbueringer
Copy link
Member

/lgtm

@devigned
Copy link
Contributor

devigned commented Oct 1, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 1, 2021
@k8s-ci-robot k8s-ci-robot merged commit 62a3b4f into kubernetes-sigs:main Oct 1, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.5 milestone Oct 1, 2021
@mboersma mboersma mentioned this pull request Oct 1, 2021
3 tasks
@CecileRobertMichon
Copy link
Contributor Author

thanks for carrying this to the finish line @devigned!

@CecileRobertMichon CecileRobertMichon deleted the remove-kube-rbac-proxy branch February 17, 2023 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove kube-rbac-proxy

6 participants