It is very important to practice on multi-node Kubernetes cluster for CKA exam. and practicing on cloud service like as EKS, AKS or GKS is not give more details as its managed by cloud. Also this involves cost, there are some free credits but I didnt found those sufficient.
There are various other tolls which help to setup cluster locally on workstation. Tools are minikube , Kind etc. I found Kind is best tool to practice. So below steps refer to Kind.
Kind uses container as node.
Kind need go installed on machine.
- My Machine details:
Linux rvkmr 6.8.0-50-generic #51-Ubuntu SMP PREEMPT_DYNAMIC Sat Nov 9 17:58:29 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
- Install go:
sudo apt install golang
- Install kind:
Referred doc : https://kind.sigs.k8s.io/docs/user/quick-start/
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-amd64
chmod +x kind
sudo mv ./kind /usr/local/bin/kind
- Single Node Cluster Setup With Kind:
kind create cluster --image=kindest/node:v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30 --name kind-cka-cluster
- Check Cluster info:
kubectl cluster-info --context kind-cka-cluster
- Multi-Node Cluster Setup With Kind:
create config.yaml file as below
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
run command to setup multi-node cluster
kind create cluster --image=kindest/node:v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30 --name cka-cluster2 --config ./config.yaml
- Check nodes in cluster:
NAME STATUS ROLES AGE VERSION
cka-cluster2-control-plane NotReady control-plane 2m30s v1.31.4
cka-cluster2-worker NotReady <none> 72s v1.31.4
cka-cluster2-worker2 NotReady <none> 72s v1.31.4
ravikumar@rvkmr:~/k8s/k8schallange/day6$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
cka-cluster2-control-plane Ready control-plane 2m49s v1.31.4
cka-cluster2-worker NotReady <none> 91s v1.31.4
cka-cluster2-worker2 NotReady <none> 91s v1.31.4
ravikumar@rvkmr:~/k8s/k8schallange/day6$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
cka-cluster2-control-plane Ready control-plane 4m37s v1.31.4
cka-cluster2-worker Ready <none> 3m19s v1.31.4
cka-cluster2-worker2 Ready <none> 3m19s v1.31.4
- List cluster:
ravikumar@rvkmr:~/k8s/k8schallange/day6$ kind get clusters
cka-cluster2
kind-cka-cluster
- Set Context to connect different cluster
Switched to context "kind-cka-cluster2".
- Delete cluster
Deleting cluster "kind-cka-cluster" ...
Deleted nodes: ["kind-cka-cluster-control-plane"]
No comments:
Post a Comment