It is an open source platform used to deploy, manage and maintain a group of containers. it is an Ubuntu based platform. It is used most commonly together with Docker for better control of containerized applications.
- I assume you know how to deploy a virtual machine ๐ฅ Ubuntu preferably.
- basic knowledge of the linux file system | ownership | permissions ๐ง
- basic knowledge of git ๐ฆ
- stable internet connection (very important)โ๏ธ
- How to use linux editor
vim
or at leastnano
๐ - a cup of coffee โ๏ธ
We will be installing and updating the apt repository before installing any package
sudo apt-get update
swapoff -a
Now that our installer is up to date, next is to use following command to install packages using https
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
Next is to install Docker with the following commands
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Now let's set up the repo with the following command
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Run this command to update the package:
sudo apt-get update
Containerd is an important component for kubernetes to function, run ''' sudo apt install containerd.io ''' Open the /etc/containerd/conf.toml file, and comment out disabled_plugins
''' nano /etc/containerd/conf.toml ''' As it's in the output below:
After installing Docker with the above step, Let's restart containerd service
sudo systemctl restart containerd.service
Next is to install kubernetes using the following commands. ''' sudo apt-get install -y apt-transport-https ca-certificates curl '''
Download the Google Cloud public signing key:
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg| sudo apt-key add
Let's add the Kubernetes APT repository with: ''' echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list '''
Let's install kubernetes components with
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni
sudo apt-mark hold kubelet kubeadm kubectl
The hold flag would prevent updates to the kubernetes components installed.
Next is to do
nano /etc/sysctl.conf
to uncomment the line below
Followed by this command to confirm
sysctl -p
Also run this command which works intelligently to add any dependent modules automatically.
sudo modprobe br_netfilter
All the above are run on all the 3 nodes ( one master and 2 workers ).
Next is to Initialize the master node using the following command: NOTE- YOU NEED TO REPLACE YOUR MASTER NODE IP ADDRESS BELOW
kubeadm init --pod-network-cidr 10.244.0.0/16 --apiserver-advertise-address=120.31.12.56
To start using the cluster, Exit root user, we need to run the following
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Use the command below to list the nodes ''' kubectl get nodes '''
we need to install a network solution using the following command: This will help to manage the clusters network.
# Install Weave Net
kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml
#List the necessary dependency as they start running on the control plane
kubectl get pods -n kube-system
To see all the nodes and show that master node is ready, run
kubectl get nodes
The last step is to configure the worker nodes.
Join the worker node to the master node/control plane from the picture below which we got when we initialize kubeadm for the master mode earlier on
and i debugged it with This