<p>I have 2 pods running with each CPU : 0.2 Core and Mi : 1 Gi
My node has limit of 0.4 Core and 2 Gi. I can't increase the node limits.</p>
<p>For Zero downtime I have done following config -</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: abc-deployment
spec:
  selector:
    matchLabels:
      app: abc
  replicas: 2
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: abc
        collect_logs_with_filebeat: &quot;true&quot;
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: &quot;false&quot;
    spec:
      containers:
      - name: abc
        image: abc-repository:latest
        ports:
        - containerPort: 8087
        readinessProbe:
          httpGet:
            path: /healthcheck
            port: 8087
          initialDelaySeconds: 540
          timeoutSeconds: 10
          periodSeconds: 10
          failureThreshold: 20
          successThreshold: 1
        imagePullPolicy: Always
        resources:
          limits:
            cpu: 0.2
            memory: 1000Mi
          requests:
            cpu: 0.2
            memory: 1000Mi 
            
</code></pre>
<p>On a new build deployment, two new pod gets created on a new node(because node1 doestn't have enough
memory and cpu to accomodate new pods) say node2. once new container is in running state these newly created pod of node2. the old pods(running on node1)
get desroyed and now node1 have some free space and memory.</p>
<p>Now the issue which i am facing is that, Since node1 have free memory and cpu, Kubernetes is destroying the newly created pods(running on node2)
and after that create pods on node1 and starts app container on that, which is causing downtime.</p>
<p>So, Basically in my case even after using rollingupdate strategy and healthcheck point, I am not able to achieve zero downtime.</p>
<p>Please help here!</p>

<p>You could look at the concept of <a href="https://kubernetes.io/docs/tasks/run-application/configure-pdb/" rel="nofollow noreferrer">Pod Disruption Budget</a> that is used mostly for achieving zero downtime for an application.</p>
<p>You could also read a <a href="https://stackoverflow.com/questions/66227319/kubernetes-replicaset-vs-poddisruptionbudget/66227970?r=SearchResults#66227970">related answer of mine</a> which shows an example of how to achieve the zero down time for an application using the PDBs.</p>
