Skip to content

Instantly share code, notes, and snippets.

View chaitushiva's full-sized avatar
🏠
Working from home

chai chaitushiva

🏠
Working from home
View GitHub Profile
@chaitushiva
chaitushiva / del_empty_log_streams.py
Created June 21, 2021 13:45 — forked from shouptech/del_empty_log_streams.py
Delete empty log streams from AWS CloudWatch Logs
#!/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.
"""
@chaitushiva
chaitushiva / install-kubernetes-flannel-centos7.md
Created February 6, 2021 06:21 — forked from rkaramandi/install-kubernetes-flannel-centos7.md
Installing Kubernetes with the Flannel Network Plugin on CentOS 7

Install Prerequisites on ALL (Worker and Master) Nodes

Let's remove any old versions of Docker if they exist:

sudo yum remove docker \
                  docker-common \
                  docker-selinux \
                  docker-engine
@chaitushiva
chaitushiva / extended-cleanup-rancher2.sh
Created June 7, 2020 03:44 — forked from superseb/extended-cleanup-rancher2.sh
Extended Rancher 2 cleanup (backup your data, use at your own risk)
#!/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"

Retrieve cluster.rkestate from RKE v0.2.x cluster

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
@chaitushiva
chaitushiva / identify_rke_rancherlaunched_imported.md
Created June 7, 2020 03:24 — forked from superseb/identify_rke_rancherlaunched_imported.md
Identify RKE / Rancher Launched Kubernetes / Imported clusters

Identify RKE / Rancher Launched Kubernetes / Imported clusters

This will describe how to identify clusters that are created by RKE, created by Rancher or managed by Rancher

RKE

Clusters created by RKE CLI have:

  • Cluster state stored as Configmap called full-cluster-state in namespace kube-system (cluster-state before RKE v0.2.0)
  • kubectl -n kube-system get configmap full-cluster-state