Skip to main content

KA-B012: Duplicate environment variable keys

Warning Best Practice

Why This Matters

The container has duplicate environment variable names. When duplicate names exist, the later value silently overrides the earlier one. This is almost always a copy-paste error and can cause subtle runtime bugs that are difficult to diagnose.

How to Fix

Remove duplicate env var entries or rename them

Before (incorrect)

env:
  - name: DB_HOST
    value: primary.db
  - name: DB_HOST
    value: replica.db

After (correct)

env:
  - name: DB_HOST
    value: primary.db
  - name: DB_REPLICA_HOST
    value: replica.db

Rule Details

Rule Code
KA-B012
Severity
Warning
Category
Best Practice

Related Rules