My task is to add a label named "app" to all deployments, daemonsets, and cronjobs so that it's easier to query our apps across the stack in our monitoring tools. This way, we can build dashboards that use a single selector, namely app.
To avoid downtime I've decided to resolve this issue in the following steps:
- Add labels to dev, test & stage environments.
- Add labels to prod env's.
- Deploy (1)
- Deploy (2)
- Delete old labels & update the services of dev to use the new labels. Then test & deploy. (currently on this step)
- Repeat (5) for stage.
- Repeat (5) for prod.
When using $ kubectl apply to update the resources I've added the "app" label to/replaced "service" label with "app" labels to, I run into the following error:
Error from server (Invalid): error when applying patch: {longAssPatchWhichIWon'tIncludeButYaGetThePoint} to: &{0xc421b02f00 0xc420803650 default provisioning manifests/prod/provisioning-deployment.yaml 0xc 42000c6f8 3942200 false} for: "manifests/prod/provisioning-deployment.yaml": Deployment.apps "provisioning" is invalid: s pec.template.metadata.labels: Invalid value: map[string]string{"app":"provisioning", "component" :"marketplace"}:
selectordoes not match templatelabels
I need some insights on why it's throwing this error.