Posts

Showing posts from March, 2020

How to fix "Problem with MergeList /var/lib/apt/lists/"

Sometimes, and more often, an update on RaspberryPi hangs with: "Problem with MergeList ..."
sudo mv /var/lib/apt/extended_states /var/lib/apt/extended_states_tmp && rm -rf /var/lib/apt/lists/* -vf && sudo apt-get update

solves the issue.


Kubernetes - delete all pods with a certain status

"How to delete all pods with a status like Error" - that is a question I often get. The DevOps answer is a one-liner, filtering by status.reason and the status we want to query, es example:

kubectl get po -A --all-namespaces -o json | jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | "kubectl delete po \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n 1 bash -c
In that case we delete all pods with the Status "Evicted". But it works for every status based filtering.