AWS ingress
On AWS, the AWS Load Balancer Controller creates an Application Load Balancer (ALB) for the site's Ingress.
Set up the load balancer
-
Install the controller in your cluster, as described in the AWS user guide.
-
Request an AWS Certificate Manager (ACM) certificate for your site's hostname, in the same Region as your cluster.
-
Add the ALB annotations to your values file with your certificate's ARN, and upgrade the release:
# Primary Site values.yamlingress:annotations:kubernetes.io/ingress.class: "alb"alb.ingress.kubernetes.io/scheme: internet-facingalb.ingress.kubernetes.io/target-type: ipalb.ingress.kubernetes.io/backend-protocol: HTTPalb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-west-1:xxxxxxxxxxxx:certificate/EXAMPLE-xxxx-xxxx-xxxx-xxxxxxxxxxxx -
Point your site's DNS record at the ALB's DNS name:
kubectl get ingress site -n foxglove -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
By default, the ALB closes connections that send no data for 60 seconds, so long searches can fail. To raise this limit, see Increase the ingress timeout.
Global Accelerator
Clients far from your site's region can stream data slowly. AWS Global Accelerator connects each client to a nearby AWS edge location and carries traffic to the ALB over the AWS network. HTTPS still ends at the ALB, so its certificate stays the same.
The AWS Load Balancer Controller creates the accelerator for the site's Ingress, and moves it to the new ALB if the Ingress is recreated.
Global Accelerator closes connections that send no data for 340 seconds. A search that sends no data for longer than that fails, even if you raised the ALB idle timeout. Global Accelerator also charges an hourly fee plus a per-GB fee on top of normal data transfer.
Requirements
- Primary Site v0.0.111 or later.
- AWS Load Balancer Controller v2.17.0 or later.
helm list -n kube-systemshows its version underAPP VERSION. - The chart's Ingress (
ingress.enabled: true) with an internet-facing ALB (alb.ingress.kubernetes.io/scheme: internet-facing). - An AWS commercial Region. Global Accelerator isn't available in AWS GovCloud (US) or China Regions.
Turn on Global Accelerator
Follow the steps in order. The controller needs its IAM policy and the GlobalAccelerator custom resource definition before you turn on its feature gates. Otherwise, it can't update any load balancer in the cluster, or it never creates the accelerator.
-
Attach the controller's Global Accelerator AWS Identity and Access Management (IAM) policy to the controller's IAM role.
-
Check that the
GlobalAcceleratorcustom resource definition is installed:kubectl get crd globalaccelerators.aga.k8s.awsIf it's missing, apply it as described in the controller's installation guide.
helm upgradedoesn't install new custom resource definitions, so a controller first installed before v2.17.0 doesn't have it. -
Turn on the controller's
GlobalAcceleratorControllerandEnableRGTAPIfeature gates in its Helm values. Set them wherever you manage the controller's installation, such as a values file or Terraform, so a later deploy doesn't turn them off. Changing them restarts the controller.# AWS Load Balancer Controller Helm valuescontrollerConfig:featureGates:GlobalAcceleratorController: trueEnableRGTAPI: true -
Turn on the accelerator in your Primary Site values file, and upgrade the release:
# Primary Site values.yamlingress:globalAccelerator:enabled: trueTo name the accelerator in AWS, set
ingress.globalAccelerator.nameto up to 64 letters, digits, hyphens, or underscores. Otherwise, the controller generates a name. Until the controller creates the ALB, theGlobalAcceleratorresource reportsFailedBuildModelevents, which stop once the ALB exists. -
Point your site's DNS record at the accelerator's DNS name:
kubectl get globalaccelerator site -n foxglove -o jsonpath='{.status.dnsName}'A domain apex can't be a CNAME record. For an apex, create A records for the accelerator's two static IP addresses instead:
kubectl get globalaccelerator site -n foxglove -o jsonpath='{.status.ipSets[0].ipAddresses}'
Turn off Global Accelerator
Turning off the accelerator or uninstalling the release deletes the accelerator and its static IP addresses. If your DNS record still points at the accelerator, clients can't reach the site.
-
Point your site's DNS record back at the ALB, as in Set up the load balancer, and wait for the old record's time to live (TTL) to pass.
-
Set
ingress.globalAccelerator.enabledtofalse, and upgrade the release.
If you turn the accelerator back on or reinstall the release, the new accelerator has a new DNS name and new static IP addresses, so update your DNS record again.