Pages

Wednesday 22 December 2021

KinD K8s cluster

KinD is good tool to if we want to run kubernetes in docker. Good for development activities related to kubernetes. 

quick start

sample steps to create multiple clusters


Create 2 clusters with single node: 

$ kind create cluster --image myimages/external/kindest/node:v1.20.7  --name cluster-alpha

$ kind create cluster --image myimages/external/kindest/node:v1.20.7  --name cluster-beta

$ kubectl get no

NAME                                                           STATUS   ROLES                  AGE     VERSION

cluster-beta-control-plane   Ready    control-plane,master   5m27s   v1.20.7


$ kind get clusters
cluster-alpha
cluster-beta

List cluster contexts


$ kubectl config  get-contexts
CURRENT   NAME                                                  CLUSTER                                               AUTHINFO                                              NAMESPACE
          kind-cluster-alpha                 kind-cluster-alpha                    kind-cluster-alpha  
          kind-cluster-beta                   kind-cluster-beta                      kind-cluster-beta

Switch to the desired cluster context

$ kubectl config  use-context kind-cluster-alpha
Switched to context "kind-cluster-alpha".
$ kubectl get no
NAME                                             STATUS   ROLES                  AGE    VERSION
cluster-alpha-control-plane   Ready    control-plane,master   119m   v1.20.7


No comments:

Post a Comment