This file contains hidden or 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
/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml exec -it $(/var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml get po -l component=etcd -n kube-system \ | |
-o jsonpath='{.items[0].metadata.name}') -n kube-system -- /bin/bash -c "ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \ | |
--cacert=/var/lib/rancher/rke2/server/tls/etcd/server-ca.crt \ | |
--cert=/var/lib/rancher/rke2/server/tls/etcd/server-client.crt \ | |
--key=/var/lib/rancher/rke2/server/tls/etcd/server-client.key \ | |
get /bootstrap --prefix " |
This file contains hidden or 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 | |
usage() { echo "Usage: $0 [-m master|worker|all] [-v v1.21.6+rke2r1] [-s 192.168.1.100] [-t K1075c2da4946626e73...] " 1>&2; exit 1; } | |
while getopts ":m:v:s:t:" o; do | |
case "${o}" in | |
m) | |
m=${OPTARG} | |
((m == master || m == worker || m == all)) || usage | |
;; |
This file contains hidden or 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 | |
echo "Fixing tokens..." | |
for namespace in kube-system cattle-system ingress-nginx | |
do | |
echo "namespace: $namespace" | |
for token in $(kubectl --kubeconfig kube_config_cluster.yml get secret -n $namespace | grep 'kubernetes.io/service-account-token' | awk '{print $1}') | |
do | |
kubectl --kubeconfig kube_config_cluster.yml delete secret -n $namespace $token | |
done |
This file contains hidden or 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 | |
echo "Working on a1-rancher-prd.support.tools" | |
/usr/local/bin/get_kube_config -u 'a1-rancher-prd.support.tools' -a 'token-12345' -s '1234567989....' | |
#echo "Working on a1-rancher-lab.support.tools" | |
/usr/local/bin/get_kube_config -u 'a1-rancher-lab.support.tools' -a 'token-12345' -s '123456789.....' |
This file contains hidden or 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 | |
for POD in $(kubectl get pods -n ingress-nginx -l app=ingress-nginx -o NAME | awk -F'/' '{print $1}'); | |
do | |
kubectl --kubeconfig $KUBECONFIG -n ingress-nginx logs $POD > ./logs-"$POD" | |
done |
This file contains hidden or 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
ETCD_VER=v3.4.15 | |
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download | |
DOWNLOAD_URL=${GITHUB_URL} | |
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz | |
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test | |
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz | |
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1 | |
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz | |
/tmp/etcd-download-test/etcd --version | |
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl version |
This file contains hidden or 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 | |
CATTLE_ACCESS_KEY='token-abcde' | |
CATTLE_SECRET_KEY='1234567890' | |
CATTLE_URL='rancher.example.com | |
clusterids=$( | |
curl -q -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \ | |
-X GET \ | |
-H 'Accept: application/json' \ |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: default-http-backend | |
manager: kubectl | |
operation: Update | |
manager: kube-controller-manager | |
operation: Update | |
name: default-http-backend |
This file contains hidden or 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
@echo off | |
@reg copy HKLM\HARDWARE\ACPI\DSDT\VBOX__ HKLM\HARDWARE\ACPI\DSDT\NOBOX__ /s /f | |
@reg delete HKLM\HARDWARE\ACPI\DSDT\VBOX__ /f | |
@reg add HKLM\HARDWARE\DESCRIPTION\System /v SystemBiosVersion /t REG_MULTI_SZ /d "NOBOX - 1" /f | |
@reg add HKLM\HARDWARE\DESCRIPTION\System /v VideoBiosVersion /t REG_MULTI_SZ /d "NOBOX - 1" /f | |
@taskkill /f /im VBoxTray.exe | |
@exit |
This file contains hidden or 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 | |
CATTLE_URL="http://rancher.example.com/v2-beta" | |
CATTLE_ACCESS_KEY="AAAAAAAAAAAAAAAAAAA" | |
CATTLE_SECRET_KEY="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" | |
SLEEP=5 | |
projects=`curl -s -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' "${CATTLE_URL}/projects/" | jq -r .data | jq '.[]' | jq '.id' | tr -d '"'` | |
for project in $projects |