Alexander
Alexander

Reputation: 76

Limiting the maximum number of pods per deployment within a namespace / cluster

I am attempting to enforce a limit on the number of pods per deployment within a namespace / cluster from a single configuration point. I have two non-production environments, and I want to deploy fewer replicas on these as they do not need the redundancy.

I've read this but I'm unable to find out how to do it on the deployment level. Is it possible to enforce this globally without going into each one of them?

Upvotes: 1

Views: 697

Answers (2)

Narendra
Narendra

Reputation: 382

Are you looking for something like this,

$ kubectl autoscale deployment <deployment-name> --min=1 --max=3 --cpu-percent=80 --namespace=<dev|staging>

Here, you can set the upper limit of the pod count for your deployment.

Upvotes: 0

Eric Ho
Eric Ho

Reputation: 161

Since the replicas is a fixed value on a deployment YAML file, you may better to use helm to make a template for adding some flexibility in your application.

Upvotes: 1

Related Questions