Installing the Components of a Kubernetes Cluster
In this post, we build a test cluster from scratch in order to check the installed components of the cluster and execute some deployments.
Prerequisites:
- Operating System Ubuntu 18.04.4
- One Master Node
- <N> Worker Node
- Internet connection to pull binaries and repositories
- Sudo access for user
Steps:
- Install the container runtime, as well as kubeadm, kubectl, and kubelet
- Initialize the cluster
- Add CNI Flannel
- Add Nodes to cluster
Kubernetes Components
Control Plane Components:
Control plane components typically run on Master node and make global decisions like scheduling pod, detecting, and responding cluster events, etc.
- kube-apiserver: Expose the Kubernetes API.
- etcd: Consistent and highly-available key-value store used as Kubernetes’ backing store for all cluster data.
- kube-scheduler: Watch newly created pods and schedule them on a suitable node.
- kube-controller-manager:
- Node controller
- Replication controller
- Endpoints controller
- Service Account & Token controllers
-
cloud-controller-manager: Cloud-specific control logic.
Node Components:
Node components run on every node, maintaining running pods and providing the Kubernetes runtime environment.
- kubelet: An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.
- kube-proxy: Network proxy that runs each node.
- container-runtime: Responsible for the running containers.
Installation
Step 1: Add docker and kubernetes repositories for Master and Worker nodes
You should run the following command sets on all three nodes to get gpg keys and add repositories.
#curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - #sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" #curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - #cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF #sudo apt-get update
Step 2: Install docker, kubelet, kubeadm and kubectl for Master and Worker nodes
Perform these steps for all nodes in the cluster. If you need to install specific version of any component you can change it as you wish. Also, it's possible to check the latest version with "apt list" command.
#apt list docker-ce #sudo apt-get install -y docker-ce=5:19.03.8~3-0~ubuntu-bionic kubelet=1.18.2-00 kubeadm=1.18.2-00 kubectl=1.18.2-00
Step 3: Initialize Cluster
Run the following command in the master node to initialize the Kubernetes cluster. You should disable swap before running this step. "192.168.56.102" is private ip address of master server.
#sudo kubeadm init --apiserver-advertise-address 192.168.56.102 --pod-network-cidr=10.225.0.0/16 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 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 192.168.56.102:6443 --token 1aa23n.cv2v8moy1eplc67e \ --discovery-token-ca-cert-hash sha256:223ef1bf2d71a8bae2f0a05f02ec165efd4601aa4627dfd4dbaaf2a7dabbf887 root@master01:~#
Swap Error:
#sudo kubeadm init --apiserver-advertise-address 192.168.56.102 --pod-network-cidr=10.225.0.0/16 W0506 22:33:57.562106 7930 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io] [init] Using Kubernetes version: v1.18.2 [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR Swap]: running with swap on is not supported. Please disable swap [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher
Step 4: Setup Default Configuration on Master node
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Step 5: Install Flannel for the Pod Network (On Master Node)
#kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/2140ac876ef134e0ed5af15c65e414cf26827915/Documentation/kube-flannel.yml
# kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE coredns-66bff467f8-26wzg 0/1 Pending 0 16m coredns-66bff467f8-8xcph 0/1 Pending 0 16m etcd-master01 1/1 Running 0 16m kube-apiserver-master01 1/1 Running 0 16m kube-controller-manager-master01 1/1 Running 0 16m kube-flannel-ds-amd64-vhmmv 1/1 Running 0 20s kube-proxy-882x2 1/1 Running 0 16m kube-scheduler-master01 1/1 Running 0 16m
Step 6: Join Worker nodes to the cluster
root@worker01:~# kubeadm join 192.168.56.102:6443 --token 1aa23n.cv2v8moy1eplc67e --discovery-token-ca-cert-hash sha256:223ef1bf2d71a8bae2f0a05f02ec165efd4601aa4627dfd4dbaaf2a7dabbf887 W0506 23:19:11.241333 19433 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set. [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Starting the kubelet [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster. root@worker01:~#
Components and Cluster Status
Check components status:
root@master01:~# kubectl get cs NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok etcd-0 Healthy {"health":"true"}
Check cluster information:
root@master01:~# kubectl cluster-info Kubernetes master is running at https://192.168.56.102:6443 KubeDNS is running at https://192.168.56.102:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. root@master01:~# # kubectl version --short Client Version: v1.18.2 Server Version: v1.18.2
Check node information:
root@master01:~# kubectl get nodes -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME master01 Ready master 34m v1.18.2 192.168.56.102 <none> Ubuntu 18.04.4 LTS 5.3.0-28-generic docker://19.3.8 worker01 Ready <none> 32m v1.18.2 192.168.56.103 <none> Ubuntu 18.04.4 LTS 5.3.0-28-generic docker://19.3.8
Check controller-manager version:
root@master01:~# kubectl get pod kube-controller-manager-master01 -o yaml -n kube-system|grep image: f:image: {} image: k8s.gcr.io/kube-controller-manager:v1.18.2 image: k8s.gcr.io/kube-controller-manager:v1.18.2
Check kubeadm version:
root@master01:~# kubeadm version kubeadm version: &version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2", GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean", BuildDate:"2020-04-16T11:54:15Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Run a deployment check if the application is running on pod:
root@master01:~# kubectl create deployment nginx --image=nginx deployment.apps/nginx created root@master01:~# kubectl get pods NAME READY STATUS RESTARTS AGE nginx-f89759699-2cxgc 0/1 ContainerCreating 0 6s root@master01:~# kubectl port-forward nginx-f89759699-2cxgc 8081:80 & [1] 29150 root@master01:~# Forwarding from 127.0.0.1:8081 -> 80 Forwarding from [::1]:8081 -> 80 root@master01:~# curl -s -v http://127.0.0.1:8081
generac viagra order viagra with pay pal buy generic viagra canada http://llviabest.com/ - viagra in hamburg ’
viagra paypal buy viagra onoine viagra australia http://genqpviag.com/ - viagra professional sublingual ’
viagra pill viagra side effect or addiction where i can get viagra in sydney
pharmacies in canada pharmacies shipping to usa Cialis Professional
compare prescription prices pharmacies drug costs
buy prescription drugs without doctor canadian rx pharmacy online rx price comparison
online medicine shopping aarp recommended canadian pharmacies canada pharmacy online orders
how much do viagra cost canada pharmaceuticals online viagra online australia
northwest pharmacy/com prescription less viagra north west pharmacy canada
starting cash loans business south africa 1st stop payday loans existing customer payday loans clayton ga
cialis-farmaco.com cialis levitra viagra review alternating cialis and viagra
ace check cashing loan reviews payday 2 cash hilesi list of payday loan lenders uk no credit check
sunny cash loan review payday loans rifle co cash advance lynn haven fl
fast cash loans malaysia cash advance rhode island payday loan max interest
is cialis time release vente cialis en ligne cialis 20 prix en pharmacie
sildenafil 110 mg capsule http://vigedon.com/ viagra 100 buy online
online viagra prescription http://viagraonlinejc.com/ viagra with alcohol
Does your site have a contact page? I'm having a tough time locating it but, I'd like to shoot you an e-mail. I've got some recommendations foor your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it grow over time. https://clients1.google.com.mm/url?q=https://bestwwwkratom.com Wilhelmina Monty https://clients1.google.mv/url?q=https://kratomwwwtea.com
generic cialis mastercard http://buycialisxz.com/ dgeneric cialis
heartguard ivermectin ivermectin coronavirus 1.87 ivermectin paste for dogs what parasites does ivermectin kill
ventolin prescription albuterol price uk is ventolin same as albuterol how to take albuterol inhaler
soolantra ivermectin price of stromectol how to give ivermectin to dogs what parasit is resistant to ivermectin
maculopapular rash amoxicillin where to buy amoxicillin pharmacy can i take amoxicillin with ibuprofen how many days to take amoxicillin 500mg
ventolin jarabe albuterol cost in mexico ventolin inhaler for sale online what is albuterol sulfate
furosemide water pill furosemide 20 mg price furosemide 20 mg pill identification how to adjust dosage of furosemide for dogs
amoxicillin with alcohol amoxicillin 500 mg capsules can a dog take amoxicillin what to do if you miss a dose of amoxicillin
lasix and breastfeeding furosemide price furosemide for high blood pressure what should you eat when taking furosemide?
zithromax and alcohol zithromax 250 cost can zithromax treat a uti what is the medicine azithromycin used for
zithromax 500mg buy azithromycin 1000mg what is zithromax z pak how long does azithromycin take
online clomid cheap clomid tablets uk how much does clomid cost how much clomid should a man take
doxycycline cystic acne buy vibramycin what is doxycycline hyc 100mg used for how long to have lyme to take doxycycline
prednisolone ointment prednisolone prednisone prednisolone suppositories for ulcerative colitis what is the difference prednisolone sodium phosphate vs prednisolone acetate
buying doxycycline online doxycycline 100 mg cap doxycycline treatment for lyme disease how long does it take doxycycline to leave your system
androxal vs clomid where can you buy clomid clomiphene citrate (clomid) when do i start taking clomid
steroids prednisolone generic prednisolone otc can prednisolone reduce pain in dogs how long before prednisolone 5mg works in dogs
https://dissertationahelp.com/ - dissertation phd dissertation statistics help cheap dissertation help dissertation abstract
priligy in canada generic priligy australia onde posso encontrar remedio priligy em usa what does dapoxetine look like
https://thesisacloud.com/ - thesis search doctoral thesis help thesis writing service thesis help online
https://thesisacloud.com/ - thesis help free thesis topics in education thesis publishing phd online
http://essaywriteris.com/ - best online essay writer cheap essays to buy can i get someone to write my essay essay writer reviews
https://thesisacloud.com/ - proquest thesis search thesis paper writing thesis editing service college thesis
dangers of propecia generic propecia from canada how many years is propecia effective where can i get propecia no prescription
prednisolone dexamethasone difference 100mg prednisolone hitech prednisolone buy online canada how does prednisolone help with mast cell cancer
neurontin muscle pain cost of gabapentin 400 mg can you die from neurontin how to get high on gabapentin
how metformin works buy metformin 500 mg uk metformin over the counter walmart how much b12 should i take with metformin
xanax and paxil buy paroxetine australia side effects of getting off paxil what are the effects of taking paxil and mobic
https://thesiswritingtob.com/ - thesiswritingtob.com thesis proposal help thesiswritingtob.com thesis defense advice
plaquenil and sulfa plaquenil price what is plaquenil 200 mg used for who make plaquenil
generic viagra pills: viagra pills pills for erectile dysfunction https://edpillsonline24.com/# erectile dysfunction pills
male erectile pills: kamagra pills viagra pills https://edpillsonline24.com/# ed pills
cialis pills online: best erectile dysfunction pills review male erectile pills https://edpillsonline24.com/# erectile pills canada
viagra otc buy viagra online without prescription no prescription viagra https://swdprescription.com/# buy viagra without prescription
viagra doses 200 mg buying viagra online without prescription viagra without a doctor prescription usa https://swdprescription.com/# buy viagra online without prescription
buy viagra online viagra no prescription buying viagra online without prescription https://swdprescription.com/# viagra prescription
viagra generic viagra without a doctor prescription usa viagra without a doctor prescription usa https://swdprescription.com/# viagra without a doctor prescription
viagra canada no prescription viagra viagra without a doctor prescription usa https://swdprescription.com/# viagra without prescription
how to get viagra without a doctor viagra prescription no prescription viagra https://swdprescription.com/# buy viagra online without prescription
over the counter viagra cvs viagra without a doctor prescription viagra without a doctor prescription canada https://swdprescription.com/# viagra no prescription
viagra for sale viagra without prescription viagra prescription https://swdprescription.com/# buy viagra online without prescription
viagra without a doctor prescription buy viagra without prescription buy viagra online without prescription https://swdprescription.com/# no prescription viagra
viagra price comparison viagra without a doctor prescription no prescription viagra https://swdprescription.com/# viagra without prescription
buy generic 100mg viagra online no prescription viagra buy viagra without prescription https://swdprescription.com/# buy viagra online without prescription
https://amoxilst.com/# amoxicillin 500mg price in canada
https://amoxilst.com/# amoxicillin 500mg prescription
http://clomidst.com/# clomid canada
https://doxycyclinest.com/# buy doxycycline without prescription
https://clomidst.com/# online clomid
https://amoxilst.com/# price of amoxicillin without insurance
https://doxycyclinest.com/# doxycycline order online
http://amoxilst.com/# can you buy amoxicillin uk
https://diflucanst.com/# can i buy diflucan from canada
https://doxycyclinest.com/# doxycycline medication
http://amoxilst.com/# amoxicillin 500mg price
https://clomidst.com/# clomid for men
clomid generic name purchase clomid online and clomid pills and clomid alcohol and buy clomid online and clomiphene generic http://caymanshoresdevelopment.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://1-800date.com/__media__/js/netsoltrademark.php?d=clomidst.com http://internationallight.org/__media__/js/netsoltrademark.php?d=clomidst.com http://cinemadelux.biz/__media__/js/netsoltrademark.php?d=clomidst.com&popup=1 http://raywild.com/__media__/js/netsoltrademark.php?d=clomidst.com/
buy clomid online no prescription generic for clomid and cheap clomid and clomid 2020 and order clomid and clomid purchase online http://isnotis2.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://www.chinamusicbookshop.com/bbs/home.php?mod=space&uid=619840 https://qmwe.xyz/home.php?mod=space&uid=741722 http://ky.sgz8.com/home.php?mod=space&uid=371663 https://gevezesohbet.com.tc/members/48160.html
clomiphene for sale clomid medication and clomid online and clomid buy and clomid price and clomid purchase http://niubi.gg/home.php?mod=space&uid=411751 http://www.fxwenxue.com/home.php?mod=space&uid=227082 http://clearanceuk.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://turpaahjul.com/forum/member.php?1881658-jblmotkl http://www.sj868.cn/home.php?mod=space&uid=909590
clomid tablet clomid for sale and purchase clomid and clomid buy and buy clomid online without prescription and buy clomid online http://anchmedsurg.com/__media__/js/netsoltrademark.php?d=clomidst.com https://forum.lsbclan.net/index.php?action=profile;u=103475 http://www.questrecruitment.co.nz/ra.asp?url=https://clomidst.com http://coatingsinspection.com/__media__/js/netsoltrademark.php?d=clomidst.com http://thesingaporesting.com/__media__/js/netsoltrademark.php?d=clomidst.com
clomid without prescription buy cheap clomid and buy clomid 50mg and cost of clomid and clomid online cheap and order clomid http://environmentalscreenprinters.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://afterschoolpro.net/__media__/js/netsoltrademark.php?d=clomidst.com/ http://garciasmartcar.com/__media__/js/netsoltrademark.php?d=clomidst.com http://www.copperpages.com/redir.asp?id=97921&account=0§ion=13&url=https://clomidst.com http://nqbtv.com/home.php?mod=space&uid=3148599
clomid 100mg clomid order online and cheap clomid and cost of clomid and clomid tablet and generic for clomid http://allwineallthetime.com/__media__/js/netsoltrademark.php?d=clomidst.com http://xchip.org/__media__/js/netsoltrademark.php?d=clomidst.com http://fishcasslake.com/__media__/js/netsoltrademark.php?d=clomidst.com http://allenbjones.com/__media__/js/netsoltrademark.php?d=clomidst.com http://www.jswz8.com/space-uid-725676.html
clomid online clomiphene tablets and clomid for sale and order clomiphene and price of clomid and buy clomid online without prescription http://www.hyphoto.net/space-uid-918408.html http://circustube.com/te/out.php?u=https://clomidst.com http://signatureeurope.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://telavivnightlife.com/__media__/js/netsoltrademark.php?d=clomidst.com http://rolldownshutterrepair.com/__media__/js/netsoltrademark.php?d=clomidst.com/
no prescription clomid clomiphene tablets and buy cheap clomid and clomid alcohol and clomid tablets and cheap clomid http://shahcommunications.net/__media__/js/netsoltrademark.php?d=clomidst.com/ http://i-secq.net/__media__/js/netsoltrademark.php?d=clomidst.com http://anchmedsurg.com/__media__/js/netsoltrademark.php?d=clomidst.com/ http://mahalodrinks.com/__media__/js/netsoltrademark.php?d=clomidst.com http://ticketpoints.com/__media__/js/netsoltrademark.php?d=clomidst.com
how to get metformin without prescription: metformin 125 mg - metformin 1000 mg from canada http://edpillsonline24.online/# ed pills that really work
lasix 20 mg: lasix - lasix 100mg http://lasixst.com/# lasix for sale
real metformin mexico: metformin prices canada - metformin 250 mg price in india https://lasixst.com/# lasix for sale
lasix generic name: lasix generic - lasix 100mg http://edpillsonline24.online/# ed medications