Kubernetes multinode cluster deployment on Centos/Redhat 7.2/7.3

If you ever work with containerized applications in cluster environment then the much complicated task is to manage number of nodes over your complete infrastructure .

Kubernetes  is an opensource cluster management  system developed by Google which automates deployment , operations and scaling for containerized applications .

Note:   for container orchestration there are lots of tool in the market like

1.  Docker Swarm
2.  Google Kubernetes
3.  Rancher





component of kubernetes :

As given in above example there are two  main physical nodes in kubernetes

1. Kubernetes master
2. Kubernetes nodes

Important :   Inshort kubernetes is :



Internal architecture :

Kubernetes Master  architecture is pretty simple which can control one or more nodes .

Kubernetes  Master :    the controller of complete cluster can manage all the nodes where pods are spawned

kubernetes master components:


  1. kube-apiserver   :-->>  
  2. kube-scheduler
  3. kube-controller-manager

Kuberenetes  Nodes components:

  1.  kubelet
  2. kube-proxy
Important :   kubectl  is the command line interface can be placed any where even outside the cluster

kubectl  :     used by master to monitor the nodes and schedule the pods 
kube-proxy :   enable  software loadbalancing and services paradigm
kube-apiserver :   provides API  for kubernetes orchestration
kube-control-manager:  enforces kubernetes kubernetes services
kube-scheduler :   schedule containers on each hosts 

Etcd :    its a distributed set of key and value pair which store data persistently and accessible through the RESTful  API  

written in GO and uses RAFT consensus algorithm 

flannel :   It is virtual networking that gives a subnet to each hosts for use with containers during run time 





Setting up kubernetes cluster  


Master Node :  station107.example.com
Minion 1:    station108.example.com


Prequistes :

stop or manage firewall rules on each nodes

[root@station107 ~]# systemctl stop firewalld 
[root@station107 ~]# systemctl disable  firewalld 


Note:  make sure your dns is working fine and each node can reach eachothers by name and ip


Setting  up Master node :

Step 1:  Installing  all the required software

[root@station107 ~]# yum  install kubernetes kubernetes-nodes kubernetes-client  kubernetes-master etcd  docker docker-common docker-client

Important :  kubernetes works with docker not with docker-engine

Note:  flannel you don't need to install on master node because pods will not run on master nodes

Step 2:  configure kubernetes cluster configuration

i) configure etcd  file make these changes 


[root@station107 ~]# vim  /etc/etcd/etcd.conf

ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379"


ii)  configure kubernetes apiserver file 

[root@station107 ~]# vim  /etc/kubernetes/apiserver 


# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"

# The port on the local server to listen on.
KUBE_API_PORT="--port=8080"

# Port minions listen on
KUBELET_PORT="--kubelet-port=10250"

# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://station107.example.com:2379"

# Address range to use for services  this ip leave this as it is
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"

# default admission control policies
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"

# Add your own!
KUBE_API_ARGS=""


iii)  this optional for master node 

[root@station107 ~]# vim  /etc/kubernetes/config 

# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.10.107:8080"


iv)  Define flannel configure in etcd . This will be pulled by flannel service on the minions 

[root@station107 ~]# etcdctl  mk  /atomic.io/network/config  '{"Network":"172.17.0.0/16"}'


Step 3 :  Start  all the required services 

[root@station107 ~]# for  i  in  etcd kube-apiserver  kube-controller-manager kube-scheduler > do
> systemctl start  $i
> systemctl  enable  $i
> done

Now Setting up kubernetes  nodes  (minions)

Step 1:  Installing  all the required software


[root@station108 ~]# yum  install  flannel kubernetes  docker

Step 2:  making configuration file

i)  give path to load network from master 

[root@station108 ~]# vim  /etc/sysconfig/flanneld 
FLANNEL_ETCD="http://station107.example.com:2379"

ii)  How to connect with kubernetes master 

[root@station108 ~]# vim   /etc/kubernetes/config

# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.10.107:8080"

iii) kubelet service on each minions 

[root@station108 ~]# vim   /etc/kubernetes/kubelet

KUBELET_ADDRESS="--address=0.0.0.0"

# The port for the info server to serve on
# KUBELET_PORT="--port=10250"

# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=station108.example.com"

# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.10.107:8080"

# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"

# Add your own!
KUBELET_ARGS=""


Step 3: starting all the services 

[root@station108 ~]# for  i  in  kube-proxy  kubelet docker flanneld 
> do
> systemctl  start  $i
> systemctl  enable  $i
> done



Now Go to Your Master Node and check for  minions 


[root@station107 ~]# kubectl get nodes
NAME                     STATUS    AGE
station108.example.com   Ready     2h


 Enjoy technology by Google 

Comments

  1. Hey thanks for this amazing post! Thank you so much for sharing the good post, I appreciate your hard work.Keep blogging.
    DevOps Training in Electronic City

    ReplyDelete
  2. Fantastic resource!

    Azure Data Engineer Training

    Quality Thought offers comprehensive Microsoft Azure Data Engineer Training designed to prepare learners for modern data engineering roles. The curriculum covers Azure Data Factory, Azure Synapse Analytics, Azure Databricks, Azure Storage, ETL and ELT pipelines, data warehousing, stream processing, and security best practices.
    Students gain practical experience through hands-on labs, case studies, and industry-oriented projects that mirror real-world cloud data environments. The training emphasizes scalable architecture, efficient data processing, and analytics using Microsoft Azure services.
    Suitable for both beginners and experienced professionals, the course includes expert mentoring, certification guidance, resume building, mock interviews, and placement assistance. Learn more at https://qualitythought.in/azure-data-engineer-training/. For admissions, call 09121188426 or visit 3rd Floor, Metro Station Ameerpet, ADITYA ENCLAVE, 303, behind Ameerpet, Ameerpet, Hyderabad, Telangana 500016.


    ReplyDelete
  3. Great Article!
    Data Analytics Training with Placement in Hyderabad | Quality Thought
    Join Data Analytics Training with Placement at Quality Thought in Hyderabad. Call 07330999080. https://qualitythought.in/data-analytics-training-course/ | Metro Station, Nilgiri Block, ADITYA ENCLAVE, 307 B, 3rd Floor, behind Ameerpet, Hyderabad.

    ReplyDelete
  4. Nice!
    Learn Data Analytics

    Learn Data Analytics at Quality Thought with live projects, expert trainers, and placement assistance. Hyderabad | https://qualitythought.in/data-analytics-training-course/ | Call: 07330999080 | Metro Station, Nilgiri Block, ADITYA ENCLAVE, 307 B, 3rd Floor, behind Ameerpet, Ameerpet, Hyderabad, Telangana 500038

    ReplyDelete

Post a Comment