DevOps Classroom Series – 06/Apr/2021
Installing Kubernetes
- K8s can be installed on a single node to set up the developer environments.
- minikube
- On production environments we would be using a multi node setup
- For IOT / ARM processers => K3s (Lightweight kuberenetes)
- Kubeadmin (multi node setup on linux workloads)
- Kops Refer Here for installing k8s on AWS
- kubespray Refer Here
- Native Kubernetes on Cloud
- AKS (Azure Kubernetes Services)
- GKE (Google Kubernetes Engine)
- EKS (Elastic Kubernetes Services on AWS)
- Lets try to setup
- minikube
- kubeadm
Minikube
- This is a tool to set up a single node cluster and suitable for local environments.
- To setup minikube Refer Here
- Commands
choco install minikube -y
minikube start
![Preview](https://i2.wp.com/directdevops.blog/wp-content/uploads/2021/04/k8s2.png?w=800&ssl=1)
![Preview](https://i1.wp.com/directdevops.blog/wp-content/uploads/2021/04/k8s3.png?w=800&ssl=1)
![Preview](https://i0.wp.com/directdevops.blog/wp-content/uploads/2021/04/k8s4.png?w=800&ssl=1)
- Check the nodes
- Check all the pods
Kubeadm
- In this article we will be creating a kubernetes cluster on multiple linux nodes using kubeadm Refer Here
- We would be creating a 3 node kubernetes cluster
- Lets follow the installation guide Refer Here
- Install container runtime on the nodes. Lets use docker container Refer Here
- Now install kubeadm, kubectl and kubelet by following instructions Refer Here
- Now lets install pod network
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
![Preview](https://i2.wp.com/directdevops.blog/wp-content/uploads/2021/04/k8s7.png?w=800&ssl=1)
- Now lets login into the node become a root user and execute the kubeadm join command
kubeadm join 10.128.0.49:6443 --token <somtoken>
![Preview](https://i1.wp.com/directdevops.blog/wp-content/uploads/2021/04/k8s8.png?w=800&ssl=1)
- Now login into k8s master and execute
kubectl get nodes
- Summary of installation
- Install docker on the nodes (both) and execute the steps mentioned in Refer Here
- Install the kubeadm, kubelet and kubectl on both nodes Refer Here
- Now initialize the kubeadm by loggin in as root user on master node
kubeadm init
- Copy the commands to configure the kubectl and join command
- Now become the non root user and execute the following
- Now install a pod network on master node and verify if the node is in ready state by executing kubectl get nodes
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
- Now login into node and become root user (sudo -i) and execute the join command
- Now login into master node and execute kubectl get nodes to see the status of both nodes
- Install docker on the nodes (both) and execute the steps mentioned in Refer Here