1. Master and Worker details
Node |
IP |
Management |
10.9.0.5 |
master-1 |
10.10.0.11 |
worker-1 |
10.10.0.12 |
worker-2 |
10.10.0.13 |
worker-3 |
10.10.0.14 |
worker-4 |
10.10.0.15 |
worker-5 |
10.10.0.16 |
pods |
172.10.11.0/24 |
2. Some commands run on all nodes.
# yum update -y
Disable selinux
and firewalld
# systemctl stop firewalld
# systemctl disable firewalld
# /etc/sysconfig/selinux
SELINUX=disable
3. Update hostname and
/etc/hosts file on all nodes.
# vim /etc/hostname
master-1
# vim /etc/hosts
10.10.0.11
master-1
10.10.0.12
worker-1
10.10.0.13
worker-2
10.10.0.14
worker-3
10.10.0.15
worker-4
10.10.0.16
worker-5
10.10.0.17 common
4. Manually loading the modules on
a Linux system.
overlay — The overlay module provides overlay
filesystem support, which Kubernetes uses for its pod network abstraction.
br_netfilter — This module enables bridge netfilter
support in the Linux kernel, which is required for Kubernetes networking and
policy.
# sudo modprobe overlay
# sudo modprobe br_netfilter
5. kernel modules should be automatically
loaded at boot time.
# cat <<EOF | sudo tee
/etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
6. sysctl parameters for Kubernetes networking.
# cat <<EOF |
sudo tee /etc/sysctl.d/kube.conf
net/bridge/bridge-nf-call-ip6tables = 1
net/bridge/bridge-nf-call-iptables = 1
net/bridge/bridge-nf-call-arptables = 1
net.ipv4.ip_forward = 1
EOF
Reloading the sysctl settings.
# sudo sysctl --system
7. Disable the swap memory.
# sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# swapoff -a
# free -m
8. Download the containerd package.
# yum install -y yum-utils
9. Add repo for containerd.
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
10. Add a repo for Kubernetes.
# cat <<EOF | sudo tee
/etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.29/rpm/repodata/repomd.xml.key
EOF
11. Install containerd on all nodes.
# yum install containerd -y
12. location where the configuration file for containerd
is stored.
# sudo containerd config default | sudo tee
/etc/containerd/config.toml
Note:- SystemdCgroup has to be set to “true”
SystemdCgroup = true
# systemctl status containerd
# systemctl start containerd
# systemctl enable containerd
13. Install kubelet and kubeadm package on the worker node.
# yum install kubelet kubeadm -y
# systemctl enable kubelet
14. Install kubelet , kubeadm, kubectl package on the master
node.
# yum install kubelet kubeadm kubectl -y
# systemctl enable kubelet
15. initializes a Kubernetes
control-plane node with the specified Pod network CIDR.
# kubeadm init --pod-network-cidr=172.10.11.0/24
Note:- If
needed for cluster remove below command.
# kubeadmin reset
16. Run the below command on the master node.
# mkdir -p
$HOME/.kube
# sudo cp -i
/etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id
-u):$(id -g) $HOME/.kube/config
For install CNI
# wget
https://raw.githubusercontent.com/projectcalico/calico/v3.27.3/manifests/calico.yaml
# kubectl apply -f calico.yaml
# kubectl get po -A
# kubectl get nodes
17. Run below command in worker node for Join the worker with
the master node :-
# kubeadm join 192.169.0.21:6443 --token
bqyifs.ll4db25n0hb5x4t1 \
--discovery-token-ca-cert-hash
sha256:bcdc577bb0f1af8dcde2804a1d3066e2951f333d99a1892a91367e7174bf5100
# kubectl get nodes
# kubectl get po -A
No comments:
Post a Comment