Skip to content

Instantly share code, notes, and snippets.

@babvin
babvin / delete_pvc_force
Created December 29, 2020 07:43
Solution to kubectl PVC delete stuck in "Terminating state"
kubectl patch pvc nextcloud -p '{"metadata":{"finalizers": []}}' --type=merge -n nextcloud
kubectl delete jobs --field-selector status.successful=1
@babvin
babvin / mysql-docker.sh
Created January 2, 2021 05:05 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@babvin
babvin / gist:cc43aa0cac44fc10ca138d4590a766b0
Last active January 4, 2021 11:33
Delete pods which are stuck at terminating
For one: kubectl delete pod <PODNAME> --grace-period=0 --force --namespace <NAMESPACE>
For Many: kubectl get pods --all-namespaces | grep Terminating | while read line; do
pod_name=$(echo $line | awk '{print $2}' ) name_space=$(echo $line | awk '{print $1}' ); kubectl delete pods $pod_name -n $name_space --grace-period=0 --force;
#!/bin/bash
# Set the root directory
CUR_DIR=/git/DTMS-Tools
cd $CUR_DIR
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master revision
for i in $(find . -name "*.git" | cut -c 3-); do
repo=$(echo $i | awk -F/ '{ print $1 }');