<p>I am currently  running a Kubernetes cluster on my own homeserver (in proxmox ct's, was kinda difficult to get working because I am using zfs too, but it runs now), and the setup is as follows:</p>
<ul>
<li>lb01: haproxy &amp; keepalived</li>
<li>lb02: haproxy &amp; keepalived</li>
<li>etcd01: etcd node 1</li>
<li>etcd02: etcd node 2</li>
<li>etcd03: etcd node 3</li>
<li>master-01: k3s in server mode with a taint for not accepting any jobs</li>
<li>master-02: same as above, just joining with the token from master-01</li>
<li>master-03: same as master-02</li>
<li>worker-01 - worker-03: k3s agents</li>
</ul>
<p>If I understand it correctly k3s delivers with flannel as a CNI pre-installed, as well as traefik as a Ingress Controller.</p>
<p>I've setup rancher on my cluster as well as longhorn, the volumes are just zfs volumes mounted inside the agents tho, and as they aren't on different hdd's I've set the replicas to 1. I have a friend running the same setup (we set them up together, just yesterday) and we are planing on joining our networks trough vpn tunnels and then providing storage nodes for each other as an offsite backup.</p>
<p>So far I've hopefully got everything correct.</p>
<p>Now to my question: I've both got a static ip @home as well as a domain, and I've set that domain to my static ip</p>
<p>Something like that: (don't know how dns entries are actually written, just from the top of my head for your reference, the entries are working well.)</p>
<p>A example.com. [[my-ip]]</p>
<p>CNAME *.example.com. example.com</p>
<p>I've currently made a port-forward to one of my master nodes for port 80 &amp; 443 but I am not quite sure how you would actually configure that with ha in mind, and my rancher is throwing a 503 after visiting global settings, but I have not changed anything.</p>
<p>So now my question: How would one actually configure the port-forward and, as far as I know k3s has a load-balancer pre-installed, but how would one configure those port-forwards for ha? the one master node it's pointing to could, theoretically, just stop working and then all services would not be reachable anymore from outside.</p>

Justus Flügel
<p>Assuming your apps are running on port 80 and port 443 your ingress should give you a service with an external ip and you would point your dns at that. Read below for more info.</p>
<p>Seems like you are not a noob! you got a lot going on with your cluster setup. What you are asking is a bit complicated to answer and I will have to make some assumptions about your setup, but will do my best to give you at least some intial info.</p>
<p>This tutorial has a ton of great info and may help you with what you are doing. They use kubeadm instead of k3s, buy you can skip that section if you want and still use k3s.
<a href="https://www.debontonline.com/p/kubernetes.html" rel="nofollow noreferrer">https://www.debontonline.com/p/kubernetes.html</a></p>
<p>If you are setting up and installing etcd on your own, you don't need to do that k3s will create an etcd cluster for you that run inside pods on your cluster.</p>
<h2>Load Balancing your master nodes</h2>
<hr />
<p>haproxy + keepalived nodes would be configured to point to the ips of your master nodes at port 6443 (TCP), the keepalived will give you a virtual ip and you would configure your kubeconfig (that you get from k3s) to talk to that ip. On your router you will want to reserve an ip (make sure not to assign that to any computers).</p>
<p>This is a good video that explains how to do it with a nodejs server but concepts are the same for your master nodes:
<a href="https://www.youtube.com/watch?v=NizRDkTvxZo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=NizRDkTvxZo</a></p>
<h2>Load Balancing your applications running in the cluster</h2>
<hr />
<p>Use an K8s Service read more about it here: <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>
<p>essentially you need an external ip, I prefer to do this with metal lb.</p>
<h2>metal lb gives you a service of type load balancer with an external ip</h2>
<hr />
<p>add this flag to k3s when creating initial master node:
<a href="https://metallb.universe.tf/configuration/k3s/" rel="nofollow noreferrer">https://metallb.universe.tf/configuration/k3s/</a></p>
<p><strong>configure metallb</strong>
<a href="https://metallb.universe.tf/configuration/#layer-2-configuration" rel="nofollow noreferrer">https://metallb.universe.tf/configuration/#layer-2-configuration</a></p>
<p>You will want to reserve more ips on your router and put them under the addresses section in the yaml below. In this example you will see you have 11 ips in the range 192.168.1.240 to 192.168.1.250</p>
<p>create this as a file example metallb-cm.yaml</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.1.240-192.168.1.250
</code></pre>
<pre><code>kubectl apply -f metallb-cm.yaml
</code></pre>
<p>Install with these yaml files:</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.12.1/manifests/metallb.yaml
</code></pre>
<p>source - <a href="https://metallb.universe.tf/installation/#installation-by-manifest" rel="nofollow noreferrer">https://metallb.universe.tf/installation/#installation-by-manifest</a></p>
<h2>ingress</h2>
<p>Will need a service of type load balancer, use its external ip as the external ip</p>
<p>kubectl get service -A - look for your ingress service and see if it has an external ip and does not say pending</p>
<p>I will do my best to answer any of your follow up questions. Good Luck!</p>
