Day 15: Automating Workflows with Kustomize and Skaffold

Welcome to Day 15 of the Zero to Platform Engineer in 30 Days challenge! 🚀 Today, we’re diving into workflow automation for Kubernetes using Kustomize and Skaffold, two tools that simplify managing and deploying Kubernetes configurations

Why Automate Kubernetes Workflows?

Automation helps you:

Simplify complex deployments.

  • Increase development speed with streamlined workflows.
  • Maintain consistent environments across teams.

🎯 Key Concepts:

  • Kustomize: Customize Kubernetes YAML configurations without modifying the original files.
  • Skaffold: Automate the build, push, and deployment process for Kubernetes applications.

What Is Kustomize?

Kustomize is a Kubernetes-native configuration tool that allows you to:

  • Overlay changes to YAML manifests.
  • Reuse and customize resources for different environments.

🎯 Use Case: Configure a single application for dev, staging, and production without duplicating YAML files.

What Is Skaffold?

Skaffold is a command-line tool that automates Kubernetes workflows, including:

  • Building container images.
  • Pushing images to registries.
  • Deploying applications to Kubernetes clusters.

🎯 Use Case: Speed up development by automating repetitive tasks.

Hands-On: Automating Workflows with Kustomize and Skaffold

Step 1: Set Up Kustomize

  1. Create a base configuration (base/deployment.yaml):
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: app
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
      - name: app
        image: nginx:1.21
  1. Create a development configuration (overlays/dev/deployment.yaml):
bases:
- ../../base

patchesStrategicMerge:
- deployment-patch.yaml
  1. Create a patch file (overlays/dev/deployment-patch.yaml):
spec:
  replicas: 1
  template:
    spec:
      containers:
      - name: app
        image: nginx:1.21-alpine
  1. Build the configuration for the dev environment:
kubectl apply -k overlays/dev

Step 2: Automate with Skaffold

  1. Install Skaffold:
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
chmod +x skaffold
sudo mv skaffold /usr/local/bin
  1. Create a skaffold.yaml file:
apiVersion: skaffold/v2beta26
kind: Config
build:
  artifacts:
  - image: app
deploy:
  kustomize:
    paths:
    - ./overlays/dev
  1. Run Skaffold
skaffold dev
  1. Skaffold will monitor changes, build new images, and redeploy automatically.

Activity for Today

  1. Set up Kustomize for a sample application with different environments.
  2. Automate your Kubernetes workflow with Skaffold.
  3. Test live changes in your application using Skaffold’s auto-deploy feature.

What’s Next?

Tomorrow, we’ll explore building a developer-friendly platform by integrating tools like Backstage for internal developer portals.

Get ready to level up your platform engineering skills! 🚀

👉 Check it out here: Zero to Platform Engineer Repository

Feel free to clone the repo, experiment with the code, and even contribute if you’d like! 🚀

Follow the Series!

🎉 Don’t miss a single step in your journey to becoming a Platform Engineer! 🎉

This post is just the beginning. Here’s what we’ve covered so far and what’s coming up next:

👉 Bookmark this blog and check back every day for new posts in the series. 📣 Share your progress on social media with the hashtag #ZeroToPlatformEngineer to connect with other readers!

Subscribe to Alex Parra Newsletter

One update per month. No spam.