Install Kind as local Kubernetes clusters - Ubuntu 22.04

ยท

2 min read

image.png

So if you're intersetd to use Kubernetes in your local machine for testing and learning purposes you will find many options are avaiable . in this blog post will focus only in Kind

1. Install Docker as container Runtime .

sudo apt-get update -y &&  sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl status docker

2. Install Kind from Release Binaries ๐Ÿ”—๏ธŽ

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.16.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

3. Install kubectl binary with curl on Linux (optional)

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

4. Creating a Cluster

kind create cluster # Default cluster context name is `kind`.
...
kind create cluster --name cluster-1
kind get clusters
kind
cluster-1

5. Deploy sample app .

kubectl create deployment hello-node --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-node --port=8080

6 checking the app.

sameh@testing:~# kubectl get all
NAME                             READY   STATUS    RESTARTS   AGE
pod/hello-node-697897c86-8tk9z   1/1     Running   0          10h

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/hello-node   ClusterIP   10.96.39.184   <none>        8080/TCP   5s
service/kubernetes   ClusterIP   10.96.0.1      <none>        443/TCP    10h

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/hello-node   1/1     1            1           10h

NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/hello-node-697897c86   1         1         1       10h

7. Clean up

sameh@testing:~# kind get clusters
kind

sameh@testing:~# kind delete cluster --name kind
Deleting cluster "kind" ...

Thanks .

ย