Services, Loadbalancer & Ingress
There are multiple mechanisms in kubernetes to expose services to the outside world. The most common one is using a Loadbalancer
resource.
A Loadbalancer
resource in kubernetes is a special variant of a Service
resource.
Commonly a Loadbalancer
in public clouds will materialize as a real Loadbalancer, for example an AWS Applicaton Loadbalancer or an Azure Load Balancer.
It is then configured, synced and deployed automatically through a provider-specific Kubernetes Plugin.
As flynnt clusters are cloud-agnostic, we do not provide built-in functionality to use provider-specific services. Of course, if you are using flynnt on one or multiple cloud providers, you can always add this functionality yourself. For example, see here for the AWS provider or here, for the GCP provider
Flynnt comes with a cloud-agnostic Loadbalancer provider though. You can find more information on it here and by following this page.
In the future it will be possible to disable the default Loadbalancer provider. This is useful if you want to roll your own Loadbalancer provider or just don't need it.
Another alternative for an on-premise Loadbalancer provider could be metallb
Provision a Loadbalancer in flynnt
Let's say you want to expose a service on port 80 to outside of your cluster.
apiVersion: v1
kind: Service
spec:
selector:
app: web-app
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
This service definition by default will try to reserve port 80 on every compute node in your cluster. If port 80 is already used on a node, it will just not skip this node.
All flynnt nodes are labeled with svccontroller.k3s.cattle.io/enablelb=true
by default.
The Loadbalancer provider will only use these nodes as eligible for a loadbalancer deployment.
If you want to exclude nodes as loadbalancer targets, just delete the label as you see fit.
kubectl label node <nodename> svccontroller.k3s.cattle.io/enablelb-
Ingress
Flynnt does not come with a default Ingress provider. As the market for Kubernetes Ingress provider is pretty crowded we did not feel comfortable choosing a default for you.
There is nothing special about using an ingress provider in flynnt. Just choose your poison and deploy it.
Most of them build on a Service Loadbalancer
to be available, so make sure you have that figured out.
An example to deploy nginx-ingress to a flynnt cluster. Note, that we don't use any special options or customizations. It should just work:
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace --version 4.8.0
You can also see our Sample Applications page for a more complete example.