A resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind; for example, the built-in pods resource contains a collection of Pod objects.
Stuff you wanna know:
- When you specify a Pod, you can specify how much of each resource a container needs.
- The most common resources to specify are CPU and memory (RAM).
- When you specify the resource request for containers in a Pod, the kube-scheduler uses this information to decide which node to place the Pod on.
- 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 resourcelimit
. - CPU and memory are collectively referred to as compute resources, or resources. Compute resources are measurable quantities that can be requested, allocated, and consumed.
- API resources, such as Pods and Services are objects that can be read and modified through the Kubernetes API server.
- For a particular resource, a Pod resource request/limit is the sum of the resource requests/limits of that type for each container in the Pod.
- When the kubelet starts a container as part of a Pod, the kubelet passes that container’s requests and limits for memory and CPU to the container runtime.
- The kubelet reports the resource usage of a Pod as part of the Pod
status
.
More stuff:
- Resource management for pods and containers — https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
- Managing resources — https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/