We use cookies to understand how the site is used and to display ads. Analytics and advertising only run after you accept. You can change your choice anytime. Privacy policy

Skip to content
devvkit
$devvkit learn --librarie podman-&-kind-guide

Podman & kind Guide

[containers][docker][kubernetes][devops]
Container / K8s
Install
# Podman:
brew install podman
sudo apt install podman
# WSL/Windows: podman machine init

# kind:
brew install kind
go install sigs.k8s.io/kind@latest

Podman is a drop-in replacement for Docker that doesn't require a daemon. Every docker command has a podman equivalent (podman run, podman ps, podman-compose). It runs containers rootless by default: better security and no sudo needed.

kind (Kubernetes IN Docker) runs Kubernetes clusters as Docker containers. It's the standard for local K8s testing. `kind create cluster` creates a cluster in 60 seconds. The kubeconfig is auto-exported. Use `kind load docker-image myapp:latest` to push images.

Podman supports pods (like Kubernetes), systemd integration, and Mac/Windows via podman machine. kind supports multi-node clusters and mounts host directories. GUI alternatives: Docker Desktop, Rancher Desktop, Lens.

Podman Basics

Podman run container· Drop-in docker replacement.
podman run -d -p 8080:80 nginx:alpine
podman ps
podman stop $(podman ps -q)
podman rm $(podman ps -aq)

# All docker flags work:
podman run -it --rm ubuntu bash
podman exec -it <container> sh
Podman compose· Run docker-compose files.
pip install podman-compose
podman-compose up -d
podman-compose down
podman-compose logs -f

# Or use docker-compose with podman socket:
export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
docker-compose up
Podman rootless tips· No sudo needed.
podman info | grep rootless
podman run --rm hello-world

# Port forwarding (rootless uses high ports):
podman run -p 8080:80 nginx

# Systemd integration:
podman generate systemd --name mycontainer > ~/.config/systemd/user/mycontainer.service
systemctl --user enable mycontainer

Podman Pods

Podman pods· Kubernetes-like pod groups.
podman pod create --name mypod -p 8080:80
podman run -d --pod mypod --name app nginx
podman run -d --pod mypod --name sidecar alpine:latest sleep infinity

# Generate K8s YAML from pod:
podman generate kube mypod > mypod.yaml
kubectl apply -f mypod.yaml

kind Setup

kind create cluster· Start local K8s.
kind create cluster
kind create cluster --name dev
kind get clusters
kubectl cluster-info --context kind-kind

# Multi-node:
kind create cluster --config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
EOF
kind delete· Teardown cluster.
kind delete cluster
kind delete cluster --name dev
kind delete clusters --all
kubectl config get-contexts

kind Workloads

kind load images· Use local Docker images.
docker build -t myapp:latest .
kind load docker-image myapp:latest
kind load docker-image myapp:latest --name dev

# Check:
kubectl run nginx --image=nginx:alpine
kubectl get pods
kind ingress· Enable NGINX ingress.
kind create cluster --config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
EOF

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml