K8s: app.kubernetes.io instance label purpouse

4/23/2020

These are recommended labels:

app.kubernetes.io/name
app.kubernetes.io/instance
app.kubernetes.io/version
app.kubernetes.io/component
app.kubernetes.io/part-of
app.kubernetes.io/managed-by

I don't quite figure out what's app.kubernetes.io/instance for.

Could you provide any helping examples?

-- Jordi
kubernetes

1 Answer

4/23/2020

A generic application name can have multiple instances.

Say if an application used nginx to serve different types of content, so each type of nginx can be scaled independantly:

app.kubernetes.io/name: nginx

app.kubernetes.io/instance: static-01

app.kubernetes.io/instance: img-02

app.kubernetes.io/instance: dynamic-05

They are only recommendations though so you can use them how you want. In small scale clusters you might not have a need to make name and instance different.

See Applications And Instances Of Applications

An application can be installed one or more times into a Kubernetes cluster and, in some cases, the same namespace. For example, wordpress can be installed more than once where different websites are different installations of wordpress.

The name of an application and the instance name are recorded separately. For example, WordPress has a app.kubernetes.io/name of wordpress while it has an instance name, represented as app.kubernetes.io/instance with a value of wordpress-abcxzy. This enables the application and instance of the application to be identifiable. Every instance of an application must have a unique name.

-- Matt
Source: StackOverflow