Skip to content

Igloo on Azure

An OpenTofu module that deploys a complete Igloo warehouse into one Azure subscription with a single tofu apply: an AKS cluster running Igloo and the Lakekeeper catalog, table data in Azure Data Lake Storage Gen2, and catalog metadata in Azure Database for PostgreSQL. Nothing uses long-lived Azure credentials: Igloo and Lakekeeper each sign in to Azure with their own Kubernetes workload identity.

SQL clients ──▶ (port-forward, or a load balancer limited to sql_allowed_cidrs)
│
┌─ AKS ──────────▼───────────────────────────────────────────┐
│ igloo pods (Igloo node pool) lakekeeper pod (system pool)│
│ workload identity "igloo" workload identity "catalog"│
└───────┬───────────────────────────────┬─────────────────────┘
│ abfss:// (Entra ID auth, │ postgresql://...sslmode=require
│ storage firewall: AKS subnet) │ (private subnet, private DNS)
▼ ▼
ADLS Gen2 filesystem PostgreSQL 17 Flexible Server
(table data) database "igloo": Lakekeeper (schema public),
Igloo users and roles (schema igloo_auth)
  • OpenTofu 1.9 or later (or Docker, see Testing).
  • The Azure CLI, signed in with az login.
  • kubectl and psql to connect afterwards.
  • On the target subscription: Owner, or Contributor plus Role Based Access Control Administrator (the module creates role assignments). tofu registers the resource providers the module uses (Microsoft.Authorization, Microsoft.Compute, Microsoft.ContainerService, Microsoft.DBforPostgreSQL, Microsoft.ManagedIdentity, Microsoft.Network, Microsoft.Storage) if the subscription has not registered them yet.
  • vCPU quota in the region for the VM families you use. The defaults need the Standard DPSv6 Family (2 to 6 vCPUs) and Standard EPSv6 Family (8 to 16 vCPUs); Spot nodes draw from the separate low-priority quota. Check with:
    Terminal window
    az vm list-usage --location eastus2 --output table | grep -i -E 'psv6|low-priority'
  • The Igloo chart at deploy/helm/igloo in this repository (or set chart_path).
Terminal window
cd deploy/azure
export ARM_SUBSCRIPTION_ID=$(az account show --query id --output tsv)
cat > terraform.tfvars <<'EOF'
name = "igloo"
location = "eastus2"
# Optional: allow only your address to reach the Kubernetes API.
# api_server_authorized_ip_ranges = ["203.0.113.7/32"]
# Optional: a public SQL endpoint. Requires an allow list; give it TLS
# (see below).
# expose_sql = true
# sql_allowed_cidrs = ["203.0.113.0/24"]
# sql_dns_label = "acme-igloo"
# Optional: cheaper, interruptible Igloo nodes.
# spot_enabled = true
# Optional: one large worker, beside the distributed-execution workers on Spot
# VMs (Regular ones when Spot has no capacity) that run by default.
# large_worker_enabled = true
EOF
# With expose_sql, pass the certificate and key through the environment
# (tfvars files cannot read files):
# export TF_VAR_tls_certificate_pem="$(cat fullchain.pem)"
# export TF_VAR_tls_private_key_pem="$(cat privkey.pem)"
tofu init
tofu apply # about 15-25 minutes
tofu output next_steps

terraform.tfvars is ignored by git (see .gitignore). Every input is documented in variables.tf.

Resource Default Notes
Resource group <name>-rg AKS keeps its VMs in <name>-rg-aks-nodes.
Virtual network 10.42.0.0/16 Subnet aks-nodes (/20, service endpoint for Storage) and subnet postgres (/24, delegated to PostgreSQL).
AKS cluster Free tier, Azure CNI Overlay with Cilium OIDC issuer and workload identity on, automatic patch upgrades, Kubernetes RBAC.
System node pool Standard_D2ps_v6 × 1-3 Cluster add-ons and the Lakekeeper catalog.
Igloo node pool Standard_E4pds_v6 × 2-4 Ephemeral OS disk on each VM’s local NVMe disk, which holds the spill directory. Label igloo/pool=query; Igloo pods select it. Spot when spot_enabled.
Storage account StorageV2, ZRS, hierarchical namespace TLS 1.2, HTTPS only, no public blob access, shared keys off, firewall default deny, 7-day soft delete.
ADLS Gen2 filesystem igloo Warehouse at abfss://igloo@<account>.dfs.core.windows.net/warehouse.
Managed identities <name>-igloo, <name>-catalog, <name>-aks Federated credentials bind the first two to the igloo and igloo-catalog service accounts.
PostgreSQL Flexible Server 17 B_Standard_B2s, 32 GiB, 7-day backups, no HA Private access only; TLS required; database igloo.
Private DNS zone <name>.private.postgres.database.azure.com Linked to the VNet.
Kubernetes namespace igloo Pod Security: baseline enforced, restricted warned.
Kubernetes Secrets igloo-admin, igloo-database, igloo-catalog-encryption (+ igloo-tls) Generated passwords and keys; the chart reads them by name.
Helm release igloo from deploy/helm/igloo Skipped with install_chart = false; the helm_values output holds the values.
Public IP only with expose_sql Static, so the address survives chart reinstalls.
Worker node pools unless workers_enabled = false workerspot (Spot) and workerreg (Regular), Standard_D16pds_v6 × 0-16, for distributed-execution workers; with large_worker_enabled, largereg (Standard_E64pds_v6 × 0-1). The cluster autoscaler then uses the priority expander.
Identity Role Scope Why
igloo Storage Blob Data Contributor the filesystem DuckDB reads and writes table files.
catalog Storage Blob Data Contributor the filesystem Lakekeeper validates the warehouse and manages metadata files.
catalog Storage Blob Delegator the storage account Lakekeeper vends short-lived user-delegation SAS tokens. Azure accepts this permission only at account scope; it grants no data access by itself.
aks (control plane) Network Contributor the resource group AKS joins nodes to the subnet and attaches the static SQL IP to its load balancer.

First point kubectl at the cluster (the exact command is in the get_credentials_command output):

Terminal window
az aks get-credentials --resource-group igloo-rg --name igloo-aks --overwrite-existing

If you set admin_group_object_ids, also run kubelogin convert-kubeconfig -l azurecli.

The first administrator is igloo (admin_user). Its password is generated and stored in the Secret named by the admin_password_secret_name output:

Terminal window
export PGPASSWORD="$(kubectl --namespace igloo get secret igloo-admin \
--output jsonpath='{.data.password}' | base64 --decode)"

Change it after the first login with ALTER USER; the Secret is only used to create the account on first start.

Igloo has no public endpoint unless you ask for one:

Terminal window
kubectl --namespace igloo port-forward service/igloo 5433:5432
psql "host=127.0.0.1 port=5433 user=igloo dbname=igloo"

Spark, Trino, PyIceberg and other engines use the tables through Igloo’s Iceberg REST catalog on port 8181 of the same Service (kubectl --namespace igloo port-forward service/igloo 8181:8181, or http://igloo.igloo.svc:8181 inside the cluster), signed in as Igloo users. Igloo does not hand out credentials for Azure storage yet, so engines get table metadata only: to read or write the files they need an identity of their own with access to the filesystem, whose reach Igloo’s grants do not limit. On the load balancer below, the port serves only over TLS; without a certificate it refuses clients outside private networks.

Through a load balancer (expose_sql = true)

Section titled “Through a load balancer (expose_sql = true)”

The SQL port is published on a static public IP, and Azure’s network security group admits only sql_allowed_cidrs:

Terminal window
psql "host=$(tofu output -raw sql_endpoint_ip) port=5432 user=igloo dbname=igloo sslmode=require"

Without tls_certificate_pem and tls_private_key_pem, passwords are still protected by SCRAM, but queries and results cross the internet unencrypted; tofu plan warns about this. With sql_dns_label, the endpoint is also <label>.<location>.cloudapp.azure.com, a name you can get a certificate for.

Igloo images are multi-arch (amd64 and arm64), so both node pools default to Arm64 VMs on Azure Cobalt 100, which cost less than comparable x86 sizes. Each Igloo pod is a complete DuckDB engine and benefits more from memory than from cores, so Igloo nodes are memory-optimized: one Standard_E4pds_v6 (4 vCPU, 32 GiB, 220 GiB local NVMe disk) per pod, with the pod requesting 2 CPUs and 24 GiB (igloo_cpu, igloo_memory) and free to use idle cores. DuckDB uses about 80% of the memory limit before spilling to igloo_spill_size of the node’s OS disk, which is on that NVMe disk (Spill on local NVMe).

To change sizes, keep the pod’s memory a few GiB below the node’s: AKS reserves about 2.5 GiB per node and the system daemons need a little more. Examples:

Igloo node igloo_memory Notes
Standard_E4pds_v6 (4 vCPU, 32 GiB, 220 GiB NVMe) 24Gi Default
Standard_E8pds_v6 (8 vCPU, 64 GiB, 440 GiB NVMe) 52Gi Larger queries
Standard_E4pds_v5 (4 vCPU, 32 GiB, 150 GiB local SSD) 24Gi Ampere Altra; wider regional availability
Standard_E4ads_v5 (4 vCPU, 32 GiB, 150 GiB local SSD) 24Gi x86 (AMD) fallback
Standard_E4ps_v6 (4 vCPU, 32 GiB) 24Gi No local disk: spill on a managed Premium SSD of igloo_node_os_disk_size_gb (AKS picks 128 GB)

If a size is not offered in your region, tofu apply fails creating the node pool. Check with az vm list-skus --location <region> --size Standard_E4pds --output table.

With spot_enabled = true the Igloo pool runs on Spot VMs. Azure can evict them at any time, which interrupts running queries and briefly reduces capacity until the autoscaler replaces them; the catalog stays on regular nodes.

DuckDB writes queries larger than memory (big joins, aggregations and sorts) to its spill directory and reads them back; heavy reports spill tens to hundreds of GiB. The directory is an emptyDir of igloo_spill_size, which kubelet keeps on the node’s OS disk. A managed OS disk is a remote Premium SSD: 128 GiB gives 500 IOPS and 100 MB/s. The local NVMe disk of a Standard_E4pds_v6 is rated at 75,000 read and 30,000 write IOPS.

So the module gives Igloo nodes an ephemeral OS disk on their local disk whenever the size has one: igloo_node_os_disk_type defaults to Ephemeral for sizes with a d after the vCPU count (Standard_E4pds_v6, Standard_E8pds_v6, Standard_E4ads_v5) and to Managed for the rest. With igloo_node_os_disk_size_gb unset, AKS sizes an ephemeral OS disk to the whole local disk (220 GiB on Standard_E4pds_v6); what the operating system and container images leave of it holds the spill. For reports that spill around 100 GiB, set igloo_spill_size = "120Gi"; DuckDB stops at 90% of it, so a query that needs more fails instead of filling the disk. For more, use a larger size (Standard_E8pds_v6 has 440 GiB).

An ephemeral OS disk is lost when a node is reimaged, upgraded or replaced. AKS nodes keep no state there, and spill files only live for a query. Sizes with less than 128 GiB of local disk (the 2-vCPU ones) need igloo_node_os_disk_size_gb set to fit, or igloo_node_os_disk_type = "Managed". AKS’s other way to put emptyDir volumes on the temp disk, kubelet_disk_type = "Temporary", is a preview feature (KubeletDisk) that must be registered on the subscription, so the module does not use it.

Changing igloo_node_vm_size, igloo_node_os_disk_type or igloo_node_os_disk_size_gb replaces the Igloo nodes: the provider cycles the pool through a temporary one (iglootmp) without draining it first, so queries running on the old nodes end. A deployment made with the earlier default size keeps its nodes, and its managed OS disks, with igloo_node_vm_size = "Standard_E4ps_v6".

workers_enabled, on by default, runs statements that read very large tables in parts on worker pods (distributed execution). No worker machine starts until a statement is worth one, so a deployment with no heavy queries pays nothing for them; each running worker then costs its machine’s price, and stops when idle. With it on, the module adds two node pools for workers, both autoscaling from zero nodes to workers_max (16), which is 256 vCPUs at once where a statement is worth it, and nothing when idle: check the Standard DPDSv6 Family and low-priority quotas above, or lower workers_max. A node Azure refuses leaves its worker unstarted, and the statement runs on fewer, or on an igloo pod when workers.startTimeout runs out. The pools:

Workers have a workload identity of their own: they read the warehouse, and may only write files in _igloo_shuffle/ and statements’ directories (igloo-write-* under a table’s data/), by a role that holds those two actions and a role assignment condition, with no move, delete or container action, as they write tables’ files. DuckDB creates a file and then appends to it, which takes the right to write, and so to overwrite, in those directories. A worker can then change what is in a statement’s directory, and nothing in a table: Igloo commits its own copies, in directories no worker can write to.

  • workerspot, Spot VMs of workers_vm_size (Standard_D16pds_v6: 16 vCPU, 64 GiB, 880 GiB local NVMe disk), unless workers_spot = false;
  • workerreg, Regular VMs of the same size, to fall back to.

Both carry the node label igloo.dev/node=workers and the taint igloo.dev/workers=true:NoSchedule; the Spot pool also has the kubernetes.azure.com/scalesetpriority=spot:NoSchedule taint AKS gives Spot nodes. The chart’s worker pods select the label and tolerate both taints, so they may land on either pool. Igloo pods stay on the Igloo pool (Regular unless spot_enabled): they hold client sessions. One worker fills a node (workers_cpu 14, workers_memory 54Gi), with an ephemeral OS disk on the local NVMe disk holding its spill (workers_spill_size, 480Gi) and read cache (workers_cache_size, 220Gi); change those four with workers_vm_size.

Igloo scales the worker Deployment up when a statement needs workers and to zero when they are idle, and AKS’s cluster autoscaler adds and removes the nodes. The module sets its expander to priority and creates the cluster-autoscaler-priority-expander ConfigMap in kube-system, which ranks the Spot pools (.*workerspot.*, .*largespot.*) at 50 and every other pool at 10, so the system and Igloo pools scale as before. The autoscaler tries the Spot pool first; when Azure has no Spot capacity or quota for the size, the scale set’s failure, or at the latest a node that has not joined within max_node_provisioning_time (5 minutes), backs the Spot pool off, and the Regular pool gets the worker. A statement waits for workers at most workers.startTimeout (3 minutes) and then runs on its igloo pod, so a statement that meets a Spot shortage may run without workers. When Azure evicts a Spot VM, the worker’s tasks fail over to other workers, as a lost worker’s do; with spot_max_price = -1 (the default) Azure evicts for capacity only, never for price.

The large worker (large_worker_enabled = true) is one pod on a Standard_E64pds_v6 (64 vCPU, 512 GiB, local NVMe) in its own pool, largereg, from zero to one node, which auto mode may run a whole statement on (see the chart’s large worker). It is Regular by default; large_worker_spot = true adds largespot and tries it first. Its spill and read cache (large_worker_spill_size, large_worker_cache_size) default to 480Gi and 220Gi, which fit one 880 GiB local disk; a statement auto mode sends there is one that fits in its memory.

Set workers_price_per_hour and large_worker_price_per_hour to what a node costs, so auto mode can weigh price. Spot VMs typically cost 60 to 90% less than Regular ones, varying by region and over time. Left at 0, the price is unknown. Workers need vCPU quota for the Standard DPSv6 Family (Regular), the low-priority quota (Spot), and with the large worker 64 more vCPUs of the Standard EPSv6 Family.

Approximate pay-as-you-go list prices in East US 2, 730 hours a month. Check the Azure pricing calculator for your region and any discounts.

Item Monthly
AKS control plane, Free tier $0 (Standard tier with SLA: ~$73)
System node: 1 × Standard_D2ps_v6 + 64 GiB Premium SSD ~$65
Igloo nodes: 2 × Standard_E4pds_v6, ephemeral OS disks (no disk charge) ~$340
Standard load balancer and its outbound IP ~$22
PostgreSQL B_Standard_B2s + 32 GiB storage (backups included up to that size) ~$30
Private DNS zone ~$0.50
Total before data ~$460
ADLS Gen2 (Hot, ZRS) ~$23 per TB stored, plus operations
SQL public IP (expose_sql) ~$4

Spot Igloo nodes typically cut the node line by 60-90%. During rolling updates the autoscaler briefly adds an Igloo node (up to igloo_node_max_count). Worker and large-worker pools cost nothing while they have no nodes, and are billed per VM-hour while workers run.

  • No keys for storage. Shared-key access is disabled on the storage account (storage_shared_key_enabled = false) because both Igloo and Lakekeeper authenticate with Entra ID workload identities; there is no account key to leak or rotate. The storage firewall denies everything except the AKS subnet (via a service endpoint) and storage_allowed_ip_ranges. This module manages the filesystem through Azure Resource Manager, so tofu itself never needs to reach the storage data plane.

  • Narrow data roles. Data roles are scoped to the filesystem, not the account. Lakekeeper’s warehouse is created with its Azure system identity, so Lakekeeper can reach anything the catalog identity can, and nothing more.

  • Private database. PostgreSQL has no public endpoint, accepts only TLS connections, and logs connections and checkpoints.

  • The state file contains secrets: the PostgreSQL, administrator and catalog-encryption passwords, and the cluster’s admin kubeconfig. Keep state in an access-controlled, encrypted remote backend, for example an Azure storage account with Entra ID auth (create it beforehand, separately from this module). Add a backend.tf like:

    # terraform {
    # backend "azurerm" {
    # resource_group_name = "tfstate-rg"
    # storage_account_name = "tfstateacme123"
    # container_name = "tfstate"
    # key = "igloo-azure.tfstate"
    # use_azuread_auth = true
    # }
    # }

    OpenTofu can also encrypt state client-side (state encryption); store the passphrase outside the state backend.

  • Kubernetes API. The API server is public by default so tofu can install the chart from your machine; requests need cluster credentials. Restrict it with api_server_authorized_ip_ranges, and set admin_group_object_ids to use Entra ID sign-in with Azure RBAC for people.

  • Network policies. The cluster runs Cilium, which enforces the chart’s NetworkPolicies (only Igloo pods may reach Lakekeeper).

trivy config reports these on purpose:

Check Why it stays
AZU-0041 API server authorized IP ranges The module cannot know your address; set api_server_authorized_ip_ranges.
AZU-0065 private cluster tofu would then need network access into the VNet to install the chart.
AZU-0040 Azure Monitor logging, AZU-0057 storage logging Log Analytics ingestion is billed per GB; add diagnostic settings or Container Insights if you need them.
AZU-0066 Azure Policy add-on Governance is usually applied per organization, not per workload.
AZU-0067 disk encryption set, AZU-0060 customer-managed keys Disks and storage are encrypted with platform keys (storage also with infrastructure encryption). Customer-managed keys need a Key Vault you manage.
AZU-0058 geo-redundant storage ZRS survives a zone outage; set storage_replication_type = “GZRS” for regional disaster recovery at higher cost.
AZU-0021 PostgreSQL connection throttling The server has no public endpoint, and all Igloo traffic shares node addresses, so throttling by IP would hurt more than it protects.
  • Upgrade Igloo: set image_tag and run tofu apply.
  • Pull from a mirror or private registry: set image_repository; empty uses the chart’s default. The AKS nodes must be able to pull from it.
  • Scale: replica_count adds Igloo pods; the node pool autoscales between igloo_node_min_count and igloo_node_max_count. Keep the maximum above replica_count so rolling updates can add a node.
  • Install the chart yourself: set install_chart = false, then tofu output -raw helm_values > values.yaml and helm install igloo ../helm/igloo --namespace igloo --values values.yaml.
  • Lakekeeper’s encryption key (igloo-catalog-encryption) must never change once the catalog holds data; do not taint random_password.catalog_encryption_key.
Terminal window
tofu destroy

This deletes everything, including all table data and the catalog database. Back up or copy the filesystem first if you need it. Deleted blobs stay recoverable for storage_soft_delete_retention_days only while the storage account exists.

The tests plan the module with every provider mocked, so they need no Azure account or credentials. With Docker:

Terminal window
cd deploy/azure
docker run --rm -v "$PWD":/work -w /work ghcr.io/opentofu/opentofu:1.13.1 fmt -check -recursive
docker run --rm -v "$PWD":/work -w /work ghcr.io/opentofu/opentofu:1.13.1 init -backend=false
docker run --rm -v "$PWD":/work -w /work ghcr.io/opentofu/opentofu:1.13.1 validate
docker run --rm -v "$PWD":/work -w /work ghcr.io/opentofu/opentofu:1.13.1 test
  • SkuNotAvailable or quota errors creating a node pool: pick a size from the Sizing table that your region offers, or request quota.
  • Igloo or Lakekeeper pods report AADSTS70021 or 403 from storage right after the first apply: new federated credentials and role assignments can take a few minutes to reach every Azure front end. The module waits 60 seconds; the pods recover on restart.
  • tofu apply cannot reach the Kubernetes API after you set api_server_authorized_ip_ranges: add the address you run tofu from.