A resource request is the amount of resources required for a container to function.
Kubernetes scheduler uses these requests to allocate resources and schedule pods on nodes that can fulfill these demands, ensuring the availability of resources.
Kubernetes uses resource requests to make informed scheduling decisions. When a pod is created, the scheduler evaluates available nodes based on the requested resources.
Resource limits have a direct effect during runtime. By setting limits, administrators can prevent a container from consuming more resources than desired.
Resource types in Kubernetes
- CPU resources
- Memory resources
- Ephemeral storage resources
- Extended and custom resources
Custom resources require additional configuration, informing Kubernetes of their inventory and scheduling needs.
Best practices for resource management in Kubernetes
- Rightsizing resource requests and limits
- Avoiding overcommitment and underutilization
- Using LimitRanges and ResourceQuotas
- Implementing Quality of Service (QoS) classes
- Leveraging Horizontal Pod Autoscaling (HPA)
Horizontal Pod Autoscaling (HPA) is a Kubernetes feature that dynamically adjusts the number of running pods based on current resource usage.
By monitoring metrics like CPU utilization, HPA helps maintain application performance levels despite changing load conditions.
This automated scaling optimizes resource usage and availability, matching application needs.
QoS Classes:
Determines scheduling priority and eviction policy based on resource requests and limits.
Guaranteed
: Requests == Limits for both CPU & memory. Highest priority.
Burstable
: Requests < Limits but set. Medium priority.
BestEffort
: No requests or limits defined. Lowest priority.
Node Affinity & Pod Affinity/Anti-Affinity
: Define where workloads should run.
Taints & Tolerations
: Prevent scheduling certain workloads on specific nodes.
HPA
: Adjusts pod replicas based on CPU/memory usage.
VPA
: Dynamically modifies container resource requests based on real-time needs.
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.