You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project sets up a local Kubernetes cluster using Vagrant and VirtualBox. It creates two Ubuntu 22.04 virtual machines: one master node and one worker node with automatic installation of Docker, Kubernetes components, and necessary configurations.
8
+
This project sets up a local Kubernetes cluster using Vagrant and VirtualBox. It creates two Ubuntu 22.04 virtual machines: one control plane node and one worker node with automatic installation of Docker, Kubernetes components, and necessary configurations.
> **Note about IP Addressing**: This configuration uses `192.168.63.1` and `192.168.63.2` for the master and worker nodes respectively. You can modify these IPs in the `Vagrantfile` to use any IP addresses from your router's IP range that are outside the DHCP scope. Make sure to choose IPs that won't conflict with other devices on your network.
74
+
> **Note about IP Addressing**: This configuration uses `192.168.63.1` and `192.168.63.2` for the control plane and worker nodes respectively. You can modify these IPs in the `Vagrantfile` to use any IP addresses from your router's IP range that are outside the DHCP scope. Make sure to choose IPs that won't conflict with other devices on your network.
75
75
76
76
<table>
77
77
<tr>
78
-
<th width="50%">Master Node</th>
78
+
<th width="50%">Control Plane Node</th>
79
79
<th width="50%">Worker Node</th>
80
80
</tr>
81
81
<tr>
82
82
<td>
83
83
84
84
```yaml
85
85
IP: 192.168.63.1
86
-
Hostname: master
86
+
Hostname: cplane
87
87
Memory: 2048MB
88
88
CPUs: 2
89
89
Role: Control Plane
@@ -123,9 +123,9 @@ cd vagrant
123
123
vagrant up
124
124
```
125
125
126
-
3. SSH into the master node:
126
+
3. SSH into the control plane node:
127
127
```bash
128
-
vagrant ssh master
128
+
vagrant ssh cplane
129
129
```
130
130
131
131
4. SSH into the worker node:
@@ -163,11 +163,11 @@ vagrant destroy
163
163
164
164
After the VMs are up and running, follow these steps to initialize your Kubernetes cluster:
165
165
166
-
### 1. On Master Node
166
+
### 1. On Control Plane Node
167
167
168
-
First, log into the master node:
168
+
First, log into the control plane node:
169
169
```bash
170
-
vagrant ssh master
170
+
vagrant ssh cplane
171
171
```
172
172
173
173
Pull required Kubernetes images:
@@ -187,13 +187,38 @@ After the cluster initialization, install Weave CNI:
### NOTE: Control Plane script 'cluster_init.sh' wraps steps 1. and 2.
191
+
192
+
For ease of use, a single script `cluster_init.sh` was created as a function of the "vagrant up" command for the control plane(s) that performs all of the above steps:
193
+
* k8s image pull
194
+
* kubeadm init
195
+
* local copy of "kube config"
196
+
* Weave CNI install
197
+
198
+
First, log into the control plane node:
199
+
```bash
200
+
vagrant ssh cplane
201
+
```
202
+
203
+
Run the Cluster Init Script:
204
+
```bash
205
+
./cluster_init.sh
206
+
```
207
+
190
208
### 3. Join Worker Node
191
209
192
-
Copy the `kubeadm join` command from the master node's initialization output and run it on the worker node with sudo privileges.
210
+
Copy the `kubeadm join` command from the control plane node's initialization output and run it on the worker node with sudo privileges.
211
+
212
+
### NOTE: Control Plane script 'join_cmd.sh' shows the 'join' command
213
+
214
+
For ease of use, script `join_cmd.sh` was created to display the join command for use on worker nodes with this vagrant command:
215
+
```bash
216
+
vagrant ssh cplane -c "./join_cmd.sh"
217
+
```
193
218
194
219
### 4. Verify Cluster Status
195
220
196
-
After joining the worker node, verify the cluster status from the master node:
221
+
After joining the worker node, verify the cluster status from the control plane node:
197
222
198
223
```bash
199
224
# Check node status
@@ -203,7 +228,7 @@ kubectl get nodes
203
228
Expected output (it may take a few minutes for the nodes to be ready):
0 commit comments