install k8s master
#!/bin/bash
#the script install basic k8s ..in worket withot script master
echo "install k8s worker on ubuntu"
#Add host entry for master as well as worker node
sudo chmod 777 /etc/hosts #for lince file
sudo echo "100.0.0.1 master.jhooq.com master" >> /etc/hosts
sudo echo "100.0.0.2 worker.jhooq.com worker" >> /etc/hosts
sudo chmod 644 /etc/hosts
#Step 3 - Install Docker on both master and worker node
sudo apt-get update -y
#install docker
sudo apt install docker.io -y
sudo systemctl enable docker.service
sudo systemctl start docker
#Step 4 - Disable the firewall and turnoff the “swapping”
sudo ufw disable
sudo swapoff -a
#Step 5 - Install “apt-transport-https” package
sudo apt-get update && sudo apt-get install -y apt-transport-http
#Step 6 - Download the public keys
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
#Step 7 - Add kubernetes repo
sudo bash -c 'echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list'
#Step 8 - Install kubernetes
sudo apt-get update && sudo apt-get install -y kubelet kubeadm kubectl
#Step 9 - Enable and Start kubelet
sudo systemctl enable kubelet
sudo systemctl start kubelet
#the end file meto
sudo echo "this completed thx meto"
ech ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>install on master>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
#the script install basic k8s ..for master
echo "install k8s master on ubuntu"
# Step 10 - Initialize the kubernetes cluster
sudo kubeadm init --apiserver-advertise-address=100.0.0.1 --pod-network-cidr=10.244.0.0/16
#Step 11 - Move kube config file to current user (only run on master)
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
#Step 12 - Apply CNI from kube-flannel.yml(only run on master)
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
ip a s
#note meto
echo "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< section for note onle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo "edite this file >>>> nano kube-flannel.yml"
echo "Searche for - “ flanneld ” "
echo "n the args section add: - -iface=eth1 "
echo "under this - --kube-subnet-mgr"
echo "for example"
echo " - --kube-subnet-mgr"
echo "- --iface=eth1"
echo "before this "
echo "kubectl apply -f kube-flannel.yml"
echo "paste command in below on worker dont forget that"
echo "this complet install k8s master run this command kubectl get nodes"