A crucial part of scale out architecture is labeling and tagging your assets - this gives you atomic and ensemble based matching of your resources. There are going to be a lot of labels/tags that are going to be applied to your objects and every organization’s set of labels looks different - but there are some common attributes or features that you’ll find below that could jump start your own efforts.
There are some common labels that are considered to be baseline best practices.
Key | Description | Example | Type |
---|---|---|---|
app.kubernetes.io/name | The name of the application | mysql | string |
app.kubernetes.io/instance | A unique name identifying the instance of an application | mysql-abcxzy | string |
app.kubernetes.io/version | The current version of the application (e.g., a SemVer 1.0, revision hash, etc.) | 5.7.21 | string |
app.kubernetes.io/component | The component within the architecture | database | string |
app.kubernetes.io/part-of | The name of a higher level application this one is part of | wordpress | string |
app.kubernetes.io/managed-by | The tool being used to manage the operation of an application | helm | string |
You can find these listed here in great detail: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
Metadata can be namespaced via domain pathing, eg there are some well-known labels, annotations, and taints that have keys prefixed by kubernetes.io
, app.kubernetes.io
, etc. You can of course also namespace your own labels with a domain path prefix, eg example.com/cost-center
.
You can find the well-known metadata references here: https://kubernetes.io/docs/reference/labels-annotations-taints/
There are some labels that aren’t necessarily meant for organizing workloads as much as they are for attribution to business signals. This could be for billing, environmental notation, metric selectors, policy actuation, so on.
cost-center
- For budgetary alignmentfinancial-party-id
- For cost actor attributionsalesforce-id
- SFID Attributionenvironment
- For environmental labeling of assets, eg production, test, development, etccluster-type
cluster-role
cluster-location
cluster-infra
cluster-name
cluster-domain
aws-region
: us-east-1datacenter_building
:datacenter_floor
:datacenter_aisle
:datacenter_rack
:server_id
:baremetal_vendor : hpe |
dell |
supermicro … |
app
: alertmanagerapp.kubernetes.io/part-of
: openshift-monitoringapp.kubernetes.io/instance
: mainapp.kubernetes.io/version
: 0.24.0app.kubernetes.io/component
: alert-routerOften you’ll find some auto-generated or auto-applied labels on certain objects that the platform controllers set automatically - these are handy to use for targeting and selecting other objects, knowing the portability is met across clusters.
kubernetes.io/arch
: amd64kubernetes.io/hostname
: app-1kubernetes.io/os
: linuxnode-role.kubernetes.io/infra
: ‘’node-role.kubernetes.io/master
: ‘’node-role.kubernetes.io/worker
: ‘’node.openshift.io/os_id
: rhcosmachine.openshift.io/cluster-api-cluster
: core-ocp-f66s9machine.openshift.io/cluster-api-machine-role
: mastermachine.openshift.io/cluster-api-machine-type
: master