Kubernetes query avg cpu/memory/disk-usage by DEPLOYMENT

Is there a way to query kubernetes deployment metrics and make a dashboard with them for : cpu/memory/disk-usage by kubernetes-DEPLOYMENT?

For the moment i manage to query metrics by container/pod ,


Memory:
avg by(container)(container_memory_usage_bytes{pod=“$pod”, container=~“tomcat”})
CPU:
avg by (container)(rate(container_cpu_user_seconds_total{image!=“”,container!=“POD”,pod=“$pod”}[30s])*100)

My question is if we can query this by DEPLOYMENT , because pods are changed during the day and new pod-ids are lauched every day, but deployment is stable/fixed

Hi, did you resolve this?

Yes,
I interogate the query by service=~"$service" . This was the fix.

jvm_memory_bytes_used{instance=~"$instance",namespace="$namespace",service=~"$service"}