codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › Health probes and resource limits

Health probes and resource limits

Make apps reliable and fair.

A readiness probe tells Kubernetes when a container can receive traffic. A liveness probe restarts a container that is stuck. requests reserve CPU and memory for scheduling, and limits cap what a container may use.

Example code

apiVersion: v1
kind: Pod
metadata:
  name: probe-demo
spec:
  containers:
    - name: web
      image: nginx:1.27
      readinessProbe:
        httpGet:
          path: /
          port: 80
      livenessProbe:
        httpGet:
          path: /
          port: 80
        initialDelaySeconds: 10
      resources:
        requests:
          cpu: 100m
          memory: 64Mi
        limits:
          cpu: 250m
          memory: 128Mi

Run this code in the online editor

← IngressJobs and CronJobs →