reading the kubernetes docs, it is not very clear to me what is the difference between specifying labels at the top-level metadata key, versus at the spec level.
Consider:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: nginx
name: nginx
spec:
replicas: 2
selector:
matchLabels:
run: nginx
strategy: {}
template:
metadata:
labels:
run: nginxv1
spec:
containers:
- image: nginx
name: nginx
which I have copied from https://stackoverflow.com/questions/54837981/k8s-significance-of-spec-template-metadata-section , where my google searching landed me.
What's the difference between the two labels that are set in this manifest?