Skip to content

Instantly share code, notes, and snippets.

View marzocchi's full-sized avatar

Federico Marzocchi marzocchi

View GitHub Profile
@marzocchi
marzocchi / Dockerfile
Created August 1, 2023 08:46
nginx container with files of different size and random content
FROM nginx:latest
RUN for size in 1K 2K 10K 20K 512K 1M; do \
dd if=/dev/urandom of=/usr/share/nginx/html/${size}.dat bs=${size} count=1; \
done
@marzocchi
marzocchi / query.txt
Created February 15, 2024 12:45
MetricsQL/PromQL to enhance pod/container metrics with the deployment name
sum by (namespace, pod) ( container_memory_working_set_bytes{image!="", container!="POD", container!="", source!="cadvisor", namespace="SOME_NAMESPACE"} )
* on (namespace, pod) group_left(deployment)
(
label_copy(kube_replicaset_owner{namespace="SOME_NAMESPACE", owner_kind="Deployment"}, "owner_name", "deployment")
* on (namespace, replicaset) group_left(pod)
(
label_copy(kube_pod_info{namespace="SOME_NAMESPACE", created_by_kind="ReplicaSet"}, "created_by_name", "replicaset")
* on (namespace, replicaset, pod)