YAML for DevOps, Kubernetes, and CI

Kubernetes manifests, GitHub Actions, Helm, Compose, and YAML-powered automation workflows with practical validation commands.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Kubernetes YAML patterns

High-value YAML patterns that pull strong search traffic and repeated use.

Minimal Kubernetes Deployment

Define a basic Deployment resource in YAML.

yamlANYyamlkubernetesdeployment
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: expressyou-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: expressyou-api
  template:
    metadata:
      labels:
        app: expressyou-api
    spec:
      containers:
        - name: api
          image: us-central1-docker.pkg.dev/project/repo/api:latest
          ports:
            - containerPort: 8080
Notes

Kubernetes YAML is one of the most practical and searched YAML use cases.

Minimal GitHub Actions workflow

Define an automation workflow in YAML.

yamlANYyamlgithub-actionsci
yaml
name: CI
on: [push]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test
Notes

GitHub Actions uses YAML, making it a prime topic for a YAML cheat sheet collection.

Apply a manifest

Create or update Kubernetes resources from YAML.

bashANYyamlkubectlapply
bash
kubectl apply -f deployment.yaml
Notes

One of the most frequently used YAML-related commands in real workflows.

Preview resource changes

Show what would change before applying a manifest.

bashANYyamlkubectldiff
bash
kubectl diff -f deployment.yaml
Notes

Useful in review and CI pipelines before a real apply.

Validation and rendering

Commands that prevent broken YAML from reaching production systems.

Inspect Kubernetes manifest fields

Read documentation for manifest fields from the terminal.

bashANYyamlkubectlexplain
bash
kubectl explain deployment.spec.template.spec.containers
Notes

Useful when writing or troubleshooting nested YAML in Kubernetes resources.

Lint a Helm chart

Validate templated YAML before rendering or deploy.

bashANYyamlhelmlint
bash
helm lint ./chart
Notes

Helm lint catches a mix of chart structure and rendered-template issues.

Render a composed YAML config

Validate and resolve a Compose file.

bashANYyamldocker-composevalidation
bash
docker compose config
Notes

Great for confirming environment interpolation and final resolved service config.

Lint YAML-based Ansible playbooks

Catch common style and correctness issues in playbooks.

bashANYyamlansiblelint
bash
ansible-lint playbook.yml
Notes

Another high-value YAML workflow because Ansible configs are YAML-based.

Recommended next

No recommendations yet.