Hier Sammle ich Snippets, welche mir das Tippen ersparen sollen und für Kubernetes öfter mal gebraucht werden.
Lösche alte ReplicaSets #
1
2kubectl get rs --all-namespaces -o wide | awk '$3==0 && $4==0 && $5==0 {print "-n", $1, $2}' | xargs -L1 kubectl delete rs
OCI Helm Chart in Forgejo importieren #
1helm pull oci://codeberg.org/wrenix/helm-charts/forgejo-runner --version 0.6.6
2helm push *.tgz oci://git.zyria.de/pyrox
3helm cm-push *.tgz zyria
Finalizer löschen #
1kubectl get linstorsatellites.piraeus.io -o name | sed -e 's/.*\///g' | xargs -I {} kubectl patch linstorsatellites.piraeus.io {} -p '{"metadata": {"finalizers": null}}' --type merge
Update Postgres mit Podman/Docker #
1podman run --rm --name pgauto -it \
2 --mount type=bind,source=./,target=/var/lib/postgresql/data \
3 -e POSTGRES_PASSWORD=password \
4 -e PGAUTO_ONESHOT=yes \
5 -e PGAUTO_REINDEX=no \
6 pgautoupgrade/pgautoupgrade:16-bookworm
Zeige alle Nodes mit dem Label performance #
1kubectl get nodes -o=jsonpath="{range .items[*]}{.metadata.name}: {.metadata.labels.performance}{'\n'}{end}"
Lösche alle Events #
1kubectl delete events --all -A
Lösche alle nicht gebundenen Images #
1/usr/local/bin//k3s crictl rmi --prune