-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrapping the Cluster.txt
42 lines (25 loc) · 1.69 KB
/
Bootstrapping the Cluster.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# CHAPTER 2.5 - Bootstrapping the Cluster
# https://learn.acloud.guru/course/2e0bad96-a602-4c91-9da2-e757d32abb8f/learn/56bea242-4b92-4bcb-ad80-f974467c8d7a/e896865d-af4d-43ec-92f9-a3c1b14433fc/watch
# On Kube Master, Kube Node 1 and Kube Node 2, stop and disable ufw:
sudo systemctl stop ufw
sudo ufw disable
# On the Kube Master node, initialize the cluster:
sudo kubeadm init --pod-network-cidr 192.168.0.0/16
# Set kubectl access:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# The kubeadm init command should output a kubeadm join command containing a token and hash. Copy that command and run it with sudo on both worker nodes. It should look something like this:
sudo kubeadm join $some_ip:6443 --token $some_token --discovery-token-ca-cert-hash $some_hash
# Use can print the full 'kubeadm join' flag needed to join the cluster with the following command:
kubeadm token create --print-join-command
# Run the kubeadm join command on your Kube Node 1 and Kube Node 2 servers:
sudo kubeadm join <IP_ADDRESS> --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>
# From your Kube Master node, verify that all nodes have successfully joined the cluster:
kubectl get nodes
# You should see all three of your nodes listed. It should look something like this:
NAME STATUS ROLES AGE VERSION
155f1d1c831c.mylabserver.com NotReady control-plane 2m21s v1.30.3
155f1d1c832c.mylabserver.com NotReady <none> 37s v1.30.3
155f1d1c833c.mylabserver.com NotReady <none> 12s v1.30.3
# Note: The nodes are expected to have a STATUS of NotReady at this point