I would like to do two things with MicroK8s:
The statement "The best I've gotten so far is using MetalLB to create a load balancer." is wrong. You must to use the ingress layer for host traffic routing.
In a bare metal environment you need to configure MetalLB to allow incoming connections from the host to k8s.
First we need a test:
curl -H "Host: nginx.ioo" http://HOST_IP
What is the result?
If Network error then you need MetalLB
microk8s.enable metallb:$(curl ipinfo.io/ip)-$(curl ipinfo.io/ip)
Run the test again.
If Network error then you have something wrong. Check host connectivity.
If error 404 (sometimes 503) then you need a ingress rule.
# ingress-service.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: nginx.ioo
- http:
paths:
- path: /
backend:
serviceName: nginx-cluster-ip-service
servicePort: 80
Last test. It should work.
Now you can use ingress to route different domains to their respective pods inside the service.