CentOS 7 Kubernetes Master-Node installation guide

CentOS 7 Kubernetes Master-Node installation guide - 1

Preparations

Three minimal installation Centos servers

one for K8S master node

two for K8S computing node

by the way my CentOS version is CentOS-7 x86_64 1810

Turn off firewalld && selinux

Config static ip address && set hosts

hostnameip address
k8smaster192.168.122.10
k8snode0192.168.122.11
k8snode1192.168.122.12
  • Master

  • Node0

  • Node1

Synchronize your system datetime

Disable SWAP

i didn’t set SWAP partition at CentOS installation, if you already set it, you should disable it.

Why disable swap on kubernetes

remove SWAP entry in /etc/fstab, reboot your system

Install docker

Install kubelet && kubeadm

Pulling Kubernetes docker images

if you got network problem in pulling docker images, you can set proxy with docker service

now go on

Deploy Kubernetes – Master

Kubeadm init

keep that string, it use for your node server join master K8S server

now check your master server

you have to create .kube config directory and put admin.conf in it

Pod Network – Flannel

now you already downloaded flannel yml file, change pod network to 10.244.0.0/20 at net-conf.json

Deploy Nodes

execute that join command in every nodes

now check in master server

gut, it works now.

Testing your kubernetes cluster

create hostnames pods

  • hostnames.yaml

  • hostnames-svc.yaml

create pod && pod service

see what you got

above you can see, three hostnames instances running on different server, also you can see hostnames got a service ip address 10.103.8.147, three instances but only have one service ip address, wich means it’s load balance

by the way kubernetes got dns server inside, you can also use domain name to access your pods

Something you have to know

Autocomplete does not work

make sure bash-completion package already installed in your system, then execute echo "source <(kubectl completion bash)" >> /etc/profile to add autocompletion, then reboot your system

Why Master server not schedule pods?

generally Kubernetes Master will not scheduling pods, but you can use command to open that feature look at below

Control plane node isolation

I lost kuberadm token, how to create new one?

One thought on “CentOS 7 Kubernetes Master-Node installation guide”

Leave a Reply

Your email address will not be published. Required fields are marked *