Kubernetes YAML Cheat Sheet/Multiple resources in one YAML file

Separate resources with `---`.

Section: Manifest Basics

Multiple resources in one YAML file

yaml
yaml
apiVersion: v1
kind: Namespace
metadata:
  name: demo

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
  namespace: demo
data:
  APP_ENV: production
Explanation

Grouping related objects into one manifest is convenient for app-level deployment and review.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Manifest Basics
Minimal Pod manifest
Smallest practical Pod YAML shape.
OpenIn sheetyamlsame section
Apply YAML file
Create or update resources from a YAML file.
OpenIn sheetbashsame section
Apply YAML directory
Apply all manifests in a directory.
OpenIn sheetbashsame section
Preview manifest changes
See what apply would change.
OpenIn sheetbashsame section
Labels and annotations example
Common metadata block for selectors and tooling.
Override container command and args
Set entrypoint-style command in YAML.