Sakshi
Sakshi

Reputation: 13

Kubernetes : How to attain 0 downtime

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.

For Zero downtime I have done following config -

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: "true"
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: "false"
    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 
            

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.

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.

So, Basically in my case even after using rollingupdate strategy and healthcheck point, I am not able to achieve zero downtime.

Please help here!

Upvotes: 1

Views: 430

Answers (1)

Krishna Chaurasia
Krishna Chaurasia

Reputation: 9600

You could look at the concept of Pod Disruption Budget that is used mostly for achieving zero downtime for an application.

You could also read a related answer of mine which shows an example of how to achieve the zero down time for an application using the PDBs.

Upvotes: 1

Related Questions