DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Kubernetes Tutorial

Introduction to Kubernetes
Kubernetes Architecture
Installing Kubernetes
kubectl Basics
Kubernetes Pods
Kubernetes Deployments
Kubernetes Services
ConfigMaps and Secrets
Kubernetes Storage
Kubernetes Namespaces
Kubernetes Resource Management
Helm for Kubernetes
Kubernetes Monitoring

Kubernetes Pod Manifest

PreviousPrev
Next

Learn the anatomy of Pod YAML and understand the purpose of apiVersion, kind, metadata, labels, annotations, and the spec section.

Why Learn Pod YAML?

Even if you mostly use Deployments later, pod manifests teach the core structure shared by many Kubernetes resources.

Full Pod YAML Anatomy

apiVersion: v1
kind: Pod
metadata:
  name: demo-pod
  labels:
    app: demo
    tier: frontend
  annotations:
    owner: platform-team
spec:
  containers:
    - name: web
      image: nginx:1.27
      ports:
        - containerPort: 80
      resources:
        requests:
          cpu: "100m"
          memory: "128Mi"
        limits:
          cpu: "500m"
          memory: "256Mi"

Understanding Each Top-Level Field

apiVersion

Tells Kubernetes which API version this resource uses.

kind

Defines the resource type, such as Pod, Service, or Deployment.

metadata

Stores identifying information like name, labels, and annotations.

spec

Describes the desired state of the resource.

Labels vs Annotations

FieldBest for
LabelsSelection and grouping
AnnotationsExtra metadata for humans or tools

Labels are queryable and often used by Services and Deployments. Annotations are not usually used for selectors.

The containers Array

A pod can run one or more containers, so containers is a list.

Common container fields include:

  • name
  • image
  • ports
  • env
  • resources
  • volumeMounts

Apply the Pod Manifest

kubectl apply -f pod.yaml

View the Live Pod YAML

kubectl get pod demo-pod -o yaml

That command is helpful because it shows defaults and status fields added by Kubernetes.

Why This Structure Repeats Everywhere

Many Kubernetes objects follow the same shape: metadata plus spec. Once you understand pod YAML, other resource types feel much more approachable.

Think of Kubernetes manifests like legal forms with a familiar layout. The exact fields vary, but the structure stays recognizable.

Exercise

Manifest Purpose

What is the main job of the `spec` field in a Pod manifest?

Exercise

Labels vs Annotations

Which statement is true about labels?

PreviousPrev
Next

Continue Learning

kubectl exec, logs, and port-forward

Debug running containers, stream logs, inspect previous crashes, and forward local ports into the cluster.

18 min·Easy

kubectl contexts and namespaces

Understand kubeconfig structure, switch safely between clusters, and scope kubectl commands with namespaces.

18 min·Easy

Kubernetes Pods

Understand what a Pod is, why Kubernetes schedules pods instead of raw containers, and how containers share networking and storage inside a pod.

16 min·Easy

Explore Related Topics

Do

Docker Tutorials

Build the containers Kubernetes orchestrates

Te

Terraform Tutorials

Provision Kubernetes clusters as code

Try the Tool

YAML Validator

Validate Kubernetes manifests and any YAML files instantly.

On This Page

Why Learn Pod YAML?Full Pod YAML AnatomyUnderstanding Each Top-Level Field`apiVersion``kind``metadata``spec`Labels vs AnnotationsThe `containers` ArrayApply the Pod ManifestView the Live Pod YAMLWhy This Structure Repeats Everywhere