QoS classes in Kubernetes: Guaranteed, Burstable, BestEffort
sobes.tech AI
Answer from AI
In Kubernetes, QoS (Quality of Service) classes define the priority and resource guarantees for pods based on their resource requests and limits:
-
Guaranteed: A pod receives this class if all containers have the same
requestsandlimitsvalues for CPU and memory. Such pods have the highest priority and guaranteed resource allocation. -
Burstable: If a pod has
requestsandlimitsset, but they differ, or are not set for all resources, it belongs to this class. It receives resources within the requests but can use more up to the limit if available. -
BestEffort: If a pod does not specify
requestsorlimitsfor resources, it belongs to this class. These pods have the lowest priority and can be terminated if resources are scarce.
Example:
apiVersion: v1
kind: Pod
metadata:
name: guaranteed-pod
spec:
containers:
- name: app
image: myapp
resources:
requests:
memory: "512Mi"
cpu: "1"
limits:
memory: "512Mi"
cpu: "1"
This pod will be in the Guaranteed class.