Back to Checks
kubernetes

Regular pod containers have readiness probes configured

core_readiness_probe_configured
Service: coreSeverity: medium
OfficialBuilt-inVerified
Categories:resilience
Resource Type:KubernetesPod

Ensure each regular pod container has a readiness probe configured to signal when it is ready to serve traffic.

Risk

Without readiness probes, services may receive traffic before containers are ready, causing errors.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler kubernetes --checks core_readiness_probe_configured

Recommendation

Add readiness probes to prevent routing traffic to unready containers.

Remediation

CLI

kubectl patch deployment/<name> -n <namespace> --type='json' -p='[{"op":"add","path":"/spec/template/spec/containers/0/readinessProbe","value":{"httpGet":{"path":"/ready","port":8080},"initialDelaySeconds":5,"periodSeconds":5}}]'

NativeIaC

# Example readiness probe
readinessProbe:
  httpGet:
    path: /ready
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 5

Other

1Add a `readinessProbe` to the container spec in Deployments/Pods.
2Ensure the probe accurately reflects service readiness.

Check Code

from prowler.lib.check.models import Check, Check_Report_Kubernetes
from prowler.providers.kubernetes.services.core.core_client import core_client


class core_readiness_probe_configured(Check):
    """Check whether regular pod containers have readiness probes configured."""

    def execute(self) -> list[Check_Report_Kubernetes]:
        """Execute the Kubernetes pod readiness probe check.

        Returns:
            List of check reports for Kubernetes pods.
        """
        findings = []
        for pod in core_client.pods.values():
            report = Check_Report_Kubernetes(metadata=self.metadata(), resource=pod)
            report.status = "PASS"
            report.status_extended = f"Pod {pod.name} has readiness probes configured for all regular containers."

            for container in (pod.containers or {}).values():
                if not container.readiness_probe:
                    report.status = "FAIL"
                    report.status_extended = f"Pod {pod.name} container {container.name} does not have a readiness probe configured."
                    break

            findings.append(report)

        return findings