Skip to content

Resolve node.attr.zone via the Node label instead of cloud IMDS - #900

Draft
goat-ssh wants to merge 1 commit into
masterfrom
s/downward-api-zone
Draft

Resolve node.attr.zone via the Node label instead of cloud IMDS#900
goat-ssh wants to merge 1 commit into
masterfrom
s/downward-api-zone

Conversation

@goat-ssh

@goat-ssh goat-ssh commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

CrateDB's node.attr.zone (used for zone-aware shard allocation) was queried per-provider from each cloud's instance metadata service at 169.254.169.254. That endpoint needs pod egress to survive on all four providers, and it's a classic SSRF/pivot target — closing it off at the NetworkPolicy layer (crate/cloud#3850, crate/cloud#3851) breaks zone detection on every cluster.

Read the pod's own Node object via the in-cluster API server instead: the topology.kubernetes.io/zone label is already populated consistently by AWS, Azure, GCP and STACKIT's cloud-controller-managers. One code path for all four providers, and no pod egress to IMDS required.

Requires a ClusterRole/ClusterRoleBinding granting the cluster's default ServiceAccount read-only access to its own Node object; the binding is per-cluster and explicitly cleaned up on delete, since a namespaced CrateDB CR can't own a cluster-scoped object via owner_references.

Every provider's crate pod restarts once to pick up the new command and NODE_NAME env var.

Checklist

  • Link to issue this PR refers to:
  • Relevant changes are reflected in CHANGES.rst
  • Added or changed code is covered by tests
  • Documentation has been updated if necessary
  • Changed code does not contain any breaking changes (or this is a major version change)

CrateDB's node.attr.zone (used for zone-aware shard allocation) was
queried per-provider from each cloud's instance metadata service at
169.254.169.254. That endpoint needs pod egress to survive on all four
providers, and it's a classic SSRF/pivot target — closing it off at
the NetworkPolicy layer (crate/cloud#3850, crate/cloud#3851) breaks
zone detection on every cluster.

Read the pod's own Node object via the in-cluster API server instead:
the topology.kubernetes.io/zone label is already populated consistently
by AWS, Azure, GCP and STACKIT's cloud-controller-managers. One code
path for all four providers, and no pod egress to IMDS required.

Requires a ClusterRole/ClusterRoleBinding granting the cluster's
default ServiceAccount read-only access to its own Node object; the
binding is per-cluster and explicitly cleaned up on delete, since a
namespaced CrateDB CR can't own a cluster-scoped object via
owner_references.

Every provider's crate pod restarts once to pick up the new command
and NODE_NAME env var.
@goat-ssh
goat-ssh marked this pull request as draft September 4, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant