zegl / kube-score

Kubernetes object analysis with recommendations for improved reliability and security. kube-score actively prevents downtime and bugs in your Kubernetes YAML and Charts. Static code analysis for Kubernetes.

Home Page:https://kube-score.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check "deployment-replicas" should consider minReplicas in HPA configuration

ManuelGerding opened this issue · comments

Which version of kube-score are you using?

kube-score version: v1.17.0

What did you do?

I validated the replicas of a deployment that is targeted by a service and an HPA.
However, the minReplicas of the HPA is set to 1. This is, according to kubernetes.io docs, also the default value.

What did you expect to see?

The deployment-replicas check (score/deployment/deployment.go#L54 ) should have warned me about a single replica. In my opinion, when having an HPA, a replica of 1 isn't considered reliable either.

What did you see instead?

The deployment-replicas check (score/deployment/deployment.go#L54 ) didn't warn about single replica. Looking at the source code, it explicitly mentions marking deployments targeted by an HPA as good. However, what's missing is the part to check the HPA's configuration and the configured minReplicas to really ensure having at least two replicas.

Happy to hear some more thoughts on this!

Does someone have an opinion on this?
I just want to ensure that filing a pull request eventually has a chance of success as it is aligned with Kube-score's community.

Hey @ManuelGerding, I 100% agree with this issue! A HPA with minReplicas: 1 should be treated the same as if the Deployment had replicas: 1.