Easily Spin Up a Kubernetes Cluster with kind and Podman in Linux

ยท

2 min read

Introduction to Kubernetes and the Need for Local Clusters

Kubernetes has emerged as the de facto standard for orchestrating containerized applications, allowing developers to manage their deployments efficiently. However, the complexity of setting up a Kubernetes cluster can be daunting. This is where local clusters come into play, offering a simplified environment for development and testing.

Understanding kind and Podman

kind, short for Kubernetes IN Docker, allows developers to run Kubernetes clusters within Docker containers. Podman, on the other hand, is a daemon less container engine for developing, managing, and running OCI Containers on your system. Together, they offer a lightweight and efficient way to create Kubernetes clusters on your local machine.

Prerequisites for Using kind with Podman

Before diving in, ensure your system meets the following requirements:

  • Linux/macOS/Windows with at least 4GB RAM

  • If using Windows you can use a Hypervisor/VirtualBox/Vmware to lauch a linux vm

  • RHEL v9 or v8 OS, you can run the command in any other Linux flavor too

Installation Steps

Install Podman

$ yum install podman -y

Check the podman installation

$ podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

Go Installation

$ yum install -y golang 
$ go version
go version go1.17.7 linux/amd64

We are now ready to install the kind :

$ go install sigs.k8s.io/kind@v0.22.0
$ go env GOPATH
/root/go
$ ls /root/go/bin
kind
$ export PATH=$PATH:/root/go/bin/
[root@localhost bin]$ kind create cluster
enabling experimental podman provider
Creating cluster "kind" ...
 โœ“ Ensuring node image (kindest/node:v1.29.2) ๐Ÿ–ผ
 โœ“ Preparing nodes ๐Ÿ“ฆ
 โœ“ Writing configuration ๐Ÿ“œ
 โœ“ Starting control-plane ๐Ÿ•น๏ธ
 โœ“ Installing CNI ๐Ÿ”Œ
 โœ“ Installing StorageClass ๐Ÿ’พ
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community ๐Ÿ™‚

Install kubectl command

$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   138  100   138    0     0    148      0 --:--:-- --:--:-- --:--:--   148
100 47.4M  100 47.4M    0     0  10.0M      0  0:00:04  0:00:04 --:--:-- 14.9M

$ install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
$ kubectl get nodes

Hurray you are all set now !!

Conclusion

Using kind and Podman together simplifies the process of setting up Kubernetes clusters, making it accessible for developers of all levels. This guide serves as a starting point for your journey into Kubernetes development.

References and Further Reading

  • Explore the official documentation of kind and Podman.

  • Engage with community forums and support channels for additional insights.

ย