The first and most minimal example of a Deployment in the Kubernetes documentation has the app: nginx
line that repeats itself three times. I understand it's a tag, but I haven't found anything that explains why this needs to be specified for all of:
metadata.labels
,spec.selector.matchLabels
, andspec.template.metadata.labels
The example deployment file:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80