DevOps (K) Classroom Series – 05/Sept/2021

Kubernetes Installation

  • There are many different ways of installing kuberentes and also kuberentes is readily available as a Service on Cloud (Azure Kuberentes Service, Elastic Kuberentes Service, Google Kubernetes Engine)
  • To start with we would be using kubeadm as an approach to create a kubernetes cluster
  • Refer Here for the installation instructions
  • Lets create 3 ubuntu servers
  • Now install docker on the three servers and then execute the commands as mentioned in the document Refer Here
  • Now install Kube-adm, kubectl and kubelet Refer Here
  • Now we can create cluster using kubeadm Refer Here
  • Login into the master node
sudo -i
kubeadm init --pod-network-cidr=10.244.0.0/16
  • Make a note of the instructions given which appear as shown
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following 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

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 172.31.37.90:6443 --token q331we.xj6o2j07sy066v1r \
        --discovery-token-ca-cert-hash sha256:e281cbdb4c7de0c621e78d42d88b2bfb7d64d454afc56d3090dca3966be76ae3
  • Now exit from root user to become normal user and execute the following commands 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
  • Now login into the nodes and execute the kubeadm command as a root user
  • Now login into kuberentes (k8s) and execute kubectl get nodes
  • Now execute the following command to install pod network plugin
kubectl apply -f https://github.com/coreos/flannel/raw/master/Documentation/kube-flannel.yml

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%