-
Notifications
You must be signed in to change notification settings - Fork 8
feat: deploy AWS Load Balancer controller in EKS clusters #1341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e1b89a6
build: include AWS Load Balancer controller in Helm chart
dkoshkin 9a959bc
feat: deploy AWS Load Balancer controller
dkoshkin 98ad79b
docs: add AWS Load Balancer controller docs
dkoshkin dadecd8
fix: support AWS clusters in AWS LB Controller
dkoshkin c2c92d6
feat: put AWS LB Controller behind an API
dkoshkin 9e52f17
refactor: move to ingress folder
dkoshkin 57fb3d9
fix: remove committed file
dkoshkin 5add1d0
docs: typo
dkoshkin 116d877
fix: add Ingress to aggregate type
dkoshkin b19de30
fix: shorten resource names
dkoshkin 6de85b1
test: add WaitForIngressToBeReadyInWorkloadCluster
dkoshkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...r-api-runtime-extensions-nutanix/addons/aws-load-balancer-controller/values-template.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # The clusterName refers the kubernetes.io/cluster/ tag on AWS resources. | ||
| # For EKS clusters, the name will be based on the cluster's namespace + a random suffix. | ||
| # For AWS clusters, the name will just be based on the cluster name. | ||
| {{- $capiProvider := index .Cluster.metadata.labels "cluster.x-k8s.io/provider" }} | ||
| {{- if eq $capiProvider "eks" }} | ||
| clusterName: "{{ .ControlPlane.spec.eksClusterName }}" | ||
| {{- else }} | ||
| clusterName: "{{ .Cluster.metadata.name }}" | ||
| {{- end }} | ||
| # Set this value to avoid stutter in the resource names. | ||
| fullnameOverride: aws-load-balancer-controller | ||
12 changes: 12 additions & 0 deletions
12
...nsions-nutanix/templates/addons/aws-load-balancer-controller/helm-addon-installation.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright 2025 Nutanix. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| {{- if .Values.hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.create }} | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: '{{ .Values.hooks.ingress.awsLoadBalancerController.defaultValueTemplateConfigMap.name }}' | ||
| data: | ||
| values.yaml: |- | ||
| {{- .Files.Get "addons/aws-load-balancer-controller/values-template.yaml" | nindent 4 }} | ||
| {{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| +++ | ||
| title = "AWS Load Balancer Controller" | ||
| icon = "fa-solid fa-balance-scale" | ||
| +++ | ||
|
|
||
| By leveraging CAPI cluster lifecycle hooks, this handler deploys the [AWS Load Balancer Controller] on the new cluster at the `AfterControlPlaneInitialized` phase. | ||
|
|
||
| The AWS Load Balancer Controller manages AWS Application Load Balancers (ALB) and Network Load Balancers (NLB) for Kubernetes services and ingresses. | ||
|
|
||
| Deployment of this controller is opt-in via the [provider-specific cluster configuration]({{< ref ".." >}}). | ||
|
|
||
| The hook uses the [Cluster API Add-on Provider for Helm] to deploy the AWS Load Balancer Controller resources. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - AWS EKS cluster | ||
| - IAM role with necessary permissions for the AWS Load Balancer Controller | ||
|
|
||
| ## Example | ||
|
|
||
| To enable deployment of the AWS Load Balancer Controller on a cluster, specify the following values: | ||
|
|
||
| ```yaml | ||
| apiVersion: cluster.x-k8s.io/v1beta1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: <NAME> | ||
| spec: | ||
| topology: | ||
| variables: | ||
| - name: clusterConfig | ||
| value: | ||
| addons: | ||
| ingress: | ||
| provider: "aws-lb-controller" | ||
| ``` | ||
|
|
||
| ## IAM Permissions | ||
|
|
||
| The AWS Load Balancer Controller requires specific IAM permissions to manage load balancers. | ||
| See [AWS Load Balancer IAM Policies] for the full list of permissions. | ||
| The provided configuration assumes the permissions will be attached to the Nodes. | ||
|
|
||
| If attaching these policies to the non-default instance-profile, you may specify the name in the Cluster using the following configuration: | ||
|
|
||
| ```yaml | ||
| - name: workerConfig | ||
| value: | ||
| eks: | ||
| ... | ||
| iamInstanceProfile: custom.nodes.cluster-api-provider-aws.sigs.k8s.io | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Once deployed, the AWS Load Balancer Controller can be used to: | ||
|
|
||
| 1. **Create Application Load Balancers (ALB)** for Kubernetes services using the `service.beta.kubernetes.io/aws-load-balancer-type: nlb` annotation | ||
| 2. **Create Network Load Balancers (NLB)** for Kubernetes services using the `service.beta.kubernetes.io/aws-load-balancer-type: nlb` annotation | ||
| 3. **Manage Ingress resources** with the `kubernetes.io/ingress.class: alb` annotation | ||
| 4. **Configure Target Group Bindings** for advanced load balancer configurations | ||
|
|
||
| ## Example Service | ||
|
|
||
| See [AWS Load Balancer NLB Example] | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: my-service | ||
| annotations: | ||
| service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing | ||
| spec: | ||
| type: LoadBalancer | ||
| loadBalancerClass: service.k8s.aws/nlb | ||
| ports: | ||
| - port: 80 | ||
| targetPort: 8080 | ||
| selector: | ||
| app: my-app | ||
| ``` | ||
|
|
||
| See other examples in [AWS Load Balancer Example] docs. | ||
|
|
||
| [AWS Load Balancer Controller]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/ | ||
| [Cluster API Add-on Provider for Helm]: https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm | ||
| [AWS Load Balancer IAM Policies]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/deploy/installation/#option-b-attach-iam-policies-to-nodes | ||
| [AWS Load Balancer NLB Example]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/service/nlb/ | ||
| [AWS Load Balancer Example]: https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/guide/ingress/annotations/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
hack/addons/kustomize/aws-load-balancer-controller/kustomization.yaml.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2025 Nutanix. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| apiVersion: kustomize.config.k8s.io/v1beta1 | ||
| kind: Kustomization | ||
|
|
||
| metadata: | ||
| name: aws-load-balancer-controller | ||
|
|
||
| helmCharts: | ||
| - name: aws-load-balancer-controller | ||
| namespace: kube-system | ||
| repo: https://aws.github.io/eks-charts | ||
| releaseName: aws-load-balancer-controller | ||
| version: ${AWS_LOAD_BALANCER_CONTROLLER_CHART_VERSION} | ||
| includeCRDs: true | ||
| skipTests: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,5 @@ | |
| nfd: {} | ||
| cni: | ||
| provider: Cilium | ||
| ingress: | ||
| provider: aws-lb-controller | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.