Skip to content

Instantly share code, notes, and snippets.

@KenMacD
Created September 13, 2023 14:28
Show Gist options
  • Save KenMacD/56ec9bdee0ad2a00d0686edbb7fc5020 to your computer and use it in GitHub Desktop.
Save KenMacD/56ec9bdee0ad2a00d0686edbb7fc5020 to your computer and use it in GitHub Desktop.
Kind cluster with podman
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# If ipv4 only:
#networking:
# ipFamily: ipv4
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
---
# Use etcd in memory https://github.com/kubernetes-sigs/kind/issues/845
kind: ClusterConfiguration
etcd:
local:
dataDir: /tmp/etcd
extraArgs:
unsafe-no-fsync: "True"
containerdConfigPatches:
## To use a proxy to avoid pulling the same image all the time
##
## Create dockerhub volume:
## $ podman volume create dockerhub-proxy-data
##
## Run dockerhub proxy:
## $ podman run -d --name "kind-registry-proxy" --net=kind -v dockerhub-proxy-data:/var/lib/registry -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io registry:2
##
## For a registry shared with host:
## $ podman run -d -p "127.0.0.1:5000:5000" --name "kind-registry-local" --net=kind registry:2
#- |-
# [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
# endpoint = ["http://kind-registry-proxy:5000"]
# [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:5000"]
# endpoint = ["http://kind-registry-local:5000"]
nodes:
- role: control-plane
# Override default image to test over versions
# See https://github.com/kubernetes-sigs/kind/releases
# image: docker.io/kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31
## If access to etcd needed:
#extraMounts:
## If not using in memory etcd:
## - containerPath: /var/lib/etcd
#- containerPath: /tmp/etcd
# hostPath: /mnt/etcd
# Set up ingress
kubeadmConfigPatches:
extraPortMappings:
- containerPort: 80
hostPort: 9080
protocol: TCP
listenAddress: 127.0.0.1
- containerPort: 443
hostPort: 9443
protocol: TCP
listenAddress: 127.0.0.1
# For multi-node add workers
#- role: worker
#- role: worker
podman run -d --name "kind-registry-proxy" --net=kind -v dockerhub-proxy-data:/var/lib/registry -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io registry:2
podman run -d -p "127.0.0.1:5000:5000" --name "kind-registry-local" --net=kind registry:2
KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --config=./cluster.yaml
kind export kubeconfig
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment