Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
kubernetes installation using kubeadm
OS Required: Ubuntu 16 - xenial
Master node creation
---------------------------
Step 1: (optional)
sysctl net.bridge.bridge-nf-call-iptables=1
Step2:
apt-get update && apt-get install -y apt-transport-https
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
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-get install docker.io
apt-get install docker
systemctl start docker.service
systemctl status docker.service # check the status of the docker service
Step3: Creating a master node by initializing using kubeadm
kubeadm init --pod-network-cidr=10.244.0.0/16
Step4: To start using your cluster, you need to run (as a regular user):
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Step5: copy the join token to a text editor
Creation of a worker node
---------------------------
Step 1:(optional)
sysctl net.bridge.bridge-nf-call-iptables=1
Step2:
apt-get update && apt-get install -y apt-transport-https
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
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-get install docker.io
apt-get install docker
systemctl start docker.service
systemctl status docker.service # check the status of the docker service
Step3: kubeadm join --token <token> <master-ip>:<master-port> --discovery-token-ca-cert-hash sha256:<hash>
Network Creation using Flannel
--------------------------------------
Step 1: Enter into master node
Ste2: Check the status of the node using the following commands
Kubectl get nodes # Nodes will be showing NotReady due to the abscence of network creation settings
Step3:
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.0/Documentation/kube-flannel.yml
Step4: Check the status of the node using the following commands
Kubectl get nodes # Now the status of the node will be changed to Ready
|-------------------------------------------------------------------------------|
| Your Cluster is ready ..... Happy coding and deployment :-)) |
|-------------------------------------------------------------------------------|
For any doubts reachout to me
Follow me on Twitter for further updates:
https://twitter.com/rahulkrishnanra
Owner

rahulkrishnanfs commented Nov 2, 2017

Reset the cluster

sudo kubeadm reset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment