Limit Range
Limit range defines the default and limit resource values for cpu and memory for a namespace.
cpu-limit-range.yaml
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-limit-range
namespace: learning
spec:
limits:
- default:
cpu: 500m
defaultRequest:
cpu: 200m
min:
cpu: 100m
max:
cpu: "1"
type: Container
We can specify same for memory also.
apiVersion: v1
kind: LimitRange
metadata:
name: memory-limit-range
namespace: learning
spec:
limits:
- default:
memory: 400Mi
defaultRequest:
memory: 200Mi
min:
memory: 100Mi
max:
memory: 1Gi
type: Container