Updated 3 November 2026 · Published by Zoorik
Each module creates the same identity, role and permissions as zoorikctl connect, with the same names, so zoorikctl treats them as done. Both modules are Apache-2.0, on the Terraform Registry.
AKS
Before you apply
- Turn on the cluster’s OIDC issuer and workload identity (
oidc_issuer_enabledandworkload_identity_enabled). - Point the azurerm provider at the cluster’s subscription.
- Custom role names are unique in a tenant, so only one module call creates the role. Other clusters pass that call’s
role_definition_idoutput. If they are in other subscriptions, list those subscriptions in the creating call’srole_assignable_scopes.
The module
module "zoorik_coral" {
source = "getzoorik/zoorik-coral/azurerm"
version = "~> 0.1"
cluster_id = "<AKS resource id>"
location = "<region>"
oidc_issuer_url = "<the cluster's OIDC issuer URL>"
}It creates the user-assigned managed identity zoorik-agent-<cluster> with the federated credential zoorik-agent, and the custom role Zoorik Node Removal v2, assigned on this cluster only. Its output client_id is the identity’s client id.
Install the agent
Install the chart as Install Coral with Helm says, with these values:
clusterResourceId: <cluster_id>
serviceAccount:
annotations:
azure.workload.identity/client-id: <client_id>The namespace and the service account are both fixed at zoorik-agent, because the federated credential is bound to them.
EKS
Before you apply
- For Pod Identity, install the
eks-pod-identity-agentadd-on, unless EKS Auto Mode is on. - For Pod Identity, apply this module before you install the chart: the agent gets AWS credentials only if the association exists when its pod starts. If the agent already runs, restart it once after the apply:
kubectl --context <context> -n zoorik-agent rollout restart deployment/.zoorik-agent - For IRSA, set
irsa_oidc_issuer_url. The cluster’s IAM OIDC provider must already exist. - Point the aws provider at the cluster’s account and region.
The module
module "zoorik_coral" {
source = "getzoorik/zoorik-coral/aws"
version = "~> 0.1"
cluster_name = "<EKS cluster name>"
}It creates the IAM role zoorik-agent-<cluster>, its inline policy, and the EKS Pod Identity association for zoorik-agent/. With irsa_oidc_issuer_url set, the role trusts the cluster’s IAM OIDC provider instead, and no association is created. Its output role_arn is the role’s ARN.
Install the agent
Install the chart as Install Coral with Helm says. With Pod Identity, set only:
clusterResourceId: <cluster ARN>
With IRSA:
clusterResourceId: <cluster ARN>
serviceAccount:
annotations:
eks.amazonaws.com/role-arn: <role_arn>Pool minimums
The modules let the agent remove nodes and, by default, reduce a pool’s or group’s minimum (lower_minimums = true), the same default as zoorikctl. With lower_minimums = false, the agent can’t reduce a minimum.
The agent records the old minimum in tags, and zoorikctl cluster disconnect puts it back. The tags are coral. and coral. on AKS, and coral. and coral. on EKS.
Your own node pool code
If Terraform manages your node pools, tell it to ignore the fields the agent changes, or each apply undoes them. On AKS, for azurerm_kubernetes_cluster_node_pool:
lifecycle {
ignore_changes = [
min_count,
tags["coral.zoorik.com_original-min"],
tags["coral.zoorik.com_lowered-min"],
]
}For the default pool in azurerm_kubernetes_cluster, the same fields sit under default_node_pool[0].
On EKS, each node the agent removes also reduces its group’s desired size. For aws_eks_node_group:
lifecycle {
ignore_changes = [
scaling_config[0].min_size,
scaling_config[0].desired_size,
tags["coral.zoorik.com/original-min"],
tags["coral.zoorik.com/lowered-min"],
]
}For aws_autoscaling_group, ignore min_size, desired_capacity and tag.