Labels

There are two main types of labels that kops can create:

  • CloudLabels become tags in AWS on the instances
  • NodeLabels become labels on the k8s Node objects

Both are specified at the InstanceGroup level.

A nice use for cloudLabels is to specify AWS cost allocation tags.

A good use for nodeLabels is to implement nodeSelector labels.CloudLabels and nodeLabels are automatically applied to new nodes created by AWS EC2 auto scaling groups.

An example:

kops edit ig nodes

  1. ...
  2. spec:
  3. nodeLabels:
  4. spot: "false"
  5. cloudLabels:
  6. team: me
  7. project: ion
  8. ...

Note that keys and values are strings, so you need quotes around values that YAML would otherwise treat as numbers or booleans.

To apply changes, you’ll need to do a kops update cluster and then likely a kops rolling-update cluster

For AWS if kops rolling-update cluster --instance-group nodes returns “No rolling-update required.” thekops rolling-update cluster --force flag can be used to force a rolling update, even when no changes are identified.

Example:

kops rolling-update cluster --instance-group nodes --force