Posts

Showing posts from October, 2022

Kubernetes Horizontal Pod AutoScaling - HPA

Image
  In Kubernetes, a HorizontalPodAutoscaler automatically updates a workload resource (such as a Deployment or StatefulSet), with the aim of automatically scaling the workload to match demand. Horizontal scaling means that the response to increased load is to deploy more Pods.  Horizontal pod autoscaling does not apply to objects that can't be scaled (for example: a DaemonSet.) From the most basic perspective, the HorizontalPodAutoscaler controller operates on the ratio between desired metric value and current metric value: desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )] For example, if the current metric value is 200m, and the desired value is 100m, the number of replicas will be doubled, since 200.0 / 100.0 == 2.0  If the current value is instead 50m, you'll halve the number of replicas, since 50.0 / 100.0 == 0.5.  The control plane skips any scaling action if the ratio is sufficiently close to 1.0 (within a globally-configurabl...

Kubernetes Namespace Quota

Image
  ResourceQuota is an object in Kubernetes that enables administrators to restrict cluster tenants' resource usage per namespace. Creating a resource quota with HARD cpu, memory,pods and service limit under the namespace "operations". root@master-node:/kubernetes# kubectl create quota operations-quota --hard=cpu=1,memory=1G,pods=2,services=3 resourcequota/operations-quota created root@master-node:/kubernetes# kubectl get quota NAME               AGE   REQUEST                                            LIMIT operations-quota   5s    cpu: 0/1, memory: 0/1G, pods: 0/2, services: 0/3 root@master-node:/kubernetes# root@master-node:/kubernetes# kubectl describe quota operations-quota Name:       operations-quota Namespace:  operations Resource    Used  Hard -------- ...