How do I make Kubernetes scale my deployment based on the "ready"/ "not ready" status of my Pods? How do I make Kubernetes scale my deployment based on the "ready"/ "not ready" status of my Pods? kubernetes kubernetes

How do I make Kubernetes scale my deployment based on the "ready"/ "not ready" status of my Pods?


I don't think this is possible. If pod is not ready, k8 will not make it ready as It is something which releated to your application.Even if it create new pod, how readiness will be guaranted. So you have to resolve the reasons behind non ready status and then k8. Only thing k8 does it keep them away from taking world load to avoid request failure


Ensuring you always have 4 pods running can be done by specifying the replicas property in your deployment definition:

apiVersion: apps/v1kind: Deploymentmetadata:  name: nginx-deployment  labels:    app: nginxspec:  replicas: 4  #here we define a requirement for 4 replicas  selector:    matchLabels:      app: nginx  template:    metadata:      labels:        app: nginx    spec:      containers:      - name: nginx        image: nginx:1.7.9        ports:        - containerPort: 80

Kubernetes will ensure that if any pods crash, replacement pods will be created so that a total of 4 are always available.


You cannot schedule deployments on unhealthy nodes in the cluster. The master api will only create pods on nodes which are healthy and meet the quota criteria to create any additional pods on the nodes which are schedulable.

Moreover, what you define is called an auto-heal concept of k8s which in basic terms will be taken care of.