YAML in 10 Minutes
YAML is JSON with less punctuation. Indentation is meaning: use spaces, never tabs.
# a map (key: value)name: demoreplicas: 3enabled: truecolor: "#4f8cff" # quote strings with special chars like # or :
# a nested mapmetadata: name: demo labels: app: demo
# a list (each item starts with "- ")ports: - containerPort: 3000 - containerPort: 9090
# a list of mapscontainers: - name: app image: demo-app:1.0
# inline (flow) style, same meaninglabels: { app: demo }args: ["--port", "3000"]
# multi-line stringscript: | echo line one echo line two---# "---" separates multiple documents in one fileEvery Kubernetes object has the same shape
Section titled “Every Kubernetes object has the same shape”apiVersion: apps/v1 # which API group/version defines this kindkind: Deployment # what type of objectmetadata: # name, namespace, labels name: demo namespace: demospec: # WHAT YOU WANT (desired state) replicas: 3status: # WHAT IS (filled in by Kubernetes, never by you) readyReplicas: 3That spec vs status split is the core idea of Kubernetes: you write spec, controllers work to make status match it.