Skip to content

Instantly share code, notes, and snippets.

View agolomoodysaada's full-sized avatar
:shipit:
ship it

Moody Saada agolomoodysaada

:shipit:
ship it
  • Agolo
  • NY
View GitHub Profile
@agolomoodysaada
agolomoodysaada / delete-terminating-namespaces.sh
Created November 4, 2019 11:04
How to delete stuck kubernetes namespaces
# run kubectl proxy on a separate terminal
kubectl get ns | grep Terminating | awk '{print $1}' | while read NS
do
echo $NS
kubectl get ns --export -o json $NS | grep -v '"kubernetes"' > /tmp/$NS.json
curl -H "Content-Type: application/json" -X PUT --data-binary @/tmp/$NS.json http://127.0.0.1:8001/api/v1/namespaces/$NS/finalize
done
@agolomoodysaada
agolomoodysaada / update-vmss-ssh-key.sh
Last active January 26, 2024 03:09
Azure Virtual Machine Scale Set(VMSS) Reset SSH KEY
az vmss extension set \
--vmss-name <vmss-name> \
-g <resource-group> \
-n VMAccessForLinux \
--publisher Microsoft.OSTCExtensions \
--version 1.4 \
--protected-settings "{\"username\":\"deploy_user\", \"ssh_key\":\"$(cat ~/.ssh/id_rsa.pub)\"}"
# Upgrade ALL instances in the scale set with the new key
az vmss update-instances --instance-ids '*'
-n <vmss-name>