Kubernetes Tutorial - How to Setup a Multi Node Kubernetes Cluster?

  Рет қаралды 6,493

Cloud Guru

Cloud Guru

2 жыл бұрын

This tutorial will explain how to setup a multi node Kubernetes Cluster.
Topics covered:
0.00 Introduction
3:36 Use Case
6:48 VirtualBox Configuration
10:32 Install Ubuntu 20.04 VirtualBox
16:40 K8S Installation and Configuration
27:28 Joining Worker nodes
30:05 Testing the setup
Downloadables:
VirtualBox - www.virtualbox.org/wiki/Downl...
Ubuntu Server 20.04 LTS - ubuntu.com/download/server (Choose Option 3)
SSH Client - mobaxterm.mobatek.net/downloa...
=========================
Commands used in the Video:
=========================
1.Update the package repository (All hosts)
sudo apt-get update
2. Install Docker (All hosts)
sudo apt-get install docker.io -y
3. Access Repos via HTTPS (All hosts)
sudo apt-get install apt-transport-https curl -y
4. Add K8S key and Repo (All hosts)
curl -s packages.cloud.google.com/apt... | sudo apt-key add -
cat (ADD 2 "LESS THAN" SIGNS HERE WITHOUT BRACKETS)EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb apt.kubernetes.io/ kubernetes-xenial main
EOF
5. Update the package repository and Install K8S components (All hosts):
sudo apt-get update
sudo apt-get install -y kubelet=1.18.1-00
sudo apt-get install -y kubeadm=1.18.1-00
sudo apt-get install -y kubectl=1.18.1-00
sudo apt-mark hold kubelet kubeadm kubectl
6. Add the hosts entry (All hosts)
edit the file "/etc/hosts"
7. Disable SWAP (All hosts)
sudo swapoff -a
edit /etc/fstab to remove the swap entry
8. Initiate the Cluster(Only on Master node)
sudo kubeadm init --control-plane-endpoint kube-master:6443 --pod-network-cidr 10.10.0.0/16
9. Set the kubectl context auth to connect to the cluster(Only 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
10. Pod Network Addon(Calico) (Only on Master node)
Ref: docs.projectcalico.org/gettin...
curl docs.projectcalico.org/manife... -O
vi calico.yaml
11. Generate Token to add worker Node(Only on Master node)
#Create a new Token
sudo kubeadm token create
#List Tokens created
sudo kubeadm token list
#Find Certificate Hash on Master
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt |
openssl rsa -pubin -outform der 2(GREATER THAN SYMBOL)/dev/null |
openssl dgst -sha256 -hex | sed 's/^.* //'
12. Join Nodes (Only on Worker nodes)
sudo kubeadm join --token TOKEN_ID CONTROL_PLANE_HOSTNAME:CONTROL_PLANE_PORT --discovery-token-ca-cert-hash sha256:HASH
(Formed using outputs from step 10, treat CAPS as variables to be replaced)
13. Want to run workloads on Master?(Only on Master Node)
kubectl taint nodes -all node-role.kubernetes.io/master
14. Sample Deployment file:
=========================
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
=========================
15. Apply the deployment:
kubectl apply -f FILE_NAME
#kubernetes #virtualbox #cloudguru

Пікірлер: 2
@yingchen9618
@yingchen9618 Жыл бұрын
Thanks!
@CloudGurus
@CloudGurus Жыл бұрын
Welcome!
Kubernetes Crash Course for Absolute Beginners [NEW]
1:12:04
TechWorld with Nana
Рет қаралды 2,6 МЛН
Heartwarming: Stranger Saves Puppy from Hot Car #shorts
00:22
Fabiosa Best Lifehacks
Рет қаралды 20 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 47 МЛН
#1. Configure Multi-node Kubernetes Cluster on VirtualBox
33:26
2DPointTechie
Рет қаралды 32 М.
Build a Kubernetes Home Lab from Scratch step-by-step!
10:35
VirtualizationHowto
Рет қаралды 129 М.
Running your own Kubernetes cluster with Rancher
35:47
That DevOps Guy
Рет қаралды 71 М.
Kubernetes Explained in 15 Minutes | Hands On (2024 Edition)
15:18
Travis Media
Рет қаралды 65 М.
Inside a Google data center
5:28
Google Workspace
Рет қаралды 21 МЛН
Using *HA* Kubernetes at home, was never so simple!
32:14
Christian Lempa
Рет қаралды 162 М.