curl -sfL https://get.rke2.io | INSTALL_RKE2_METHOD=rpm sh -
sudo cp -f /usr/share/rke2/rke2-cis-sysctl.conf /etc/sysctl.d/60-rke2-cis.conf
mkdir -p /etc/rancher/rke2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ingresspod in $(kubectl -n ingress-nginx get pods -l app=ingress-nginx --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}') | |
do | |
echo $ingresspod | |
for rancherep in $(kubectl -n cattle-system get ep rancher -o json | jq -r .subsets[].addresses[].ip) | |
do | |
echo "=> ${rancherep}" | |
kubectl -n ingress-nginx exec $ingresspod -- curl -o /dev/null -s -w 'Connect: %{time_connect}\nStart Transfer: %{time_starttransfer}\nTotal: %{time_total}\nResponse code: %{http_code}\n' -k https://${rancherep} | |
echo | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LEVEL=info # change to debug, etc. | |
for rancherpod in `kubectl get pods -n cattle-system -l app=rancher --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}'` | |
do | |
echo $rancherpod | |
kubectl exec -n cattle-system $rancherpod -- loglevel --set $LEVEL | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in `kubectl get crd --no-headers | awk '{print $1}'` | |
do | |
echo $i | |
kubectl get crd $i -o yaml | grep "finalizers" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Run within a etcd container | |
# etcd object sizes | |
export ETCDCTL_API=3 | |
for key in `etcdctl get --prefix --keys-only /` | |
do | |
size=`etcdctl get $key --print-value-only | wc -c` | |
versions=`etcdctl get $key --write-out=fields | grep \"Version\" | cut -f2 -d':'` | |
total=$(( $size * $versions)) | |
echo $total $size $versions $key >> /tmp/etcdkeys.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function box-request() | |
{ | |
_BEARER_TOKEN="<box app token>" | |
_FOLDER_NAME=$1 | |
echo -n "Creating ${_FOLDER_NAME}" | |
_FOLDER_ID=$(curl -sX POST https://api.box.com/2.0/folders \ | |
-H "Authorization: Bearer ${_BEARER_TOKEN}" \ | |
-H 'Content-Type: application/json' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MYSQL_PASS= | |
MYSQL_USER=master | |
LIMIT=100000 | |
SELECT_STMT="select max(id) m, count(*) c, name from kine group by name order by c desc limit 100;" | |
# start compaction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Installing K3S" | |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION="v1.19.5+k3s2" sh - | |
PUBLIC_IP=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) | |
echo "Downlading cert-manager CRDs" | |
wget -q -P /var/lib/rancher/k3s/server/manifests/ https://github.com/jetstack/cert-manager/releases/download/v0.15.0/cert-manager.crds.yaml | |
cat > /var/lib/rancher/k3s/server/manifests/rancher.yaml << EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SERVICE=my-nginx | |
NAMESPACE=default | |
PORT=80 | |
for ingresspod in $(kubectl -n ingress-nginx get pods -l app=ingress-nginx --template '{{range.items}}{{.metadata.name}}{{"\n"}}{{end}}') | |
do | |
echo $ingresspod | |
for svcep in $(kubectl -n $NAMESPACE get ep $SERVICE -o json | jq -r '.subsets[].addresses[].ip') | |
do | |
echo "=> ${svcep}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ETCDCTL_API=3 | |
for key in `etcdctl get --prefix --keys-only /registry/configmaps` | |
do | |
size=`etcdctl get $key --print-value-only | wc -c` | |
versions=`etcdctl get $key --write-out=fields | grep \"Version\" | cut -f2 -d':'` | |
total=$(( $size * $versions)) | |
echo $total $size $versions $key >> /tmp/etcdkeys-configmaps.txt | |
done |