https://prefect.io logo
#prefect-kubernetes
Title
# prefect-kubernetes
g

Garett Dunn

01/10/2023, 8:52 PM
I’ve been using prefect with some success until today, when I needed to add a memory request on the pods for a specific flow run that the k8s agent is creating. I followed the [example from anna geller](https://github.com/anna-geller/prefect-deployment-patterns/blob/main/blocks/infrastructure_blocks/kubernetes-job/customizations/cpu_memory_limits.py) to add the resource requests to the Kubernetes Job block in the UI. i also added labels to aid in viewing logs in an external application. however, neither the lables nor the customizations made it onto the flow run pods that were created. am i doing something wrong here in defining these blocks? Note that i’m running the
prefecthq/prefect:2.7.7-python3.9
image for the agent
r

redsquare

01/10/2023, 9:57 PM
the path looks wrong to me should be something like "/spec/template/spec/containers/0/resources"
gratitude thank you 2
we add it via code and that is the path we use
message has been deleted
g

Garett Dunn

01/11/2023, 1:53 AM
gotcha. i based it on an earlier message i saw pointing to one of your repos. why is it different here? https://github.com/anna-geller/prefect-deployment-patterns/blob/main/blocks/infrastructure_blocks/kubernetes-job/customizations/cpu_memory_limits.py#L8
also, any input on why the labels aren’t making it to the pods? i assume i’m using the wrong format there as well
r

redsquare

01/11/2023, 8:15 AM
@Garett Dunn hey, try labels as an array, not sure why @Anna Geller repo has the cpu like that
👍 1
a

Anna Geller

01/11/2023, 4:55 PM
I was using it from a colleague, I'm no K8s expert. If something is wrong in those examples, could you submit a PR to that repository? 🙏 I'd supper appreciate it to help others avoid that mistake
r

redsquare

01/11/2023, 4:58 PM
Done 👍
g

Garett Dunn

01/11/2023, 5:01 PM
would it be possible to add documentation somewhere for how to fill these in on the prefect GUI? it took a while for me to realize that the format matched what what you’d pass in via the python SDK vs various other formats you might use when working with k8s. specifically the
"op", "path", "value"
mapping
r

redsquare

01/11/2023, 5:05 PM
Yeah - I expect a few of the common ones will make it into the ui/api as single values and prefect will create the patch under the hood like some of the other values (image) etc
g

Garett Dunn

01/11/2023, 5:07 PM
yep, that would be nice. esp being able to use more varied html elements to input lists vs maps vs etc. but even having it described somewhere how to write the customizations would go a long way to cover most use cases
r

redsquare

01/11/2023, 5:09 PM
@Garett Dunn the prefect discourse is good for searching and finding gems https://discourse.prefect.io/
👍 1
w

Walter Cavinaw

01/25/2023, 11:30 PM
Wow you guys just saved me a ton of time. Thanks for this!
🎉 1
2 Views