Prepare and apply on AWS¶
What you will end up with¶
An installation on EKS with IRSA bound end to end, and its nodes enrolled.
Prerequisites¶
- An organization with reconciled enrollment governance, and a pool.
- An EKS cluster with an IAM OIDC provider associated, and
kubectlpointed at it. - An ECR repository and an S3 bucket that already exist.
terraformon your path, and AWS credentials configured.
export ORG=acme
export POOL=edge-eu
export DP_INSTALL=dp-eu-west1
export AWS_ACCOUNT=<aws-account-id>
export AWS_REGION=<region>
1. Collect the two OIDC values¶
export OIDC_ISSUER=$(aws eks describe-cluster --name <cluster-name> --region ${AWS_REGION} \
--query "cluster.identity.oidc.issuer" --output text)
echo "${OIDC_ISSUER}"
export OIDC_ARN="arn:aws:iam::${AWS_ACCOUNT}:oidc-provider/${OIDC_ISSUER#https://}"
echo "${OIDC_ARN}"
If the provider is absent, associate it once for the cluster:
2. Confirm the registry and bucket exist¶
aws ecr describe-repositories --repository-names <repository> --region ${AWS_REGION}
aws s3api head-bucket --bucket <bucket>
Terraform grants access to both rather than creating them.
3. Prepare¶
xratu dataplane install prepare "${ORG}" "${POOL}" "${DP_INSTALL}" \
--provider aws \
--dp-count 2 \
--artifact-registry ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/xratu \
--artifact-bucket s3://<bucket>/<prefix> \
--account-id ${AWS_ACCOUNT} \
--region ${AWS_REGION} \
--cluster-oidc-issuer ${OIDC_ISSUER} \
--cluster-oidc-provider-arn ${OIDC_ARN}
{
"status": "prepared",
"dp_install": "dp-eu-west1",
"dp_count": 2,
"provider": "aws",
"output_dir": "install/dp-eu-west1",
"written_file_count": 9
}
4. Review the generated Terraform¶
Two roles and four inline policies, and nothing creating a repository or bucket.
Read the trust policies, which are the part that fails silently if an OIDC value is wrong:
identifiers = ["arn:aws:iam::<aws-account-id>:oidc-provider/oidc.eks.<region>.amazonaws.com/id/<cluster-oidc-id>"]
}
condition {
test = "StringEquals"
variable = "oidc.eks.<region>.amazonaws.com/id/<cluster-oidc-id>:sub"
values = ["system:serviceaccount:dp-eu-west1:xratud"]
}
The identifier must be your provider ARN, and the condition variable your issuer
without https://.
5. Check the service account annotations¶
eks.amazonaws.com/role-arn: arn:aws:iam::<aws-account-id>:role/dp-eu-west1-runtime
--
eks.amazonaws.com/role-arn: arn:aws:iam::<aws-account-id>:role/dp-eu-west1-build
6. Apply¶
Because nothing needs editing on AWS, up is equivalent when you have the OIDC
values to hand.
7. Verify the IRSA bindings¶
The annotation reached the cluster:
The role trusts that exact service account:
The pod actually assumed it:
Then the nodes:
If it fails¶
| Symptom | Cause | Fix |
|---|---|---|
provider_config.cluster_oidc_provider_arn is required for aws |
Missing flag | Step 1 |
| Terraform fails creating the role | The OIDC provider ARN does not exist | Associate the provider, step 1 |
Pods run, no AWS_ROLE_ARN in the environment |
The annotation did not reach the service account | Re-check step 5 and re-apply |
| Pods have the role but are denied by AWS | The trust policy subject or issuer mismatches | Compare the trust policy against the cluster issuer |
AccessDenied on S3 |
The bucket does not exist, or the prefix differs | Step 2; object access is prefix-scoped |
| Pods never enrol | The enrollment path, not AWS | See Diagnosing a node that will not enroll |
What changed¶
| Object | State |
|---|---|
| AWS | Two IAM roles, four inline policies, two trust policies pinned to service accounts |
| Cluster | Namespace, annotated service accounts, SPIRE, authority, fabric, StatefulSet |
| Control plane | Scheduler capability recorded, nodes enrolled |