Skip to content

Instantly share code, notes, and snippets.

@chandankumar4
Last active January 30, 2019 14:37
Show Gist options
  • Save chandankumar4/92d0bba075d85fb75ffd81cad5c8b8d2 to your computer and use it in GitHub Desktop.
Save chandankumar4/92d0bba075d85fb75ffd81cad5c8b8d2 to your computer and use it in GitHub Desktop.

For each nodes

Installing Docker

sudo apt-get update
sudo apt-get install -y docker.io

Installing kubeadm, kubelet and kubectl

sudo apt-get update && sudo apt-get install -y apt-transport-https curl
sudo -i
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
exit
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl

Configure cgroup driver used by kubelet on Master Node only

sudo sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

Then restart kubelet:

sudo systemctl daemon-reload
sudo systemctl restart kubelet

Initializing your master only

sudo kubeadm init --apiserver-advertise-address=<master-private-ip> --apiserver-cert-extra-sans=10.0.2.15 --pod-network-cidr 10.1.0.0/16
sudo mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo KUBECONFIG=/etc/kubernetes/admin.conf
kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml

In worker nodes only

sudo kubeadm join --token <token> <master-ip>:<master-port> --discovery-token-ca-cert-hash sha256:<hash>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment