52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# WireGuard cluster example
|
|
|
|
This example will create 5 kubernetes nodes using k3s: a master and 4 workers.
|
|
All VMs have public IPs, which can be used to publish ports.
|
|
|
|
To create the VMs, run:
|
|
```
|
|
./create_vms.sh
|
|
```
|
|
|
|
And to deploy Kubernetes:
|
|
```
|
|
./deploy.sh
|
|
```
|
|
|
|
After this, you can deploy an nginx service to all nodes:
|
|
```
|
|
./nginx_service.sh
|
|
```
|
|
|
|
## Succesful output
|
|
|
|
Assuming everything went fine, at the end you should see something like this:
|
|
```
|
|
daemonset.apps/nginx-daemonset unchanged
|
|
service/nginx-service unchanged
|
|
|
|
NGINX DEPLOYED! PLEASE FIND DETAILS OF PODS AND SERVICES BELOW:
|
|
|
|
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
|
|
pod/nginx-daemonset-dr84t 1/1 Running 0 3s 10.42.1.4 k3s-node-4 <none> <none>
|
|
pod/nginx-daemonset-lj4tp 1/1 Running 0 3s 10.42.3.5 k3s-node-2 <none> <none>
|
|
pod/nginx-daemonset-r4q5n 1/1 Running 0 3s 10.42.4.4 k3s-node-1 <none> <none>
|
|
pod/nginx-daemonset-t56dd 1/1 Running 0 3s 10.42.0.9 k3s-master <none> <none>
|
|
pod/nginx-daemonset-z5tmn 0/1 Pending 0 3s <none> k3s-node-3 <none> <none>
|
|
|
|
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
|
|
service/kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 2m <none>
|
|
service/nginx-service NodePort 10.43.108.125 <none> 80:30080/TCP 3s app=nginx
|
|
|
|
TO CHECK IF NGINX IS WORKING, USE THE FOLLOWING COMMANDS:
|
|
curl http://149.36.48.101:30080
|
|
curl http://149.36.48.104:30080
|
|
curl http://149.36.48.105:30080
|
|
curl http://149.36.48.102:30080
|
|
curl http://149.36.48.103:30080
|
|
```
|
|
|
|
## Tutorial
|
|
|
|
A more elaborate tutorial can be found [in the docs](http://docs.detee.ltd/tutorials/kubernetes).
|