Added http lb for lb

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
rewrite
Tuan-Dat Tran 2024-09-30 07:51:33 +02:00
parent 8fb4eaf610
commit 2cc4fd0be0
3 changed files with 33 additions and 3 deletions

View File

@ -31,3 +31,22 @@ ansible-playbook -i production -J k3s-servers.yml
This will run the [./k3s-servers.yml](./k3s-servers.yml) playbook and execute
its roles.
## After successful k3s installation
To access our Kubernetes cluster from our host machine to work on it via
flux and such we need to manually copy a k3s config from one of our server nodes to our host machine.
Then we need to install `kubectl` on our host machine and optionally `kubectx` if we're already
managing other Kubernetes instances.
Then we replace the localhost address inside of the config with the IP of our load balancer.
Finally we'll need to set the KUBECONFIG variable.
```sh
mkdir ~/.kube/
scp k3s-server00:/etc/rancher/k3s/k3s.yaml ~/.kube/config
chown $USER ~/.kube/config
sed -i "s/127.0.0.1/192.168.20.22/" ~/.kube/config
export KUBECONFIG=~/.kube/config
```
Install flux and continue in the flux repository.

View File

@ -1,3 +0,0 @@
---
- include_tasks: installation.yml
- include_tasks: apps.yml

View File

@ -14,3 +14,17 @@ stream {
proxy_pass k3s_servers;
}
}
http {
upstream k3s_servers {
{% for ip in k3s_server_ips %}
server {{ ip }};
{% endfor %}
}
server {
location / {
proxy_pass http://k3s_servers;
}
}
}