How-to guide / Start and inspect a Kix project
Deploy to EKS
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
Deploy a Kix cluster definition to an existing Amazon Elastic Kubernetes Service (EKS) cluster. This guide covers selecting kix.flavors.eks, binding the definition to your cluster’s UID, configuring AWS IAM roles for workloads, setting up EBS storage, and turning on network policy enforcement in the Amazon VPC CNI.
This guide assumes Kix, kubectl, and the AWS CLI (aws) are installed, and that your current kubectl context connects to your EKS cluster.
Choose the flavor and bind your cluster
Section titled “Choose the flavor and bind your cluster”Include kix.flavors.eks as the first module in kix.buildCluster. The flavor assumes your cluster has:
- A managed control plane (
managedControlPlane = true), multiple nodes (multiNode = true), privileged containers and DaemonSets allowed, andcontainerd.discardUnpackedLayers = true(matching Amazon Linux 2023 nodes). - Amazon VPC CNI (
cnirole bound asexclusive), CoreDNS askube-dnsinkube-system(dnsrole,shadowable), and classic Elastic Load Balancers from the EKS service controller (loadBalancerrole,shadowable). - No default
StorageClass(storageClassesrole,absent) and no Kubernetes metrics API (metricsApirole,absent). EKS registers av1.metrics.eks.amazonaws.comAPIService that does not servemetrics.k8s.io, sokubectl topand horizontal pod autoscaling require deployingmetrics-server. - IAM roles for service accounts (IRSA) by default (
cluster.flavor.eks.cloudIdentity = "irsa"), and network policy enforcement turned off (cluster.flavor.eks.networkPolicy = "none").
Size small node groups
Section titled “Size small node groups”kix.flavors.eks sets cluster.capabilities.multiNode = true and leaves availabilityZones unset, which sets cluster.availability.default to "node". Packages that scale with availability then run at least two replicas per controller (for example, cert-manager and external-secrets each run six pods across three Deployments). On a small node group such as two 2-vCPU nodes, deploying several controllers can exhaust CPU requests and leave pods Pending, which kix deploy and kix status report as 0/2 nodes are available: 2 Insufficient cpu. On small test clusters, set cluster.availability.default = "none"; cluster-wide or availability = "none"; on individual instances (see Set the cluster availability level).
Bind the definition and deploy
Section titled “Bind the definition and deploy”Bind every live cluster definition to its Kubernetes cluster with cluster.kubernetes.uid (the UID of the cluster’s kube-system Namespace) so a wrong kubeconfig context cannot deploy this definition to another cluster.
Read the UID from your EKS cluster:
❱ kubectl get namespace kube-system -o jsonpath='{.metadata.uid}' Add the flavor and your cluster’s UID to your cluster file:
1{ kix, packages }:2kix.buildCluster {3 specialArgs = { inherit kix packages; };4 modules = [5 kix.flavors.eks6 {7 cluster.kubernetes.uid = "4d7b1c2e-9f3a-4b8e-a1c5-6d2e8f0a9b3c";8 }9 ];10}Running kix plan or kix deploy before setting cluster.kubernetes.uid also prints the connected context, API server URL, and the exact cluster.kubernetes.uid line to copy into your definition. See Bind a cluster definition to its Kubernetes cluster for k8sVersion checks and cluster rebuilds.
Evaluate, preview, deploy, and check your cluster:
❱ kix check <cluster>❱ kix plan <cluster>❱ kix deploy <cluster>❱ kix status <cluster> Grant AWS IAM roles to workloads
Section titled “Grant AWS IAM roles to workloads”Pass kix.cloudIdentity.aws { roleArn = "arn:aws:iam::111122223333:role/<role>"; } to packages that call AWS APIs (replace 111122223333 with your AWS account ID throughout the examples below). Kix renders the Kubernetes configuration, and you create the IAM roles, trust policies, and any EKS Pod Identity associations in AWS.
On EKS, every cloud-identity package works with both IAM roles for service accounts (IRSA) and EKS Pod Identity:
external-dns(deps.providerCredentials)cert-manager(deps.controllerIdentity)external-secrets(deps.controllerCredentials)velero(deps.cloudCredentials; see Deploy Velero)tempo(deps.storageCredentials)cnpg-cluster(deps.storageCredentials)
Each package’s upstream documentation defines the IAM permissions its role requires. For the external-dns examples below, attach the Route 53 permissions policy from the ExternalDNS AWS tutorial.
cluster.flavor.eks.cloudIdentity selects the mechanism for the cluster: "irsa" (the default) or "pod-identity". One IAM role can include both trust policy statements if you want it to work in either mode.
Set up IRSA (default)
Section titled “Set up IRSA (default)”-
Declare the role in Kix. With
cluster.flavor.eks.cloudIdentityat its"irsa"default, pass the IAM role ARN toexternal-dns:clusters/test-cloud-identity-eks.nix 62instances.external-dns.route53 = {63package = packages.experimental.external-dns;64deps.providerCredentials = kix.cloudIdentity.aws {65roleArn = "arn:aws:iam::111122223333:role/external-dns";66};67config = {68provider = "aws";69policy = "upsert-only";70txtOwnerId = "cloud-identity-eks/route53";71extraArgs = [ "--domain-filter=example.com" ];72};73};Kix writes
eks.amazonaws.com/role-arn(andkix.run/cloud-identity) on theroute53ServiceAccount. When the pod starts, EKS’s webhook injectsAWS_ROLE_ARN,AWS_WEB_IDENTITY_TOKEN_FILE,AWS_REGION, and a projected token volume. -
Inspect the required trust values. Run
kix list resources <cluster>to print the Kubernetes subject and role ARN under Cloud identities (this reads the local build and does not connect to the cluster):❱ kix list resources <cluster> Cloud identities: Subject Mechanism Identity system:serviceaccount:external-dns:route53 irsa roleArn=arn:aws:iam::111122223333:role/external-dnsPass
-o json(kix list resources <cluster> -o json) when feeding thecloudIdentitiesarray into Terraform. -
Create the OIDC provider and IAM role in AWS. Register your cluster’s OIDC issuer as an IAM OIDC provider if you have not already. Look up the issuer URL:
❱ aws eks describe-cluster --name <cluster> --query 'cluster.identity.oidc.issuer' --output textCreate the IAM role
arn:aws:iam::111122223333:role/external-dnswith the trust policy below. Replaceoidc.eks.<region>.amazonaws.com/id/<oidc-id>with your issuer URL (withouthttps://), and set the:subcondition to theSubjectvalue fromkix list resources:1{2"Version": "2012-10-17",3"Statement": [{4"Effect": "Allow",5"Principal": { "Federated": "arn:aws:iam::111122223333:oidc-provider/oidc.eks.<region>.amazonaws.com/id/<oidc-id>" },6"Action": "sts:AssumeRoleWithWebIdentity",7"Condition": { "StringEquals": {8"oidc.eks.<region>.amazonaws.com/id/<oidc-id>:aud": "sts.amazonaws.com",9"oidc.eks.<region>.amazonaws.com/id/<oidc-id>:sub": "system:serviceaccount:external-dns:route53"10} }11}]12}Attach the Route 53 permissions policy from the ExternalDNS AWS tutorial to the role.
-
Deploy and confirm. Apply the cluster and read the controller log:
❱ kix deploy <cluster>❱ kubectl logs -n external-dns deploy/route53kix deployverifies that the pod received the IRSA environment variables, but Kix cannot check whether AWS IAM accepts the role (kix statusreportsokeither way). Check the pod log to confirm: a working role logs DNS updates such as2 record(s) were successfully updated, a wrong:subcondition logsNot authorized to perform sts:AssumeRoleWithWebIdentity, and missing permissions logAccessDenied: User: arn:aws:sts::111122223333:assumed-role/<role>/... is not authorized to perform: route53:ListHostedZones.
Set up EKS Pod Identity
Section titled “Set up EKS Pod Identity”-
Switch the cluster to Pod Identity and declare the role. Set
cluster.flavor.eks.cloudIdentity = "pod-identity";and passroleArnon the instance:clusters/test-cloud-identity-eks-pod-identity.nix 19cluster.flavor.eks.cloudIdentity = "pod-identity";2021instances.external-dns.route53 = {22package = packages.experimental.external-dns;23deps.providerCredentials = kix.cloudIdentity.aws {24roleArn = "arn:aws:iam::111122223333:role/external-dns";25};26config = {27provider = "aws";28policy = "upsert-only";29txtOwnerId = "cloud-identity-eks-pod-identity/route53";30extraArgs = [ "--domain-filter=example.com" ];31};32};In
"pod-identity"mode, Kix omitseks.amazonaws.com/role-arnon the ServiceAccount and recordsroleArninkix.run/cloud-identityforkix list resources. The EKS Pod Identity association in AWS decides which role the pod receives. -
Inspect the required association and trust principal. Run
kix list resources <cluster>to read the namespace, ServiceAccount name, trust principal, and role ARN:❱ kix list resources <cluster> Cloud identities: Subject Mechanism Identity association for external-dns/route53, role trusts pods.eks.amazonaws.com eks-pod-identity roleArn=arn:aws:iam::111122223333:role/external-dnsIn
kix list resources <cluster> -o json, each entry carries"namespace": "external-dns","serviceAccount": "route53","subject": null, and"trustPrincipal": "pods.eks.amazonaws.com". -
Install the agent, create the role, and add the association in AWS. Ensure the
eks-pod-identity-agentEKS add-on is installed on your cluster. Createarn:aws:iam::111122223333:role/external-dnswith a trust policy for thepods.eks.amazonaws.comservice principal shown in the table, and attach the Route 53 permissions policy from the ExternalDNS AWS tutorial:1{2"Version": "2012-10-17",3"Statement": [{4"Effect": "Allow",5"Principal": { "Service": "pods.eks.amazonaws.com" },6"Action": ["sts:AssumeRole", "sts:TagSession"]7}]8}Create an EKS Pod Identity association linking the namespace (
external-dns), ServiceAccount (route53), androleArnfrom the table:❱ aws eks create-pod-identity-association --cluster-name <cluster> --namespace external-dns --service-account route53 --role-arn arn:aws:iam::111122223333:role/external-dns -
Deploy and confirm. Apply the cluster and inspect the pod log:
❱ kix deploy <cluster>❱ kubectl logs -n external-dns deploy/route53kix deploychecks that the pod receivedAWS_CONTAINER_CREDENTIALS_FULL_URIandAWS_CONTAINER_AUTHORIZATION_TOKEN_FILE, and theroute53log confirms records are written.
When EKS identity setup is wrong
Section titled “When EKS identity setup is wrong”During kix deploy, Kix inspects each new Deployment, StatefulSet, or DaemonSet pod and fails the workload with reason CloudIdentityNotApplied when expected identity variables are missing or overridden:
1pod <pod> (ServiceAccount `<sa>`) did not receive its cloud identity: <problem>. Kix stopped waiting for this workload. <fix>- Pod Identity mode with no AWS association:
<problem>iscontainer `external-dns` is missing `AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE` and `AWS_CONTAINER_CREDENTIALS_FULL_URI`, which EKS Pod Identity sets, and<fix>reads:Create an EKS Pod Identity association in AWS linking this ServiceAccount to the configured IAM role (Kix does not create it), and check that the EKS Pod Identity Agent add-on is running. Then restart the workload's pods. - IRSA mode while an AWS association exists: EKS gives an EKS Pod Identity association precedence over IRSA.
<problem>iscontainer `external-dns` has `AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE` and `AWS_CONTAINER_CREDENTIALS_FULL_URI`, so the cluster applied EKS Pod Identity instead of IAM roles for service accounts (IRSA), and<fix>tells you to delete the association in AWS and restart the pods, or switchcluster.flavor.eks.cloudIdentityto"pod-identity". Always delete the AWS association first when switching a ServiceAccount from"pod-identity"back to"irsa". - Container sets
AWS_ROLE_ARNitself: EKS webhooks leave existing container environment variables untouched. If a container setsAWS_ROLE_ARNto another value inenv,CloudIdentityNotAppliednames that value and tells you to remove it fromenv. Containers listed in the pod annotationeks.amazonaws.com/skip-containersreceive no identity variables in either mode and are skipped by this check. - What
CloudIdentityNotAppliedcannot catch: Kix cannot detect a role whose trust policy or IAM permissions are wrong (those appear only in the workload’s pod logs whilekix deployandkix statusreportok). In"pod-identity"mode, Kix also cannot read AWS associations: if an association names a different IAM role thanroleArn, the pod receives the association’s role andkix deploysucceeds.
Other operational details on EKS:
- Pod restarts and operator pods. Changing
roleArnupdateschecksum/cloud-identityon Kix-built pod templates and restarts those pods on deploy. Pods created by an operator (cnpg-cluster,stackgres-cluster) keep their old role until recreated; see each package’s guide. Do not changecert-manager’s role while an ACME DNS-01 challenge is pending, or the previous_acme-challengeTXT record can remain in Route 53 until the controller has a working role again. - AWS region and node credentials. Both IRSA and Pod Identity inject
AWS_REGIONautomatically. When you pass static AWS keys in a Secret instead, setAWS_REGIONorAWS_DEFAULT_REGIONexplicitly (external-dnsfails evaluation without one). Workloads with no cloud identity reach the node’s IAM role only if the node group’s instance metadata hop limit allows it; on the tested node group (hop limit1), pods received no node credentials.
DNS, storage, and load balancers
Section titled “DNS, storage, and load balancers”Cluster DNS and Route 53
Section titled “Cluster DNS and Route 53”EKS runs CoreDNS in kube-system with label k8s-app: kube-dns, matching Kix’s default DNS peer rule with no extra configuration.
For public DNS records and certificates in Route 53:
-
external-dns: Setprovider = "aws"with an IAM role ondeps.providerCredentials. Packagedexternal-dns0.24 readsexternal-dns.kubernetes.io/hostnameand ignores the olderexternal-dns.alpha.kubernetes.io/hostnameannotation unless you add"--enable-legacy-annotation-prefix"toextraArgs. See Publish DNS records with external-dns. -
cert-managerDNS-01: Pass an IAM role todeps.controllerIdentityoncert-managerand omit static key fields ondns01.route53. Replace<your-email>with a real email address because Let’s Encrypt rejectsexample.com, and replace111122223333with your AWS account ID:clusters/test-cloud-identity-eks.nix 147instances.cert-manager.cert-manager = {148package = packages.experimental.cert-manager;149deps.controllerIdentity = kix.cloudIdentity.aws {150roleArn = "arn:aws:iam::111122223333:role/cert-manager";151};152};153154instances.cert-manager.letsencrypt = {155package = packages.experimental.cluster-issuer;156config.spec.acme = {157server = "https://acme-staging-v02.api.letsencrypt.org/directory";158email = "<your-email>";159solvers = [ { dns01.route53.region = "eu-west-1"; } ];160};161};See Configure cert-manager issuers for solver options and deploy timeouts.
Persistent storage
Section titled “Persistent storage”EKS creates a gp2 StorageClass without marking it as the cluster default and creates no gp3 class, so kix.flavors.eks binds storageClasses as "absent". Any persistent-volume-claim without storageClassName fails kix check and asks for a storageClasses provider.
Install the aws-ebs-csi-driver EKS add-on so EBS volumes can bind, then either declare a class (such as gp3) with packages.storage-classes or import the cluster’s existing gp2 class with kix.mkImport. This repository example imports a class named "local-path"; on EKS, set both out.name and out.storageClassName to "gp2":
22 kube-system.platform-storage.package = kix.mkImport {23 kind = "StorageClass";24 apiVersion = "storage.k8s.io/v1";25 roles = [ "storageClasses" ];26 out = {27 name = "local-path";28 storageClassName = "local-path";29 };30 };See Configure storage classes and PVCs for creating gp3 or custom EBS classes with packages.storage-classes.
Load balancers
Section titled “Load balancers”By default, the EKS service controller creates a classic Elastic Load Balancer (ELB) for Services with type: LoadBalancer and deletes it when the Service is removed. kix deploy waits until status.loadBalancer.ingress receives the load balancer address, and kix status reports the Service unready until then.
The AWS Load Balancer Controller is not an EKS add-on (only EKS Auto Mode includes it); install it with Helm if you need it.
Turn on generated network policy
Section titled “Turn on generated network policy”A new EKS cluster does not enforce NetworkPolicy objects. Turn on enforcement in the Amazon VPC CNI add-on first, then enable policy generation in Kix.
Enable enforcement in the VPC CNI add-on
Section titled “Enable enforcement in the VPC CNI add-on”If vpc-cni is already an EKS-managed add-on on your cluster, turn on enableNetworkPolicy:
❱ aws eks update-addon --cluster-name <cluster> --addon-name vpc-cni --configuration-values '{"enableNetworkPolicy":"true"}' If vpc-cni is still self-managed on your cluster, create the managed add-on with --resolve-conflicts OVERWRITE and the same configuration:
❱ aws eks create-addon --cluster-name <cluster> --addon-name vpc-cni --resolve-conflicts OVERWRITE --configuration-values '{"enableNetworkPolicy":"true"}' Once applied, the aws-node pods in kube-system run with --enable-network-policy=true.
Configure cluster.flavor.eks.networkPolicy and cluster.network
Section titled “Configure cluster.flavor.eks.networkPolicy and cluster.network”Kix cannot read live EKS add-on settings. Set cluster.flavor.eks.networkPolicy = "vpc-cni"; alongside networkPolicy.enable = true; (leaving cluster.flavor.eks.networkPolicy at "none" fails the build so Kix never generates unenforced policies). Kix then writes standard NetworkPolicy objects (networking.k8s.io/v1), skips default deny in kube-system, and binds network-policy-enforcer as exclusive (rejecting a cilium instance). See Enable generated network policy.
Configure policy generation and your cluster’s address ranges under cluster.network:
33 networkPolicy.enable = true;34 cluster.flavor.eks.networkPolicy = "vpc-cni";35 cluster.network = {36 serviceCidr = "10.100.0.0/16";37 nodeCidrs = [ "192.168.0.0/16" ];38 apiServer.sources = [ { cidr = "192.168.0.0/16"; } ];39 };Kix asks for each cluster.network option only when a generated policy needs it:
-
cluster.network.serviceCidr(orcluster.network.apiServer.cidrs): Required when any workload’s ServiceAccount is bound to aRoleorClusterRole. On EKS, the VPC CNI evaluates outboundipBlockrules against thekubernetesService ClusterIP before address translation; the API server’s backing endpoint IPs do not match and change over time. When you setserviceCidr, Kix uses the range’s first IPv4 address for API server egress and excludesserviceCidrfrom outboundworldrules. Look upserviceCidrwith:❱ aws eks describe-cluster --name <cluster> --query 'cluster.kubernetesNetworkConfig.serviceIpv4Cidr' --output textAlternatively, look up the
kubernetesService address directly and setcluster.network.apiServer.cidrs = [ "<address>/32" ];:❱ kubectl get service kubernetes -n default -o jsonpath='{.spec.clusterIP}'Kix does not verify this address against the live cluster. If it is wrong,
kix deploysucceeds and existing connections stay open, so pods lose API server access only after they restart. -
cluster.network.nodeCidrsandcluster.network.apiServer.sources: Set both to your cluster’s VPC subnet CIDR blocks (or the whole VPC CIDR when all cluster subnets share it).nodeCidrsis required when policies target nodes (such as Prometheus scrapingnode-exporter), andapiServer.sourcesis required when workloads serve admission webhooks or aggregated APIs (cert-manager,external-secrets), which the EKS control plane calls from network interfaces in those subnets. List full subnet CIDR blocks so rules remain valid when control-plane IPs change:❱ aws eks describe-cluster --name <cluster> --query 'cluster.resourcesVpcConfig.subnetIds' --output text❱ aws ec2 describe-subnets --subnet-ids <subnet-id> --query 'Subnets[].CidrBlock' --output text -
cluster.network.podCidr: Leave unset. By default, pods take addresses from the same VPC subnets.
Workloads with an AWS cloud identity automatically receive outbound rules for credential fetching: TCP port 443 to world (AWS STS) for IRSA, or TCP port 80 to 169.254.170.23/32 and fd00:ec2::23/128 for the node-local EKS Pod Identity agent. Outbound world rules (0.0.0.0/0 and ::/0) always exclude link-local ranges (169.254.0.0/16 and fe80::/10), preventing pods without an identity from reaching EC2 metadata or the Pod Identity agent.
Check warnings and EKS platform limits
Section titled “Check warnings and EKS platform limits”Because standard NetworkPolicy uses CIDR blocks for nodes, Services, and external traffic, some generated rules allow more traffic than intended. Kix marks affected policies with the kix.run/network-policy-widened annotation:
- When a
cluster.networksetting can narrow the rule (for example, settingcluster.network.serviceCidrso outboundworldrules exclude ClusterIP Services),kix checkprints a warning naming that setting. - When the wider rule is a platform limit that no Kix setting can change,
kix checkhides it by default and lists it underkix check -v:
❱ kix check <cluster>❱ kix check <cluster> -v On EKS with the Amazon VPC CNI, kix check -v reports these platform limits:
- One-second startup window. Kubernetes
NetworkPolicyhas no readiness status, and in the VPC CNI’s defaultstandardmode a new pod can send outbound traffic for about one second before its egress policy takes effect. Enabling VPC CNI strict mode closes that window, though strict mode blocks pods that have noNetworkPolicy, including unmanaged pods inkube-system. - Shared VPC subnets. Nodes and pods share VPC subnets with VPC endpoints (such as STS), load balancers, and databases, so Kix cannot exclude those subnets from outbound
worldrules. As a result, outboundworldrules also reach nodes and pods on the allowed ports, and CIDR rules fornodeCidrsandapiServer.sourcesalso match pods in those subnets. - LoadBalancer ingress. Classic ELB forwards external traffic from a node or load balancer address inside the VPC, so
worldingress rules onLoadBalancerServices also accept traffic from pods and nodes.
Known limits and cleanup
Section titled “Known limits and cleanup”- Node autoscaling and metrics.
kix.flavors.ekssetsnodeAutoscaling = false(override when running Karpenter orcluster-autoscaler) and bindsmetricsApiasabsent. - Removing Kix from the cluster. Kix has no single uninstall command. Delete cloud-side objects managed by controllers (Route 53 records, Velero backups, or
Certificateobjects created withkubectl) while their controllers still run. Then reduce your cluster definition tokix.flavors.eksand runkix deploy <cluster> --prune. Kix removes workloads, policies, and claims while keepingNamespaceandCustomResourceDefinitionobjects, itsActivationrecords, and the flavor’s import records inkube-system. See Remove everything a Kix cluster deployed.
What has not been tested
Section titled “What has not been tested”Live EKS testing covered an EKS 1.37 cluster with two Amazon Linux 2023 nodes and managed add-ons vpc-cni (v1.22 with network policy agent v1.4), coredns, kube-proxy, eks-pod-identity-agent, and aws-ebs-csi-driver. These configurations have not been tested yet:
- AWS Load Balancer Controller, Network Load Balancers (NLB), and IP-mode targets: Live tests covered only classic ELBs with instance targets. Provisioning NLBs or Application Load Balancers (ALBs) and enforcing VPC CNI network policy on IP-mode targets have not been tested.
- IPv6 clusters: The IPv6 EKS Pod Identity agent rule (
fd00:ec2::23/128) comes from AWS documentation and has not been tested live. - EKS Auto Mode.
- Amazon VPC CNI strict enforcement mode.
- VPC CNI custom networking (pods assigned addresses from dedicated secondary subnets).