Skip to main content


Enabled in recommended preset.
Disabled when components are given in CLI.

Disallow replicas field when a resource has a HPA.

This rule ensures that the spec.replicas field is not defined in a Deployment, StatefulSet, or any resources that can be scaled by HPA, when an associated HPA is defined.

If spec.replicas is defined, whenever a resource is updated, Kubernetes will scale the resource to the value defined in the manifest, instead of the value given by the HPA. You can see more details in the Kubernetes documentation.


Correct manifest for this rule:

new Deployment({
spec: {}

Incorrect manifest for this rule:

new Deployment({
spec: { replicas: 3 }



Allow scale target references that match the patterns to skip this rule.


Allow a Deployment with a specific namespace and name.

allow = [{ apiVersion = "apps/v1", kind = "Deployment", namespace = "foo", name = "bar" }]