Setting up of Kubernetes master & node on AWS

Setting up of Kubernetes master & node on AWS

- Login to aws
- launch 3 instance
- ubuntu 16.04 (t2 medium)
- use puttygen, create private key and save
- access all the 3 instance (1 master, 2 nodes)
Commands common for master & node
- sudo su
- apt-get update
- apt-get install apt-transport-https

This https is needed for intra cluster command (particularly from control plane to individual pods)
Now install docker on all 3 instances
- apt install docker.io -y
- docker --version
- systemctl start docker
- systemctl enable docker

setup open GPG key. This is requires for intra cluster communication. It will be added to source key on this node. i,e when k8s sends signed info to our host, it is going to accept those information because this open GPG key is present in the source key.
- sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
Edit source list file (apt-get install nano)
- nano /etc/apt/sources.list.d/kubernetes.list
- deb http://apt.kubernetes.io/ kubernetes-xenial main
exit from nano -> ctrl+X -> caps+Y -> enter
-
apt-get update

apt-get install -y kubelet kubeadm kubectl kubernetes-cni

Bootstrapping the Master Node (in Master)
To initialize K8s cluster
- kubeadm init

You will get one long command started from "kubeadm join 172.76........." copy this command and save on notepad
create both .kube and its parent directories (-p)
- mkdir -p $HOME/.kube
Cpoy configuration to kube directory (in config file)

- sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

Provide permission to config file
- chown $(id -u):$(id -g) $HOME/.kube/config

Deploy flanned node network for its repository path. flannel is going to place a binary in each node
- kubectl apply -f [raw.githubusercontent.com/coreos/flannel/ma..

-](raw.githubusercontent.com/coreos/flannel/ma..-) kubectl apply -f [raw.githubusercontent.com/coreos/flannel/ma..

Configure](raw.githubusercontent.com/coreos/flannel/ma..Configure) worker nodes
- paste long command in both the nodes

Go to master
- kubectl get nodes

Did you find this article valuable?

Support Shishir Tambe by becoming a sponsor. Any amount is appreciated!