Hugo Future Imperfect Slim

Tech Notes

Linux,MAC,Docker,Kubernetes,
CloudStack,AWS,GCP,AZURE,
Raspberrypi,VMWARE,GO,BOOKS,
NETFLIX,Movies,Seasons

2-Minute Read

In order to quicly bring up a new kubernetes cluster in your local laptop, then you can use kind.

Kind ( Kubernetes in Docker)

Kind basically creates the nodes as a containers and create a kubernetes cluster

https://kind.sigs.k8s.io/

https://github.com/kubernetes-sigs/kind

brew install kind

Deploying a Single node cluster

kind create cluster 
docker images
kindest/node                            <none>                                                  d372b674475a   3 months ago    1.1GB

docker ps -a
3047fe4988f4   kindest/node:v1.21.1   "/usr/local/bin/entr…"   8 days ago       Up 8 days       127.0.0.1:50941->6443/tcp   kind-control-plane

docker exec -it kind-control-plane sh
# crictl ps -a
CONTAINER           IMAGE               CREATED             STATE               NAME                      ATTEMPT             POD ID
be7d88399e276       1a1f05a2cd7c2       8 days ago          Running             coredns                   0                   bb3eb2d8b0138
dc91af853f8d4       1a1f05a2cd7c2       8 days ago          Running             coredns                   0                   72e459f147b24
2bcbac91131f1       2b703ea309660       8 days ago          Running             local-path-provisioner    0                   1b9b5b3329128
3787410dc6121       f37b7c809e5dc       8 days ago          Running             kindnet-cni               0                   66b72ef1c9758
af1073c036c7b       4bbef4ca108cd       8 days ago          Running             kube-proxy                0                   e254cfacdfb75
b29d7fa01b9ea       05b738aa1bc63       8 days ago          Running             etcd                      0                   4109caeae008c
cb638fbd4988d       18e61c783b417       8 days ago          Running             kube-apiserver            0                   f87bb12d4816e
181e0b63e3db1       0c6dccae49de8       8 days ago          Running             kube-controller-manager   0                   0d00a01acb283
ccd3b21c436ec       8c783dd252088       8 days ago          Running             kube-scheduler            0                   72a8570b0c0b2

kubectl get cluster-info

kubectl  get nodes -o wide
NAME                 STATUS   ROLES                  AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE       KERNEL-VERSION     CONTAINER-RUNTIME
kind-control-plane   Ready    control-plane,master   8d    v1.21.1   172.18.0.2    <none>        Ubuntu 21.04   5.10.25-linuxkit   containerd://1.5.2

Creating a Cluster with a specific name

kind create cluster –name mycluster

7a70b8d28e8a   kindest/node:v1.21.1   "/usr/local/bin/entr…"   3 minutes ago       Up 3 minutes       127.0.0.1:54053->6443/tcp   mycluster-control-plane
3047fe4988f4   kindest/node:v1.21.1   "/usr/local/bin/entr…"   8 days ago       Up 8 days       127.0.0.1:50941->6443/tcp   kind-control-plane

Listing the clusters

kind get clusters kind mycluster

Deleting a kind cluster

kind delete cluster

Deleting cluster "kind"

kind delete cluster --name mycluster
Deleting cluster "mycluster" 

Deploying multi master/worker nide kubernetes cluster

https://kind.sigs.k8s.io/docs/user/quick-start/#configuring-your-kind-cluster

kind create cluster --config /tmp/kind.yaml

vi /tmp/kind.yaml

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: control-plane
- role: control-plane
- role: worker
- role: worker
- role: worker
  image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6 --config /tmp/kind.yaml

With specific version of kubernetes

https://github.com/kubernetes-sigs/kind/releases


kind create cluster --image kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6 --config /tmp/kind.yaml

Installing Metallb loadbalancer on kind

https://kind.sigs.k8s.io/docs/user/loadbalancer/


kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/master/manifests/namespace.yaml

kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)" 

kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)" 

https://www.youtube.com/watch?v=kkW7LNCsK74

comments powered by Disqus

Recent Posts

Categories

About

I am a Software Engineer at Persistent Systems, working on Cloud Stack Orchestration and various tech related to Cloud Infra, container technology like Docker, Kubernetes