Setting Default CPU/Memory Requests For A Namespace
Today, I ran into the problem of trying to enforce a minimum amount of resources requested for a Kubernetes namespace.
We have a namespace that developers deploy all of our microservices. Not all of the deployments have a minimum CPU/memory set.
One way you can do this is to use a LimitRange.
It looks like this:
apiVersion: v1
kind: LimitRange
metadata:
name: mem-limit-range
namespace: <your namespace here>
spec:
limits:
- default:
memory: 512Mi
defaultRequest:
memory: 256Mi
type: Container
If you’re an operator of a Kubernetes cluster, consider using LimitRanges to reduce the effects of noisy neighbors on your cluster.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.