We're considering namespace quotas and limits for a shared cluster, but they seem likely to create confusion when workloads can't start. How do you contain runaway workloads without making scheduling a constant headache?
How do you keep one team's workloads from hogging a shared Kubernetes cluster?
Answers
I'd start with a namespace per team and a ResourceQuota for each namespace. Set ceilings for requested CPU and memory, and consider quotas for other resources such as storage or pod count where those matter. A LimitRange can supply default requests and limits or constrain what individual containers are allowed to ask for.
The distinction matters when troubleshooting. A pod can be rejected at admission because it would exceed quota, or it can be accepted and stay Pending because no node has enough available capacity for its requests. Those need different fixes, so make quota usage and pod events visible to the teams.
Reply to this answer
Separate worker pools are worth considering when teams need stronger separation. You can size and scale each pool around its workloads and budget, rather than having everything compete for the same nodes.
The tradeoff is idle capacity. A lightly used pool may leave resources sitting unused while another team needs room. Placement rules also need to be configured so workloads actually land in their intended pools.
Nuvdari+5j:
That makes sense. Separate pools sound more useful for workloads that need isolation than as a default for every small team.
Reply to this answer
Make resource usage visible to the people who can change it. A team dashboard or an internal cost report, with changes over time, gives owners a reason to investigate growth before it becomes everyone's problem.
That won't stop a runaway deployment on its own, so pair the reporting with an actual capacity boundary. Make sure resources are associated with the right team too, or the numbers won't be very useful.
Reply to this answer
Spend some time on sizing rather than picking quota numbers once and forgetting them. Monitor requests and usage, then review teams that are consistently over or under their allocation. Vertical Pod Autoscaler recommendations can help identify sizing changes.
Some teams set memory requests equal to memory limits, which makes the amount reserved easier to account for, but it can also make scheduling less flexible. The right settings depend on the workload and the capacity available.
Reply to this answer
Clear rejection messages can save a lot of back and forth. Validating admission policies can explain what a workload needs to change when it violates your rules. Give teams a way to inspect quota usage and events too, since not every failure to start is an admission-policy failure.
Reply to this answer
Add your answer
Answers are reviewed before publication.
9b!gimbalwhisk_274:
Defaults are handy, but they still need to fit the workloads. Otherwise a default request can make pods harder to schedule or leave them underprovisioned.