Skip to content

Instantly share code, notes, and snippets.

@cllovatto
cllovatto / gist:faba1185accb721b7da7206ac400fde0
Created November 1, 2022 19:59
Perform a MongoDB Logical Backup and Restore on k8s cluster
Backup
- Create a volume and attach to control plane instance (for example, attached to /dev/vdb)
- Login to instance and:
fdisk /dev/vdb
n
p
<enter> 3x
w
mkfs.ext4 /dev/vdb1
mkdir /mnt/backup
@cllovatto
cllovatto / gist:bb81044a70d0cb93b92b937026f16154
Created July 20, 2022 16:58
Remove leftovers from deleted cluster on Rancher 2.6.x
Sometimes when you delete a cluster from Rancher, it still appears in the Home dashboard and also on the left menu.
This is not only cosmetic, but if you try to import a new cluster under the same name, it does not work.
To definitely remove it, login to Rancher cluster and type the following:
kubectl get clusters.management.cattle.io # find the cluster you want to delete
kubectl describe clusters.management.cattle.io <cluster-id from previous command> # Find the Display name for the cluster and confirm it is the one you want
export CLUSTERID="c-xxxxxxxxx"
kubectl patch clusters.management.cattle.io $CLUSTERID -p '{"metadata":{"finalizers":[]}}' --type=merge
kubectl delete clusters.management.cattle.io $CLUSTERID