Skip to main content

Creating an Ignition Service account on EKS using IRSA

When running on EKS, you can associate IAM roles with the service account that Ignition runs with. This can give Ignition capabilities to access other AWS services in your account.

Setup​

Let's start by defining a few environment variables for our cluster, region, and desired IAM Policy attachments.

# Replace the values below and then export these variables to your shell.
export AWS_REGION=<your-aws-region>
export CLUSTER_NAME=<your-eks-cluster-name>
# arn:aws:iam::aws:policy/AWSMarketplaceMeteringFullAccess
export POLICY_ARN=<iam-policy-arn-to-attach>
export IGNITION_NAMESPACE=ignition
export IGNITION_SERVICE_ACCOUNT_NAME=ignition

Creating an Ignition Service Account​

In this example, we'll use IAM Roles for Service Accounts (IRSA) to associate an IAM role and attached policies with the Ignition service account.

First, let's create the Ignition namespace:

# Create the Ignition namespace
kubectl create namespace $IGNITION_NAMESPACE
# Set the current kubectl context to use that namespace by default
kubectl config set-context --current --namespace=$IGNITION_NAMESPACE
# Create the IAM service account
eksctl create iamserviceaccount \
--name $IGNITION_SERVICE_ACCOUNT_NAME \
--namespace $IGNITION_NAMESPACE \
--cluster $CLUSTER_NAME \
--region $AWS_REGION \
--attach-policy-arn $POLICY_ARN
# NOTE: you may need to re-run with `--approve` to finalize the creation

Service Account in Helm Chart Values​

We don't want the Helm Chart to attempt to create the service account on our behalf since we're managing it externally. Use the following value overrides to specify the service account name and disable automatic creation:

Helm Chart Value Overrides
serviceAccount:
create: false
# set the name to be the IGNITION_SERVICE_ACCOUNT_NAME used above
name: "ignition"