Skip to main content

KA-B009: Liveness probe port not in container ports

Warning Best Practice

Why This Matters

The liveness probe references a port that is not declared in the container ports array. This may indicate a misconfiguration where the probe points to the wrong port or the container port declaration is missing. The probe may fail to connect, causing unnecessary restarts.

How to Fix

Ensure the liveness probe port matches a declared container port

Before (incorrect)

containers:
  - name: app
    ports:
      - containerPort: 8080
    livenessProbe:
      httpGet:
        port: 9090

After (correct)

containers:
  - name: app
    ports:
      - containerPort: 8080
    livenessProbe:
      httpGet:
        port: 8080

Rule Details

Rule Code
KA-B009
Severity
Warning
Category
Best Practice

Related Rules