Table of Contents

YAML Structure in Kubernetes

Kubernetes uses YAML files to describe what you want the cluster to create.

Instead of writing code, you declare the desired state.

Basic structure

Every Kubernetes YAML usually has 4 main parts:

Simple example

apiVersion: v1

kind: Pod

metadata: name: my-pod

spec: containers: - name: nginx image: nginx

Key idea

YAML is NOT procedural. It is declarative: