filmov
tv
kubernetes tutorial | Install K8s Cluster using kubeadm | Deploy a 3 node K8s cluster using kubeadm
Показать описание
*CERTIFIED KUBERNETES ADMINISTRATOR*
-------------------------------------------------------------------------
*USEFUL LINKS*
---------------------------
*Install Kubeadm*
*Container Runtimes*
*Install Docker CRI*
*Deploy a Kubernetes Cluster*
*POD NETWORKING*
(Weavenet CNI Plugin)
===============================
#cka #kubernetes #k8s #containers
*DEMO STEPS*
--------------------------
*Step 1: Pre-requisites*
1.a.. Check the OS, Hardware Configurations & Network connectivity
1.b.. Turn off the swap & firewall
$ sudo swapoff -a
$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld
*Step 2. Configure the local IP tables to see the Bridged Traffic*
2.a.. Enable the bridged traffic
$ lsmod | grep br_netfilter
$ sudo modprobe br_netfilter
Content:
br_netfilter
Content:
$ sudo sysctl --system
*Step 3. Install Docker as a Container RUNTIME*
3.a.. Uninstall any Older versions
$ sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
3.b.. Install Yum Utilities | Config Manager
$ sudo yum install -y yum-utils
3.c.. Setup the Docker Repository
3.d.. Install Docker Engine, Docker CLI, Docker RUNTIME
*Step 4. Configure Docker Daemon for cgroups management & Start Docker*
4.a.. Create directory
$ sudo mkdir /etc/docker
Content:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ sudo systemctl enable docker
$ sudo systemctl status docker
*Step 5. Install kubeadm, kubectl, kubelet*
Content:
[kubernetes]
name=Kubernetes
enabled=1
gpgcheck=1
repo_gpgcheck=1
exclude=kubelet kubeadm kubectl
5.b.. Set SELinux in permissive mode (effectively disabling it)
$ sudo setenforce 0
$ sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
$ sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
$ sudo systemctl enable --now kubelet
*Step 6. Configuring a cgroup driver*
Ignore if docker is used as a CRI
*Step 7. Deploy a kubernetes cluster using kubeadm*
# Run only in Master node
$ kubeadm init --pod-network-cidr=10.10.0.0/16 --apiserver-advertise-address=master_nodeIP
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.74.10:6443 --token l431j0.0tz0bbuu7hj64lw5 \
--discovery-token-ca-cert-hash sha256:1743115f18a7b8761105ff5465cd1aeed74a2e8a3f326405da61681d07fdb0e0
*Step 8. Install CNI for POD Networking*
# Run only in Master node
Weave Networks:
*Step 9. Join the worker nodes to the master*
# Run in Worker Nodes as "Root"
kubeadm join 192.168.74.10:6443 --token l431j0.0tz0bbuu7hj64lw5 \
--discovery-token-ca-cert-hash sha256:1743115f18a7b8761105ff5465cd1aeed74a2e8a3f326405da61681d07fdb0e0
# Make sure to replace your tokens and IP's in the above command accordingly
*Step 10. Access the K8s Cluster & Deploy a POD*
kubectl run vsparkz --image nginx
-------------------------------------------------------------------------
*USEFUL LINKS*
---------------------------
*Install Kubeadm*
*Container Runtimes*
*Install Docker CRI*
*Deploy a Kubernetes Cluster*
*POD NETWORKING*
(Weavenet CNI Plugin)
===============================
#cka #kubernetes #k8s #containers
*DEMO STEPS*
--------------------------
*Step 1: Pre-requisites*
1.a.. Check the OS, Hardware Configurations & Network connectivity
1.b.. Turn off the swap & firewall
$ sudo swapoff -a
$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld
*Step 2. Configure the local IP tables to see the Bridged Traffic*
2.a.. Enable the bridged traffic
$ lsmod | grep br_netfilter
$ sudo modprobe br_netfilter
Content:
br_netfilter
Content:
$ sudo sysctl --system
*Step 3. Install Docker as a Container RUNTIME*
3.a.. Uninstall any Older versions
$ sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
3.b.. Install Yum Utilities | Config Manager
$ sudo yum install -y yum-utils
3.c.. Setup the Docker Repository
3.d.. Install Docker Engine, Docker CLI, Docker RUNTIME
*Step 4. Configure Docker Daemon for cgroups management & Start Docker*
4.a.. Create directory
$ sudo mkdir /etc/docker
Content:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ sudo systemctl enable docker
$ sudo systemctl status docker
*Step 5. Install kubeadm, kubectl, kubelet*
Content:
[kubernetes]
name=Kubernetes
enabled=1
gpgcheck=1
repo_gpgcheck=1
exclude=kubelet kubeadm kubectl
5.b.. Set SELinux in permissive mode (effectively disabling it)
$ sudo setenforce 0
$ sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
$ sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
$ sudo systemctl enable --now kubelet
*Step 6. Configuring a cgroup driver*
Ignore if docker is used as a CRI
*Step 7. Deploy a kubernetes cluster using kubeadm*
# Run only in Master node
$ kubeadm init --pod-network-cidr=10.10.0.0/16 --apiserver-advertise-address=master_nodeIP
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 192.168.74.10:6443 --token l431j0.0tz0bbuu7hj64lw5 \
--discovery-token-ca-cert-hash sha256:1743115f18a7b8761105ff5465cd1aeed74a2e8a3f326405da61681d07fdb0e0
*Step 8. Install CNI for POD Networking*
# Run only in Master node
Weave Networks:
*Step 9. Join the worker nodes to the master*
# Run in Worker Nodes as "Root"
kubeadm join 192.168.74.10:6443 --token l431j0.0tz0bbuu7hj64lw5 \
--discovery-token-ca-cert-hash sha256:1743115f18a7b8761105ff5465cd1aeed74a2e8a3f326405da61681d07fdb0e0
# Make sure to replace your tokens and IP's in the above command accordingly
*Step 10. Access the K8s Cluster & Deploy a POD*
kubectl run vsparkz --image nginx
Комментарии