A Kubernetes controller that automatically applies zone labels to nodes based on custom label.
This controller watches for nodes with the altinity.cloud/auto-zone
label and automatically applies the standard Kubernetes zone labels to those nodes. This is useful for environments where nodes need custom zone assignment that differs from the cloud provider's default zone detection.
The controller continuously monitors all nodes in the cluster. When it detects a node with the configured label key (default: altinity.cloud/auto-zone
), it automatically applies both current and legacy Kubernetes zone labels with the specified value.
The label key to watch can be configured via:
- CLI flag:
--label-key="your.label/key"
- Environment variable:
LABEL_KEY=your.label/key
- Default:
altinity.cloud/auto-zone
Note: CLI flag takes precedence over environment variable.
- Configurable label key (default:
altinity.cloud/auto-zone
): The desired zone value for the node
When a node has the configured input label, the controller will automatically apply:
topology.kubernetes.io/zone
: The current standard Kubernetes zone labelfailure-domain.beta.kubernetes.io/zone
: The legacy zone label for backward compatibility
To assign a node to zone eu-central-1a
:
kubectl label node <node-name> altinity.cloud/auto-zone=eu-central-1a
To use a custom label key via environment variable:
export LABEL_KEY=mycompany.io/zone
# Then start the controller
Or via CLI flag:
./controller --label-key="mycompany.io/zone"
Then label your nodes:
kubectl label node <node-name> mycompany.io/zone=us-west-2a
The controller will automatically apply:
topology.kubernetes.io/zone=us-west-2a
failure-domain.beta.kubernetes.io/zone=us-west-2a
Deploy the controller using the provided manifests:
kubectl apply -f https://raw.githubusercontent.com/Altinity/node-zone-controller/refs/heads/main/deploy/deploy.yaml
This will create:
- A deployment running the controller
- RBAC permissions for the controller to read and patch nodes