[Kubernetes] Resources

You can configure how the Kubernetes cluster makes use of resources (such as CPU an Memory) for each pods.


Container Resource Requirements

In a pod spec, you can specify the resources requirements of a container, which are defined in terms of resource requests and limits.

  • Container Memory and CPU requirements
spec:
  containers:
  - name: myapp-container
    image: busybox
    resources:
      requests:
        memory: "64Mi"
        cpu: "250m"
      limits:
        memory: "128Mi"
        cpu: "500m"

Resource Quotas

  • A resource quota provides constraints that limit aggregate resource consumption per namespace.
kubectl create quota myrq  
  --hard=cpu=1,memory=1G,pods=2 
apiVersion: v1
kind: ResourceQuota
metadata:
  name: myrq
spec:
  hard:
    cpu: "1"
    memory: 1G
    pods: "2"
kubectl get quota
kubectl describe quota myrq

Default Resources for a Namespace

You can configure default CPU and memory requests and limits for a namespace.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s