Local Kubernetes
Local Kubernetes Development with Podman, Kind, and Helm
I’ll walk you through setting up a complete local development environment using Podman, Kind, and Helm to build, manage, and deploy containerized applications.
1. Setting Up Podman & Podman Desktop
Install Podman:
- On Fedora/RHEL:
sudo dnf install podman
- On Ubuntu:
sudo apt install podman
- On macOS:
brew install podman
Install Podman Desktop: Download from podman-desktop.io or install via package manager:
- macOS:
brew install podman-desktop
- Linux: Download the AppImage from the official website
Initialize Podman Machine (macOS/Windows):
podman machine initpodman machine start
Verify Installation:
podman info
2. Setting Up Kind (Kubernetes in Docker/Podman)
Install Kind:
# Using Gogo install sigs.k8s.io/kind@latest
# Using package managers# macOSbrew install kind
# Linuxcurl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64chmod +x ./kindsudo mv ./kind /usr/local/bin/
Configure Podman for Kind: Kind uses the Docker socket by default. To use Podman:
export KIND_EXPERIMENTAL_PROVIDER=podman
Create a Kind Cluster:
kind create cluster --name my-cluster
Verify Cluster:
kubectl cluster-info --context kind-my-cluster
3. Install Helm
# macOSbrew install helm
# Linuxcurl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
4. Building Images with Podman
Create a Simple Application: Create a Dockerfile for your application:
FROM nginx:alpineCOPY index.html /usr/share/nginx/html/
Create a simple index.html:
<!DOCTYPE html><html><body> <h1>Hello from Podman and Kind!</h1></body></html>
Build the Image:
podman build -t my-app:latest .
5. Loading Images into Kind
Since Kind runs as a separate environment, you need to load your local images into it:
# Save the image to a tar filepodman save my-app:latest -o my-app.tar
# Load the image into Kindkind load image-archive my-app.tar --name my-cluster
Alternatively, you can push to a registry that Kind can access.
6. Creating a Helm Chart
Initialize a Helm Chart:
helm create my-app
Modify the Helm Chart:
Edit my-app/values.yaml
to use your image:
image: repository: my-app tag: latest pullPolicy: IfNotPresent
Install the Helm Chart:
helm install my-release ./my-app
7. Complete Workflow Example
Here’s a complete workflow script that ties everything together:
# Build the imagepodman build -t my-app:latest .
# Save the imagepodman save my-app:latest -o my-app.tar
# Load the image into Kindkind load image-archive my-app.tar --name my-cluster
# Deploy with Helmhelm install my-release ./my-app
8. Accessing Your Application
After deployment, access your application:
kubectl port-forward svc/my-release-my-app 8080:80
Then visit http://localhost:8080 in your browser.
9. Updating Your Application
When you make changes:
# Rebuild imagepodman build -t my-app:latest .
# Save and load into Kindpodman save my-app:latest -o my-app.tarkind load image-archive my-app.tar --name my-cluster
# Upgrade Helm releasehelm upgrade my-release ./my-app
Would you like me to elaborate on any specific part of this workflow?