Skip to content

Instantly share code, notes, and snippets.

View Oats87's full-sized avatar

Chris Kim Oats87

View GitHub Profile
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml; export PATH=$PATH:/var/lib/rancher/rke2/bin
@Oats87
Oats87 / push.sh
Created October 7, 2020 18:35
Requires skopeo and lots of disk space
#!/bin/bash
REPO=${REPO:-rancher}
IMAGE=${IMAGE:-rancher-agent}
TAG=${TAG:-v2.5.1-rc1}
DESTREPO=${DESTREPO:-oats87}
DESTIMAGE=${DESTIMAGE:-$IMAGE}
DESTTAG=${DESTTAG:-$TAG}
#!/bin/sh
sed -i "/\b\UUID\b/d" /etc/sysconfig/network-scripts/ifcfg-ens192
rm -vf /etc/ssh/ssh_host_*
systemctl stop systemd-journald.socket
find /var/log -type f -exec rm {} \;
rm -rf /var/log/journal/*
rm /root/.bash_history; history -c
systemctl poweroff
kubectl get configmap -n kube-system cattle-controllers -o json | jq -r '.metadata.annotations["control-plane.alpha.kubernetes.io/leader"]' | jq -r ".holderIdentity"
for i in $(kubectl get state -n hobbyfarm | awk '{print $1}' | grep -v "NAME"); do kubectl -n hobbyfarm patch state $i -p '{"metadata":{"finalizers": []}}' --type=merge; done
etcdctl get / --prefix --endpoints=${ETCDCTL_ENDPOINTS} --keys-only | grep ${NAMESPACE}
mkdir /etc/docker
cat << EOF > /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "6"
}
}
EOF
cat << EOF >> /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.core.somaxconn = 32768
EOF
fdisk /dev/sdb
mkdir /var/lib/docker
echo $(blkid /dev/sdb1 | awk '{print $2}' | sed -e 's/"//g') /var/lib/docker ext4 defaults 0 0 >> /etc/fstab
sed -i 's/\/dev\/mapper\/centos-swap/#\/dev\/mapper\/centos-swap/g' /etc/fstab
mount -a
reboot
@Oats87
Oats87 / gist:b056c1976fd0484e4f161ab063deb1b0
Created January 11, 2019 19:44
docker centos/rhel recommendations
# Docker 17.03.2 on RHEL/CentOS 7
Rancher has discovered a few issues when running Upstream Docker 17.03.2 on RHEL/CentOS 7. This document is being written to document recommendations for Docker configuration in order to ensure reliability while operating Kubernetes and Rancher with RHEL/CentOS 7.
### Overlay2 Storage Driver
Currently, Upstream Docker 17.03.2 performs kernel version validations to enable overlay2. As official overlay2 support from the upstream Linux kernel was not enabled until version 4.0 or higher than the kernel. Red Hat backported overlay2 support to 3.10.0-514 of their kernel.
Overlay2 support can be enabled by setting the following contents in the `/etc/docker/daemon.json` file and restarting Docker. Please note that you must do this on a fresh docker installation, or remove all running containers before performing this action.
```{