Skip to content

Feat: Enhance health checks coverage for initContainers #1120

Open
@qveensi

Description

@qveensi

Is your feature request related to a problem? Please describe.
Currently, Polaris's built-in health check rules (e.g., livenessProbeMissing, readinessProbeMissing) do not explicitly cover initContainers. This gap in coverage means that it's possible for initContainers to be deployed without proper liveness or readiness probes, which can lead to:

  • Hanging initialization processes: An initContainer might get stuck without a liveness probe, preventing the main application container from ever starting.
  • False positives/negatives in readiness: Without a readiness probe, an initContainer might signal completion before it's truly ready, or conversely, might block the Pod from becoming ready even if it's finished its work.
  • Difficult debugging: Troubleshooting issues with initContainers becomes harder without clear health signals.

Describe the solution you'd like
I would like to propose an enhancement to Polaris to include built-in checks for livenessProbe and readinessProbe specifically for initContainers. This would align Polaris with best practices for robust Kubernetes deployments.

Ideally, these checks would:

  • Verify the presence of a livenessProbe for initContainers.
  • Verify the presence of a readinessProbe for initContainers.

Describe alternatives you've considered
We have implemented these checks as custom checks within our Polaris configuration:

customInitContainerLivenessProbeMissing:
  successMessage: InitContainer has livenessProbe defined
  failureMessage: InitContainer is missing livenessProbe
  category: Reliability
  target: Container
  containers:
    include:
    - initContainer
  schema:
    '$schema': http://json-schema.org/draft-07/schema
    type: object
    required:
      - livenessProbe
    properties:
      livenessProbe:
        type: object
        not:
          const: null
customInitContainerReadinessProbeMissing:
  successMessage: InitContainer has readinessProbe defined
  failureMessage: InitContainer is missing readinessProbe
  category: Reliability
  target: Container
  containers:
    include:
    - initContainer
  schema:
    '$schema': http://json-schema.org/draft-07/schema
    type: object
    required:
      - readinessProbe
    properties:
      readinessProbe:
        type: object
        not:
          const: null

While this works, integrating it as a built-in check would benefit all Polaris users and ensure consistent best practices without requiring manual custom rule definitions.

Additional context
InitContainers play a crucial role in preparing Pods. Ensuring their health and readiness is as important as for main application containers to guarantee reliable application startup and operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdding additional functionality or improvementstriageThis bug needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions