Let's remove any old versions of Docker if they exist:
sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine| #!/usr/bin/env python | |
| """ | |
| This script deletes empty log streams from cloudwatch log groups. | |
| Your shell should be configured for connecting to the AWS API. This can be done | |
| with the CLI command `aws configure`. | |
| This script requires Python 3.6 or newer, and you must have boto3 installed. | |
| """ |
| #!/bin/sh | |
| # Backup your data | |
| # Use at your own risk | |
| # Usage ./extended-cleanup-rancher2.sh | |
| # Include clearing all iptables: ./extended-cleanup-rancher2.sh flush | |
| docker rm -f $(docker ps -qa) | |
| docker rmi -f $(docker images -q) | |
| docker volume rm $(docker volume ls -q) | |
| for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done | |
| cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico" |
Run preferrably on controlplane nodes, saves the state in cluster.rkestate.
docker run --rm --net=host -v $(docker inspect kubelet --format '{{ range .Mounts }}{{ if eq .Destination "/etc/kubernetes" }}{{ .Source }}{{ end }}{{ end }}')/ssl:/etc/kubernetes/ssl:ro --entrypoint bash $(docker inspect $(docker images -q --filter=label=org.label-schema.vcs-url=https://github.com/rancher/hyperkube.git) --format='{{index .RepoTags 0}}' | tail -1) -c 'kubectl --kubeconfig /etc/kubernetes/ssl/kubecfg-kube-node.yaml -n kube-system get configmap full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r .' > cluster.rkestate
This will describe how to identify clusters that are created by RKE, created by Rancher or managed by Rancher
Clusters created by RKE CLI have:
full-cluster-state in namespace kube-system (cluster-state before RKE v0.2.0)kubectl -n kube-system get configmap full-cluster-state