_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Kubernetes Pod Lifecycle

11. 12. 2019 1 min read intermediate

Cloud Intermediate

Kubernetes Pod Lifecycle

KubernetesPodLifecycle 3 min read

Pod lifecycle in Kubernetes. Phases, init containers, probes, and graceful shutdown.

Pod Phases

  • Pending — scheduling, image pull
  • Running — at least one container is running
  • Succeeded — all containers completed successfully
  • Failed — at least one container failed
  • Unknown — state cannot be determined

Probes

spec:
  containers:
    - name: app
      livenessProbe:    # Is the container alive?
        httpGet: {path: /healthz, port: 8080}
        initialDelaySeconds: 15
        periodSeconds: 10
      readinessProbe:   # Is it ready to accept traffic?
        httpGet: {path: /ready, port: 8080}
        initialDelaySeconds: 5
      startupProbe:     # For slow startup
        httpGet: {path: /healthz, port: 8080}
        failureThreshold: 30
        periodSeconds: 10

Graceful Shutdown

Kubernetes sends SIGTERM, waits terminationGracePeriodSeconds (default 30s), then SIGKILL.

process.on('SIGTERM', async () => {
    console.log('Shutting down...');
    server.close();
    await db.disconnect();
    process.exit(0);
});

Summary

Proper probes and graceful shutdown = zero-downtime deployment. Always configure a readiness probe.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.