Thanks for bearing with all my questions. I have o...
# ask-community
h
Thanks for bearing with all my questions. I have one about k8s agents. Seeing that they are stateless pods, is there a way to set the agent id? https://docs.prefect.io/orchestration/agents/kubernetes.html#kubernetes-agent — this page doesn't mention anything about it, and it would seem that once the pod with the agent is restarted it gets a new id.
z
Hi @haf The agent id should be displayed in the UI. Do you need it for something else?
h
Yes, the agent id is displayed in the UI, but if you restart the pod it's running in, it would seem the agent id changes. I'm asking whether it's possible to fix the agent id for the k8s deployment?
z
Ah I see what you're saying. An existing agent id will be returned if the configuration details match... let me see what the K8s agent does to generate its config.
Hmm, if the name and labels match it should return the same id as before.
h
Right, the labels are:
Copy code
labels:
    app: prefect-agent
    component: agent
    pod-template-hash: 7bb7fbb665
z
Ah no these would be Prefect "labels" indicating which flows should match with this agent.
h
And the agent name itself is random
prefect-agent-7bb7fbb665-8rfp7
The Prefect agent label is the same: "prod"
z
The agent name defaults to just "agent" -- this isn't the name of your pod but the name of the agent in Prefect
That's helpful 🙂 one second
So here the
core_version
of your new agent has been bumped so it created a new unique ID
h
Ah, yes, I did bump that. That explains it! Thank you!
z
Yep, no problem. Want to delete that message so your info isn't in the channel?
1
👍
h
Thanks Michael!
z
Doesn't really matter but may as well keep your ids to yourself
h
It's the core of my being, right?
z
😄