Steps to install kubernetes cluster manually using CENTOS 7

Kube-install

Steps to install kubernetes cluster manually using CENTOS 7

In this blog, we will show you the Steps to install kubernetes cluster manually using CENTOS 7.

 

REQUIREMENTS

  • 3 Virtual Machine with an internet connection.
  • Kubenetes components

 

OVERVIEW

 

INFRASTRUCTURE OVERVIEW

Steps to install kubernetes cluster manually using CENTOS 7

 

  • We are creating two node cluster for this demo.
  • The Master IP will be 192.168.3.81.
  • Node 1 IP will be 192.68.3.82 and Node 2 IP will be 192.168.3.83.
  • We are using the Flannel Network for the POD communication in this demo.

 

Note: The VM IP’s may change based on your environment

 

MASTER SERVER CONFIGURATION

  • Log in to the master server and we have already set the hostname as k8s-master during OS installation.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Disable the SELinux using the below commands.

exec bash
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Open the sysctl.conf file.

vi /etc/sysctl.conf

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Add the below entries in the conf file to change the Linux host bridge values and save the changes.

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

Steps to install kubernetes cluster manually using CENTOS 7

 

  • open the fstab file.

vi /etc/fstab

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Disable the SWAP by adding the # symbol at the beginning and save the changes.

Steps to install kubernetes cluster manually using CENTOS 7

.

  • Restart the VM using the command init 6 to apply the SELinux and SWAP changes.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Once the VM is back to online, open the host file.

vi /etc/hosts

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Add the below entries in the host file and save the changes.

192.168.3.81 k8s-master
192.168.3.82 k8s-node1
192.168.3.83 k8s-node2

Steps to install kubernetes cluster manually using CENTOS 7

 

Note: The IP’s may change based on your environment

 

  • Create a new file named kubernetes.repo under yum.repos.d folder using the below command.

vi /etc/yum.repos.d/kubernetes.repo

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Add the below entries and save the changes.

[kubernetes]
name=Kubernetes
baseurl=
https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64


enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=
https://packages.cloud.google.com/yum/doc/yum-key.gpg

       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

Steps to install kubernetes cluster manually using CENTOS 7

 

INSTALLING DOCKER AND KUBEADM

  • Now, Install the docker and kubeadm using the below command.

yum install -y kubeadm docker

Steps to install kubernetes cluster manually using CENTOS 7

 

  • It will take few minutes to complete the installation.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Enable and start the docker and kubelet services using commands.

systemctl enable docker && systemctl enable kubelet
systemctl start docker && systemctl start kubelet

 

Steps to install kubernetes cluster manually using CENTOS 7

 

NODE(S) CONFIGURATION

  • We have already set the hostname for node1 and node2 during OS installation.

Steps to install kubernetes cluster manually using CENTOS 7

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Please follow the above master server configuration steps for the kubernetes node preparation. We have already installed the docker and kubeadm on both the nodes.

Steps to install kubernetes cluster manually using CENTOS 7

Steps to install kubernetes cluster manually using CENTOS 7

 

CREATING CLUSTER

  • We are using the Flannel network for this demo.
  • To make the flannel to working properly, we need to specify the network CIDR while configuring the cluster.  Use the below command to create a cluster.

kubeadm init --pod-network-cidr=10.244.0.0/16

Steps to install kubernetes cluster manually using CENTOS 7

 

  • It will take few minutes to complete the configuration process.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Kubernetes cluster has configured successfully.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Execute the below commands below start using the cluster.

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Also, make a note of the kubeadm join command to add the nodes into the cluster.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • We can list the available system PODS using the below command.

kubectl get pods --all-namespaces

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Kube-DNS will be in pending state until we install the POD network for the cluster.

 

INSTALLING NETWORK

  • Use the below command to install the Flannel network.

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

Steps to install kubernetes cluster manually using CENTOS 7

 

  • It will take few minutes to complete the installation.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • The flannel pod will start initiating and it will take few minutes to complete the configuration process.

Steps to install kubernetes cluster manually using CENTOS 7

 

  • We can get the detailed information about a POD using describe option.

kubectl describe pod <pod name> --namespace=kube-system

Steps to install kubernetes cluster manually using CENTOS 7

Steps to install kubernetes cluster manually using CENTOS 7

 

  • After some time, all the system pods are in running state.

Steps to install kubernetes cluster manually using CENTOS 7

 

ADDING NODES TO THE CLUSTER

  • From the node1 use the kubeadm join command to add the nodes into the cluster.

kubeadm join --token 878914.4587d610b5478141 192.168.3.81:6443 --discovery-token-ca-cert-hash sha256:6a23a6a7be997625f53e564a8b510627d035b000f9c288f7487fc9415c3338f1

 

Note: Token ID,IP and sha256 details will vary based on your environment

Steps to install kubernetes cluster manually using CENTOS 7

 

  • Node has been joined into the cluster successfully.

Steps to install kubernetes cluster manually using CENTOS 7

 

VERIFICATION

  • From the master server, type the below command to list the available nodes in the cluster.

kubectl get nodes

Steps to install kubernetes cluster manually using CENTOS 7

 

  • We can use the same kubeadm join command to add more nodes in future.

 

TIP

  • In case if you forget to make a note of kubeadm join information, use the below command from the master server to retrieve the join information.

kubeadm token create --print-join-command

Steps to install kubernetes cluster manually using CENTOS 7

 

EXTERNAL LINKS

https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/

VIDEO

Thanks for reading this blog. We hope it was useful for you to learn about installing kubernetes manually on CENTOS 7.

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn
More Interested Related Posts
zfs pool usage
ZFS Pool and Dataset Usage

I am back with another blog to provide the useful script to the Freebsd users to determine the zpool and it’s datasets usage report. This

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support