I am using this Centos ISO image for the Kube Node and worker Nodes
- Atleast 2 CPU Cores
- 4GB RAM
- 20GB HDD (Minimum)
- Atleast 2 CPU Cores
- 4GB RAM
- 40GB HDD (Minimum)
yum update -y
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
reboot
firewall-cmd --permanent --add-port=6443/tcp
firewall-cmd --permanent --add-port=2379-2380/tcp
firewall-cmd --permanent --add-port=10250/tcp
firewall-cmd --permanent --add-port=10251/tcp
firewall-cmd --permanent --add-port=10252/tcp
firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd –reload
modprobe br_netfilter
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin git wget -y
sudo systemctl enable docker && sudo systemctl start docker
sudo systemctl enable containerd && sudo systemctl start containerd
vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
yum install kubeadm docker -y
systemctl enable kubelet && systemctl start kubelet
kubeadm init
[preflight] Running pre-flight checks
[WARNING Hostname]: hostname "kubemaster.techarkit.local" could not be reached
[WARNING Hostname]: hostname "kubemaster.techarkit.local": lookup kubemaster.techarkit.local on 192.168.175.2:53: no such host
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: E1211 20:58:19.685923 104550 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
[root@kubemaster ~]# rm /etc/containerd/config.toml
rm: cannot remove ‘/etc/containerd/config.toml’: No such file or directory
[root@kubemaster ~]# systemctl restart containerd
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
kubectl get nodes --all-namespaces
kubeadm join 192.168.117.200:6443 --token 869h67.4x0irxa14419ep1s \
--discovery-token-ca-cert-hash sha256:da5ed4a9ec779f8b1eca198e8d6fe7b5cf8c29fa8f1f512b0099a808b17759bc
git clone https://github.com/techarkit/Linux_guides.git
cd Linux_guides/
sudo kubectl apply -f /root/Linux_guides/kube-flannel.yml
OR
sudo kubectl apply -f https://raw.githubusercontent.com/techarkit/Linux_guides/master/kube-flannel.yml
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubemaster.techarkit.local Ready control-plane 153m v1.26.0
kubenode1.techarkit.local Ready <none> 25m v1.26.0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
yum update -y
reboot
vi /etc/hosts
192.168.175.200 kubemaster.techarkit.local kubemaster
192.168.175.201 kubenode1.techarkit.local kubenode1
192.168.175.202 kubenode2.techarkit.local kubenode2
:wq
sestatus
SELinux status: disabled
firewall-cmd --permanent --add-port=6783/tcp
firewall-cmd --permanent --add-port=10250/tcp
firewall-cmd --permanent --add-port=10255/tcp
firewall-cmd --permanent --add-port=30000-32767/tcp
firewall-cmd --reload
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
:wq
yum install yum-utils -y
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin git wget -y
yum install kubeadm -y
systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet
kubeadm join 192.168.175.200:6443 --token vaki2g.wevj9qs1d6unyj0k --discovery-token-ca-cert-hash sha256:68c74acbbcea624e2cdbeee4acc1a3feb96f58a53b643476b9f77769e340b98b
systemctl status kubelet -l
---------------------------- Error ------------------------------------
Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: activating (auto-restart) (Result: exit-code) since Sun 2023-01-01 21:23:01 IST; 3s ago
Docs: https://kubernetes.io/docs/
Process: 9815 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)
Main PID: 9815 (code=exited, status=1/FAILURE)
Jan 01 21:23:01 kubenode1.techarkit.local systemd[1]: Unit kubelet.service entered failed state.
---------------------------- Error ------------------------------------
mv /etc/kubernetes/kubelet.conf /etc/kubernetes/admin.conf
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
systemctl restart kubelet
kubeadm join 192.168.175.200:6443 --token vaki2g.wevj9qs1d6unyj0k --discovery-token-ca-cert-hash sha256:68c74acbbcea624e2cdbeee4acc1a3feb96f58a53b643476b9f77769e340b98b
mv /etc/kubernetes/pki/ca.crt /tmp/
Re-run the Node Join Command