Skip to main content

KA-B006: Missing namespace

Info Best Practice

Why This Matters

The resource does not specify a namespace in its metadata. When no namespace is specified, the resource will be deployed to whatever namespace is active in the kubectl context (usually default). Explicitly setting a namespace makes manifests self-contained and prevents accidental deployment to the wrong namespace.

How to Fix

Add an explicit namespace to the resource metadata

Before (incorrect)

metadata:
  name: my-app

After (correct)

metadata:
  name: my-app
  namespace: production

Rule Details

Rule Code
KA-B006
Severity
Info
Category
Best Practice

Related Rules