X
24Apr

How to do Installation of K8S using kubeadm?

Till now I have given blogs on k8s objects, services, namespaces, ingress etc. but where to execute and implement all those, yes, we need a k8s cluster for that, if you have it already go n execute, if not, here is the solution for you.

Execute below commands to configure the master node “(# are optional)”

  • sudo hostnamectl set-hostname master-node
  • sudo apt update
  • #clear
  • sudo apt install docker.io -y
  • sudo systemctl enable docker
  • curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
  • sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
  • sudo apt install kubeadm -y
  • sudo swapoff -a
  • sudo kubeadm init --pod-network-cidr=10.244.0.0/16
  • mkdir -p $HOME/.kube
  • sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  • sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
  • kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
  • #clear
  • kubectl get nodes
  • watch kubectl get nodes
  • kubectl get nodes -o wide
  • #history ---> for future purpose record

Execute below commands to configure on worker node

  • sudo hostnamectl set-hostname node1
  • sudo apt update
  • #clear
  • sudo apt install docker.io -y
  • sudo systemctl enable docker
  • #clear
  • curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
  • sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
  • sudo apt install kubeadm -y
  • sudo swapoff -a
  • following command will have different options in your case, that command will comeup on the screen itself      #kubeadm join 172.31.36.112:6443 --token sop568.8zzj0emko8sa4o0s     --discovery-token-ca-cert-hash sha256:35fc8b66d2e57eb56f73247fa16bcc44220b975994ec99e61af8caa74b22788d

 

if you want configure multiple worker nodes or master nodes, execute the set of commands respectively in other nodes as well,

if you wantdon’twant toconfigure and manage the cluster, go with cloud managed especially AKS, why cloud managed and why AKS; follow the link for one ofmy previous blog

https://ecanarys.com/Blogs/ArticleID/370/Difference-Between-K8S-vs-Azure-Kubernetes-Service-AKS

 

Related

Quick Understanding on Stateful Sets in Kubernetes

Stateful sets are similar to deployments, they can scale up and scale down, they can perform rolling...

Read More >

HOW TO DO BACKUP AND RESTORE ENTIRE K8S CLUSTER?

If you have deployed different applications on k8s cluster using various objects like deployments, p...

Read More >

Taints and Tolerations

Taints and tolerations are used to restrict the pods to schedule them onto respective nodes. There i...

Read More >

NODE AFFINITY

The k8s node affinity feature is to ensure pods are hosted on a particular node. As mentioned in pre...

Read More >

What is ingress and what are the components of it?

Ingress is a resource, which exposes the http and https from external sources to the services within...

Read More >

Kubernetes RBAC (Role Based Access Control)

The Kubernetes RBAC (role bases access control) system helps us in defining set of rules in controll...

Read More >

Namespaces in Kubernetes

A default namespace is created automatically when the cluster is being setup. To isolate or prevent ...

Read More >

Kubernetes basic Objects

In this article, we will learn about the basic objects of Kubernetes in detail with their respective...

Read More >

Difference Between K8S vs Azure Kubernetes Service (AKS)

Kubernetes aka K8s is container orchestration tool, which helps us to control our containers in the ...

Read More >

Share

Post a Comment

  • Recent
  • Popular
  • Tag
Monthly Archive
Subscribe
Name

Text/HTML
Text/HTML
Contact Us
  • *
  • *