fluxcd / flagger

Progressive delivery Kubernetes operator (Canary, A/B Testing and Blue/Green deployments)
https://docs.flagger.app
Apache License 2.0
4.88k stars 729 forks source link

Flagger Linkerd Integration demo does not work with HPA #619

Open seizadi opened 4 years ago

seizadi commented 4 years ago

Due to this Linkerd issue HPA does not work with Flagger Linkerd Canary Deployments demo you will get warning events:

> k get events
...
0s          Warning   FailedGetResourceMetric        horizontalpodautoscaler/podinfo-primary   missing request for cpu
0s          Warning   FailedComputeMetricsReplicas   horizontalpodautoscaler/podinfo-primary   invalid metrics (1 invalid out of 1), first error is: failed to get cpu utilization: missing request for cpu

The hpa will also show problem:

 ❯ k get hpa                                                                                  2.6.3 ⎈ minikube/test
NAME              REFERENCE                    TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
podinfo           Deployment/podinfo           <unknown>/99%   2         4         0          2m29s
podinfo-primary   Deployment/podinfo-primary   <unknown>/99%   2         4         2          117s

The fix was to add annotation to podinfo deployment:

spec:
  template:
    metadata:
      annotations:
        config.linkerd.io/proxy-cpu-limit: "1.5"
        config.linkerd.io/proxy-cpu-request: "0.2"
        config.linkerd.io/proxy-memory-limit: 2Gi
        config.linkerd.io/proxy-memory-request: 128Mi

After deployment with annotation the HPA started to work...

❯ k get hpa                                                                                  2.6.3 ⎈ minikube/test
NAME              REFERENCE                    TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
podinfo           Deployment/podinfo           <unknown>/99%   2         4         0          2m19s
podinfo-primary   Deployment/podinfo-primary   0%/99%          2         4         2          103s
stefanprodan commented 4 years ago

Thanks for reporting this, I think only the request annotations are required as HPA doesn't look at limits.

seizadi commented 4 years ago

Yes, you are right I added those to remind me of all the fields that could be annotated.