Skip to content

Instantly share code, notes, and snippets.

@mbodo
Last active June 29, 2023 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbodo/92da4248e963a27378bbc91a0b7a5d21 to your computer and use it in GitHub Desktop.
Save mbodo/92da4248e963a27378bbc91a0b7a5d21 to your computer and use it in GitHub Desktop.
Fedora 38 installation of kind + podman rootless

If you have btrfs:

1.As no-root user configure btrfs driver for podman

$ mkdir ~/.config/containers
$ touch ~/.config/containers/storage.conf

how-can-i-write-a-heredoc-to-a-file-in-bash-script

$ cat << EOF > ~/.config/containers/storage.conf
[storage]
driver="btrfs"
EOF

$ podman system reset
  1. CGroups v2 configuration https://rootlesscontaine.rs/getting-started/common/cgroup2/ https://rootlesscontaine.rs/getting-started/common/cgroup2/#enabling-cpu-cpuset-and-io-delegation containers/podman#16412

  2. Kind installation https://kind.sigs.k8s.io/docs/user/quick-start/#installing-from-release-binaries https://kind.sigs.k8s.io/docs/user/rootless/

$ sudo sh -c 'cat << EOF > /etc/systemd/system/user@.service.d/delegate.conf
[Service]
Delegate=cpu cpuset io memory pids
EOF'
$ sudo systemctl daemon-reload

$ sudo sh -c 'cat << EOF > /etc/modules-load.d/iptables.conf
ip6table_nat
iptable_nat
EOF'

$ sudo systemctl reboot

$ cat << EOF > ~/kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 30950
    hostPort: 8080
EOF

$ cd ~
$ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster --config kind.yaml
$ export KUBECONFIG=${mktemp tmp.kubeconfig-XXXXXXXXXX}
$ $(kind get kubeconfig) > $KUBECONFIG
  1. Test deployment
$ cat << EOF > ~/kind-nginx-po.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx
  name: nginx
spec:
  containers:
  - image: nginx
    name: nginx
    ports:
    - containerPort: 8080
      protocol: TCP
EOF

$ cat << EOF > ~/kind-nginx-svc-nodeport.yaml
apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  ports:
  - nodePort: 30950
    port: 8080
    protocol: TCP
    targetPort: 80
  selector:
    run: nginx
  type: NodePort
EOF

$ ./kubectl apply -f kind-nginx-po.yaml && ./kubectl apply -f kind-nginx-svc-nodeport.yaml

$ curl -L http://localhost:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment