Skip to main content

Labels and Annotations

Stratos uses labels, annotations, and cloud tags to track node state and ownership. This document provides a complete reference.

Kubernetes Node Labels

Labels set by Stratos on managed Kubernetes nodes:

LabelDescriptionExample Values
stratos.sh/poolNodePool name managing this nodeworkers, ci-runners
stratos.sh/stateCurrent Stratos statewarmup, standby, running, terminating
stratos.sh/instance-idCloud instance IDi-0123456789abcdef0
stratos.sh/state-sinceTimestamp when state changed2024-01-15T10:30:00Z

Querying by Labels

# Get all nodes in a pool
kubectl get nodes -l stratos.sh/pool=workers

# Get nodes by state
kubectl get nodes -l stratos.sh/pool=workers,stratos.sh/state=standby

# Get running nodes
kubectl get nodes -l stratos.sh/pool=workers,stratos.sh/state=running

# Custom columns output
kubectl get nodes -l stratos.sh/pool=workers \
-o custom-columns='NAME:.metadata.name,STATE:.metadata.labels.stratos\.sh/state,INSTANCE:.metadata.labels.stratos\.sh/instance-id'

Kubernetes Node Annotations

Annotations set by Stratos on managed Kubernetes nodes:

AnnotationDescriptionExample Values
stratos.sh/warmup-completedWhen warmup finished2024-01-15T10:25:00Z
stratos.sh/last-startedWhen node was last started2024-01-15T10:30:00Z
stratos.sh/scale-down-candidate-sinceWhen node became empty2024-01-15T11:00:00Z
stratos.sh/scale-up-startedWhen scale-up was triggered2024-01-15T10:30:00Z

Scale-Up Tracking

The stratos.sh/scale-up-started annotation is used for in-flight tracking to prevent duplicate scale-ups:

  • TTL: 60 seconds
  • Purpose: Track nodes that have been triggered for scale-up but are not yet Ready
  • Cleared: When node becomes Ready or TTL expires

Scale-Down Tracking

The stratos.sh/scale-down-candidate-since annotation marks when a node became empty:

  • Set: When node has no scheduled pods (excluding DaemonSets)
  • Cleared: When pod is scheduled on the node
  • Used for: Determining when emptyNodeTTL has elapsed

Cloud Instance Tags

Tags set by Stratos on cloud instances (e.g., EC2):

TagDescriptionExample Values
managed-byIdentifies Stratos-managed instancesstratos
stratos.sh/poolNodePool nameworkers
stratos.sh/clusterKubernetes cluster nameproduction
stratos.sh/stateCurrent Stratos statewarmup, standby, running, terminating

Tag Usage

These tags are used for:

  1. Discovery: Finding managed instances on controller startup
  2. Filtering: Listing instances by pool
  3. Auditing: Cost allocation and resource tracking
  4. Security: Scoping IAM policies to Stratos-managed resources

AWS CLI Queries

# List all Stratos-managed instances
aws ec2 describe-instances \
--filters "Name=tag:managed-by,Values=stratos" \
--query 'Reservations[].Instances[].{ID:InstanceId,State:State.Name,Pool:Tags[?Key==`stratos.sh/pool`].Value|[0]}'

# List instances in a specific pool
aws ec2 describe-instances \
--filters "Name=tag:stratos.sh/pool,Values=workers" \
--query 'Reservations[].Instances[].{ID:InstanceId,State:State.Name}'

# List standby instances
aws ec2 describe-instances \
--filters "Name=tag:stratos.sh/state,Values=standby" \
--query 'Reservations[].Instances[].InstanceId'

User-Defined Labels

Labels specified in spec.template.labels are applied to managed nodes:

spec:
template:
labels:
stratos.sh/pool: workers # Automatically added
node-role.kubernetes.io/worker: ""
environment: production
team: platform
note

The stratos.sh/pool label is automatically added and matches the NodePool name. You don't need to specify it explicitly, but if you do, it must match the NodePool name.

User-Defined Tags

Tags specified in spec.template.cloudProvider.aws.tags are applied to instances:

spec:
template:
cloudProvider:
aws:
tags:
Environment: production
Team: platform
CostCenter: engineering

These are merged with Stratos management tags. User tags cannot override management tags.

Taints

Permanent Taints

Taints specified in spec.template.taints persist throughout the node lifecycle:

spec:
template:
taints:
- key: dedicated
value: workers
effect: NoSchedule

Startup Taints

Startup taints block scheduling until CNI is ready:

spec:
template:
startupTaints:
- key: node.eks.amazonaws.com/not-ready
value: "true"
effect: NoSchedule
Important

Startup taints must match the --register-with-taints argument in your user data script.

Standby Taint

Stratos applies a standby taint to cordoned nodes:

Taint KeyValueEffect
stratos.sh/standby-NoExecute

This taint ensures pods are evicted from standby nodes.

Label Selectors

Pod Matching

Stratos uses labels to determine which pools can satisfy pending pods:

  1. Pods must tolerate all permanent taints on the pool
  2. Pod node selectors must match pool labels
  3. Pod affinity/anti-affinity rules are evaluated

Node Selection

When scaling up, Stratos selects standby nodes matching:

  • stratos.sh/pool=<pool-name>
  • stratos.sh/state=standby

Prometheus Label Cardinality

Metrics use these labels:

Metric LabelSourceValues
poolNodePool nameOne per NodePool
stateNode statewarmup, standby, running, terminating
providerCloud provideraws, fake
operationCloud API operationlaunch, start, stop, terminate, describe
statusOperation resultsuccess, error
triggerTaint removal triggernetwork_ready, timeout, external
resultTaint removal resultsuccess, error
reasonWarmup failure reasontimeout, error
typeError typeVaries by error

Next Steps