https://prefect.io logo
Title
o

Olivér Atanaszov

09/21/2022, 11:50 AM
Hi! I'm using Prefect on K8s clusters and I would need to track costs per projects and namespace. To achieve this, my plan was to add labels to the jobs. Before initializing
KubernetesRun
objects, I tried to modify the `metadata.labels`field, but apparently it gets overwritten by Prefect Cloud. I've also tried to modify
annotations
but that also didn't appear when checking
kubectl describe pod
. Is there a workaround or a different approach that comes to your mind?
1
b

Bianca Hoch

09/21/2022, 3:53 PM
Hi Oliver, how are you modifying the
metadata.labels
and
annotations
in the kubernetes job template? Are you utilizing customizations?
We have another helpful tutorial for customizing job templates here as well.
o

Olivér Atanaszov

09/22/2022, 8:32 AM
Ah, sorry, forgot to mention that I'm using Prefect 1.0. @Bianca Hoch Yes, I'm modifying the job template that I pass down to the
KubernetesRun
as dict
Thanks for the help, I found the issue: I've added the labels to metadata.labels and not to spec.template.metadata.labels.
1
🚀 1