Skip to main content

☑️ Prevent workload from using the default namespace

The namespace default is a saved namespace value in which Kubernetes is deploying all objects without an explicit namespace. Using explicit namespaces instead of the default value makes for clearer boundaries between sets of pods in a cluster. For example, namespaces that represent teams present a clear organization of cluster resources and make configuration overlaps less likely.

Targeted resources by this rule (types of kind): Deployment / Pod / DaemonSet / StatefulSet / ReplicaSet / CronJob / Job

Enabled by default? True


This rule will fail

If a workload has default set as the namespace name

namespace: default

Rule output in the CLI

$ datree test *.yaml

>> File: failExample.yaml
❌ Prevent workload from using the default namespace [1 occurrence]
💡 Incorrect value for key `namespace` - use an explicit namespace instead of the default one ("default")

How to fix this failure

namespace: test

Read more