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
- 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
- Create a development configuration
(overlays/dev/deployment.yaml)
:
bases:
- ../../base
patchesStrategicMerge:
- deployment-patch.yaml
- Create a patch file
(overlays/dev/deployment-patch.yaml)
:
spec:
replicas: 1
template:
spec:
containers:
- name: app
image: nginx:1.21-alpine
- Build the configuration for the dev environment:
kubectl apply -k overlays/dev
Step 2: Automate with Skaffold
- Install Skaffold:
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
chmod +x skaffold
sudo mv skaffold /usr/local/bin
- Create a
skaffold.yaml
file:
apiVersion: skaffold/v2beta26
kind: Config
build:
artifacts:
- image: app
deploy:
kustomize:
paths:
- ./overlays/dev
- Run Skaffold
skaffold dev
- Skaffold will monitor changes, build new images, and redeploy automatically.
Activity for Today
- Set up Kustomize for a sample application with different environments.
- Automate your Kubernetes workflow with Skaffold.
- 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:
-
Day 2: Day 2: Containers and Docker - The Building Blocks of Cloud Native
-
Day 3: Containers and Kubernetes - The Building Blocks of Cloud Native
-
Day 4: Deployments and Scaling in Kubernetes - Let’s Get Practical
-
Day 6: ConfigMaps and Secrets – Managing Configurations in Kubernetes
👉 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!