Kubernetes Views 3

Building a Kubernetes cluster

Building a Kubernetes cluster image 1

This post is about building a Kubernetes cluster with one master node and three worker nodes.

Kubernetes first needs a container runtime and Kubernetes itself installed, so please go to the links below and install those.


 Containerd : https://librat.kr/entry/Kubernetes-Containerd-설치하기-k8s-container-runtime
 kubernetes : https://librat.kr/entry/Kubernetes-쿠버네티스k8s-1253-설치하기

Installing containerd as a Kubernetes runtime

Installing Kubernetes 1.25.3

If you use a command like the following, the cluster is created and a command is printed.

kubeadm init --apiserver-advertise-address 마스터노드ip --pod-network-cidr=10.244.0.0/16
Building a Kubernetes cluster image 2

If you copy the command at the bottom and paste it on a worker node, the node joins

Building a Kubernetes cluster image 3

Then run the following commands on the master node

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf

source <(kubectl completion bash) 
echo "source <(kubectl completion bash)" >> ~/.bashrc

Those commands grant Kubernetes access (kubeconfig).

Commands to check the nodes

kubectl get nodes
kubectl get nodes -o wide
Building a Kubernetes cluster image 4

Print the join command again

kubeadm token create --print-join-command

Reactions

Comments 0

A nickname and a password are required. The same password edits or deletes the comment later. Comments appear after a review.

Comments appear after a review. The password is used again to edit or delete.