|
| 1 | +# ACK ACM Controller (Legacy) |
| 2 | + |
| 3 | +Deploys the AWS Controllers for Kubernetes (ACK) ACM Controller on EKS clusters, enabling management of AWS Certificate Manager certificates as Kubernetes resources. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This module installs the ACK ACM Controller via Helm and configures IAM Role for Service Accounts (IRSA) so the controller can manage ACM certificates. Once deployed, you can create `Certificate` custom resources in Kubernetes that provision real ACM certificates and export them to Kubernetes TLS secrets. |
| 8 | + |
| 9 | +This is primarily used by the `nginx_gateway_fabric_legacy_aws` module to handle domains with ACM ARN `certificate_reference`. |
| 10 | + |
| 11 | +## Architecture |
| 12 | + |
| 13 | +``` |
| 14 | + ┌──────────────────────────────────────────┐ |
| 15 | + │ ACK ACM Controller │ |
| 16 | + │ │ |
| 17 | + │ 1. Watches Certificate CRDs │ |
| 18 | + │ 2. Calls ACM API via IRSA │ |
| 19 | + │ 3. Requests/validates certificates │ |
| 20 | + │ 4. Exports cert to K8s TLS secret │ |
| 21 | + │ │ |
| 22 | + │ IAM: acm:RequestCertificate, │ |
| 23 | + │ acm:DescribeCertificate, │ |
| 24 | + │ acm:GetCertificate, ... │ |
| 25 | + └──────────────────────────────────────────┘ |
| 26 | + │ │ |
| 27 | + ▼ ▼ |
| 28 | + AWS ACM (Certificate) K8s TLS Secret |
| 29 | + (DNS validation) (exported cert) |
| 30 | +``` |
| 31 | + |
| 32 | +## What It Creates |
| 33 | + |
| 34 | +| Resource | Description | |
| 35 | +|----------|-------------| |
| 36 | +| `aws_iam_policy` | IAM policy granting ACM permissions | |
| 37 | +| IRSA module | IAM role bound to the controller's service account | |
| 38 | +| `helm_release` | ACK ACM Controller deployment from `oci://public.ecr.aws/aws-controllers-k8s/acm-chart` | |
| 39 | + |
| 40 | +## Configuration |
| 41 | + |
| 42 | +### Basic Example |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "kind": "ack_acm_controller", |
| 47 | + "flavor": "legacy", |
| 48 | + "version": "1.0", |
| 49 | + "spec": { |
| 50 | + "chart_version": "1.3.4" |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +### With Custom Namespace |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "kind": "ack_acm_controller", |
| 60 | + "flavor": "legacy", |
| 61 | + "version": "1.0", |
| 62 | + "spec": { |
| 63 | + "chart_version": "1.3.4", |
| 64 | + "namespace": "cert-manager" |
| 65 | + } |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +## Spec Options |
| 70 | + |
| 71 | +| Field | Type | Default | Required | Description | |
| 72 | +|-------|------|---------|----------|-------------| |
| 73 | +| `chart_version` | string | `1.3.4` | Yes | Helm chart version of the ACK ACM Controller | |
| 74 | +| `namespace` | string | environment namespace | No | Kubernetes namespace for the controller | |
| 75 | +| `helm_values` | object | - | No | Additional Helm values to override defaults | |
| 76 | + |
| 77 | +## Inputs |
| 78 | + |
| 79 | +| Input | Type | Required | Description | |
| 80 | +|-------|------|----------|-------------| |
| 81 | +| `kubernetes_details` | `@outputs/kubernetes` | Yes | Kubernetes cluster connection (provides OIDC provider ARN for IRSA) | |
| 82 | + |
| 83 | +## Outputs |
| 84 | + |
| 85 | +| Attribute | Description | |
| 86 | +|-----------|-------------| |
| 87 | +| `namespace` | Namespace where the controller is deployed | |
| 88 | +| `release_name` | Helm release name | |
| 89 | +| `chart_version` | Deployed chart version | |
| 90 | +| `role_arn` | IAM role ARN used by the controller | |
| 91 | +| `helm_release_id` | Helm release ID | |
| 92 | + |
| 93 | +## Usage with nginx_gateway_fabric_legacy_aws |
| 94 | + |
| 95 | +Once deployed, the `nginx_gateway_fabric_legacy_aws` module can use ACM ARNs as `certificate_reference` on domains: |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "kind": "ingress", |
| 100 | + "flavor": "nginx_gateway_fabric_legacy_aws", |
| 101 | + "version": "1.0", |
| 102 | + "spec": { |
| 103 | + "domains": { |
| 104 | + "production": { |
| 105 | + "domain": "api.example.com", |
| 106 | + "alias": "prod", |
| 107 | + "certificate_reference": "arn:aws:acm:us-east-1:123456789:certificate/abc-123" |
| 108 | + } |
| 109 | + } |
| 110 | + } |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +The ingress module detects the ACM ARN, creates a `Certificate` CRD (kind: `acm.services.k8s.aws/v1alpha1`), and the ACK controller provisions the certificate and exports it to a K8s TLS secret. |
| 115 | + |
| 116 | +## Prerequisites |
| 117 | + |
| 118 | +- EKS cluster with OIDC provider configured |
| 119 | +- Route53 hosted zone for DNS validation of ACM certificates |
| 120 | + |
| 121 | +## Troubleshooting |
| 122 | + |
| 123 | +### Check Controller Status |
| 124 | + |
| 125 | +```bash |
| 126 | +kubectl get pods -n <namespace> -l app.kubernetes.io/name=acm-chart |
| 127 | +kubectl logs -n <namespace> -l app.kubernetes.io/name=acm-chart |
| 128 | +``` |
| 129 | + |
| 130 | +### Check ACM Certificate CRDs |
| 131 | + |
| 132 | +```bash |
| 133 | +kubectl get certificate.acm.services.k8s.aws -n <namespace> |
| 134 | +kubectl describe certificate.acm.services.k8s.aws <name> -n <namespace> |
| 135 | +``` |
| 136 | + |
| 137 | +### Check IRSA |
| 138 | + |
| 139 | +```bash |
| 140 | +kubectl get sa ack-acm-controller -n <namespace> -o yaml | grep eks.amazonaws.com/role-arn |
| 141 | +``` |
| 142 | + |
| 143 | +### Common Issues |
| 144 | + |
| 145 | +- **Certificate stuck in pending**: Check Route53 DNS validation records are created. The ACM controller needs DNS validation to complete. |
| 146 | +- **IAM errors**: Verify the IRSA role ARN in the service account annotation matches the IAM role with ACM permissions. |
| 147 | +- **Export failure**: The target K8s secret must exist before the controller can export. The ingress module pre-creates empty TLS secrets for this purpose. |
0 commit comments