Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPA non-functional due to incorrect LabelSelector #22

Closed
somerandow opened this issue Oct 5, 2020 · 0 comments · Fixed by #23
Closed

HPA non-functional due to incorrect LabelSelector #22

somerandow opened this issue Oct 5, 2020 · 0 comments · Fixed by #23

Comments

@somerandow
Copy link
Contributor

Issue

Nextcloud App pod HPA does not work

Cause

The HPA is unable to get the CPU requested/usage/limit for the application pods.
image

Why

The HPA references the nextcloud deployment. This deployment does not define a component label. Therefore, if you also deploy the nextcloud-metrics deployment, one of the following will happen:

  1. Metrics are returned for both the metrics pod and application pod, and are averaged together (if resource requests/limits defined on metrics pod)
  2. If no resource requests/limits are defined on the metrics pod, the metrics are returned, but the HPA throws an error, because while the application pod may have resources defined, the metrics pod does not, and the HPA is unable to compute and average requests/limits as a result

What happens

image

The metrics server logs do not return an error, but their debug output is helpful in highlighting the issue further. In the above, the HPAs I have deployed for nginx ingress controllers specifically call out the component label in their request. These HPAs are working without issue.

Suggested Fix

Add app.kubernetes.io/component: app to the nextcloud application deployment, and update the spec accordingly:

spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/instance: nextcloud
      app.kubernetes.io/component: app
      app.kubernetes.io/name: nextcloud
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: nextcloud
        app.kubernetes.io/name: nextcloud
        app.kubernetes.io/component: app
        nextcloud-redis-client: 'true'

I am happy to open a PR for this issue if this seems like the correct approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant