If you don't have a running cluster, follow Create a single-master Kubernetes cluster with kubeadm by Ansible to set up a Kubernetes cluster.
Source: https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/
Deploy
kubectl apply -f my-nginx-deploy.yaml
kubectl get pods -l run=my-nginx
Expose service type LoadBalancer
kubectl apply -f my-nginx-svc.yaml
kubectl get svc my-nginx
You will see that EXTERNAL-IP
is always pending
.
Source: https://metallb.universe.tf/installation/#installation-with-helm
Install
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb -f values.yaml
If you want to uninstall MetalLB, run helm uninstall metallb
.
List all releases
helm list --all -A
Get services again
kubectl get svc my-nginx
You will see that EXTERNAL-IP
is assigned with an IP.
In order to be able to connect to the IP, you will need to be inside VM networks. SSH into the first master VM, then try to curl
to the EXTERNAL-IP
that you see above.
If you would like to connect to the IP from your host, you can set up Bridged Networking
on VirtualBox VMs, which is not covered here!