Could someone explain what do the "requests" and "limits" sections below stand for? (found from https://learn.microsoft.com/en-us/training/modules/aks-application-autoscaling-native/2-concepts-scaling)
/deployment.yml
spec:
template:
spec:
containers:
- resources:
requests: <-- means what???
cpu: 250m
memory: 256M
limits: <-- means what???
cpu: 500m
memory: 512M
CodePudding user response:
Minimum is like you are informing to K8s that my app required this much amount of resources to run. So k8s make sure you app or POD gets that much when scheduling POD on Node and make sure POD has that minimum resource at least.
If the node where a Pod is running has enough of a resource available, it's possible (and allowed) for a container to use more resource than its request for that resource specifies. However, a container is not allowed to use more than its resource limit.
Limit if goes above the limit it will get killed by K8s.
The runtime prevents the container from using more than the configured resource limit. For example: when a process in the container tries to consume more than the allowed amount of memory, the system kernel terminates the process that attempted the allocation, with an out of memory (OOM) error.
If you don't specify the minimum it will copy the limit and consider it as minimum as default.