Truefoundry uses Istio as the ingress controller. It, by default, provisions a single external load-balancer for one Kubernetes cluster. The load-balancer is provisioned automatically by the tfy-istio-ingress helm chart installed by TrueFoundry which creates a Kubernetes service of type LoadBalancer. This is fundamentally an ingress gateway which automatically brings up the load balancer in the respective cloud provider.
Istio is currently mandatory for the Truefoundry components to work. We will be adding support for other ingress controllers in the future.
You can find the configuration of the tfy-ingress-gateway in Deployments > Helm > tfy-istio-ingress (Make sure you are filtering for the desired cluster)You can click on the three dots to understand the configuration.If you want to modify any of your load-balancer settings, you will have to edit this configuration and deploy the helm chart. The load-balancer settings are configured using the annotations on the gateway object. The annotations vary based on the cloud provider and you can find the corresponding cloud specific documentation below.
Changing some of the settings might cause the load balancer to be recreated and you will have to remap your DNS. This can bring down the services temporarily - so be careful with the changes you make or consult with the Truefoundry team.
Using the below command you can get the load balancer IP address. You need to point this IP address to your domain in your DNS provider as an A record. For AWS - this will be a CNAME record.
Below are the condiguration for the loadbalancers for the different cloud providers.
AWS
GCP
Azure
On-Prem
Below are the various load balancer types that are supported for AWS.
AWS Network Load Balancer
By default, the istio gateway creates a network load balancer for the ingress traffic. Functionality of the load balancer can be modified using the NLB annotations listed hereDefault annotations for the NLB are as follows:
To add multiple domains to the load Balancer, just add it in the hosts section. You can also use * to match all subdomains.
Copy
Ask AI
hosts: - '*.tfy.example.com' - '*.ml.example.com'
AWS Application Load Balancer
To use an application load balancer for the ingress traffic, make the following changes in the tfy-istio-ingress helm chart values. Ensure you have replaced cluster name, load balancer name, certificate arn and ingress class name is alb. Functionality of the load balancer can be modified using the ALB annotations listed here
To add multiple domains to the load Balancer, just add it in the hosts section. You can also use * to match all subdomains.
Copy
Ask AI
hosts: - '*.tfy.example.com' - '*.ml.example.com'
When running TrueFoundry on GCP, istio creates a network load balancer for the ingress traffic. Functionality of the load balancer can be modified using the network load balancer annotations listed hereBy default no annotations are added to the load balancer gateway in GCP.
When running TrueFoundry on Azure, istio creates a load balancer for the ingress traffic. Functionality of the load balancer can be modified using the load balancer annotations listed hereBy default no annotations are added to the load balancer gateway in Azure.
When running TrueFoundry on On-Prem, istio creates a load balancer for the ingress traffic. There are two ways to run this mode.
Assign IP address to the load balancer
By default load balancer will be created without an external IP address in the case of generic cluster.
Run metalLB to assign an IP address to the load balancer.
Ensure that load balancer has an external IP address in its status. You can check that by running the following command:
Copy
Ask AI
kubectl get svc -n istio-system tfy-istio-ingress
Once the load balancer gets the IP address assign in its status, modify your DNS to point to the IP address.
Use existing load balancer
If you already have provisioned a load balancer outside of the k8s cluster, you can use istio gateway as a backend to route traffic.
Modify the gateway configuration to use nodeport service type.
Copy
Ask AI
gateway: service: type: NodePort
Modify your external load balancer to point to all (or few) nodes at the port that comes up in the nodeport service. You can check that by running the following command:
Copy
Ask AI
kubectl get svc -n istio-system tfy-istio-ingress
If you want to terminate TLS at the istio layer you can use the port 443 as the backend port otherwise use the port 80.
To add multiple domains to the load Balancer, just add it in the hosts section. You can also use * to match all subdomains.
Copy
Ask AI
hosts: - '*.tfy.example.com' - '*.ml.example.com'
To restrict the access to the load balancer to a specific IP address, you need to modify the gateway.service spec
If you want to add the base domain(s) to the TrueFoundry platform to expose your services via your domain, you can do so by editing the Cluster Page from the Platform section and adding the domain in the Base Domain URLs field. You can also add multiple domains.
Adding base domain for workbench config
If you want to use notebooks and SSH servers, you need to add the domain URL for them in the cluster’s page by enabling workbench config toggle.If you have a wildcard domain, you can add the base domain as notebook.tfy.example.com and ssh.tfy.example.com with port 80 if *.tfy.example.com is your base domain. Feel free to customize the domain names as per your needs.
Adding base domain for spark
If you want to expose your spark job, you need to add the domain URL in the cluster’s page by enabling spark config toggle.
Each installation of tfy-istio-ingress creates a load balancer. If you want to deploy multiple multiple load-balancers, for e.g. one internal and one external, you can clone the current tfy-istio-ingress application in the same namespace istio-system, change the tfyGateway.Name to something else other then default tfy-wildcard and update the tfyGateway.spec.Selector with the new name of the application.For e.g. if you clone the tfy-istio-ingress a new application with the name tfy-istio-ingress-1 will be created , update the tfyGateway.Name to a new name and the tfyGateway.spec.Selector to
Add authentication to all services behind a load balancer
We can configure Istio to apply authentication at a gateway level. This will work only if you are accessing the service using the DNS provided in Istio and not access the service directly from within the cluster. This process is a bit complicated, and you should only do this if you really want to enable authentication at an istio gateway level.
Istio will validate if the JWT is valid. If not valid, it will return an Unauthorized Error.
Create a RequestAuthentication resource to ensure that the JWT issuer and Audience are correct.
Authentication will be only done if there is an Authorization header. This is pass-through if no Authorization header is present in the Request or it gets an empty string after removing the prefix.