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
set -x; | |
if ! command -v rancher-machine &> /dev/null; then | |
echo "rancher-machine must be in your PATH"; | |
exit 1; | |
fi; | |
RDIR=$(pwd)/local-run-data; | |
mkdir -p $RDIR; | |
: > run.env; | |
echo "CATTLE_DEV_MODE=30" >> run.env; | |
eval "$(grep '^ENV CATTLE_SYSTEM_AGENT' package/Dockerfile | awk '{print "export " $2 "=" $3}')"; |
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 | |
echo "This will generate a new kube config for accessing your RKE-created kubernetes cluster. This script MUST be run on a Kubernetes node." | |
echo "Please enter the IP of one of your control plane hosts, followed by [ENTER]:" | |
read cphost | |
openssl genrsa -out kube-admin.key 2048 | |
openssl req -new -sha256 -key kube-admin.key -subj "/O=system:masters/CN=kube-admin" -out kube-admin.csr | |
sudo openssl x509 -req -in kube-admin.csr -CA /etc/kubernetes/ssl/kube-ca.pem -CAcreateserial -CAkey /etc/kubernetes/ssl/kube-ca-key.pem -out kube-admin.crt -days 365 -sha256 | |
sudo rm -f /etc/kubernetes/ssl/kube-ca.srl |
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
kubectl -n fleet-default patch vmwarevspheremachine <INFRAMACHINE> --subresource=status --type=json -p='[{"op": "replace", "path": "/status/conditions", "value":[{"type":"CreateJob","status":"True"},{"type":"Ready","status":"True"}]}]' |
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 | |
FILE=$1 | |
if [ -z "${FILE}" ]; then | |
echo "A file must be specified" | |
exit 1 | |
fi | |
BLOB=$(cat ${FILE} | grep -A 1 "wait failed on" | grep -v "wait failed on") |
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
kube-apiserver-arg+: "v=6" | |
kube-controller-manager-arg+: "v=6" | |
kube-scheduler-arg+: "v=6" | |
kubelet-arg+: "v=6" | |
debug: "true" |
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
package systemtemplate | |
import ( | |
"bytes" | |
"crypto/sha256" | |
"encoding/hex" | |
"encoding/json" | |
"fmt" | |
"strings" | |
"testing" |
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 | |
FILE=${1:-0} | |
if [ "${FILE}" = "0" ]; then | |
echo "need to specify a file" | |
exit 1 | |
fi | |
fileNo=$(ls $FILE-split | wc -l | awk '{print $1}') |
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
CLUSTER_NAME="CLUSTER-NAME"; kubectl get rkebootstrap -n fleet-default $(kubectl get secrets -n fleet-default --field-selector=type=rke.cattle.io/machine-plan -l cluster.x-k8s.io/cluster-name="$CLUSTER_NAME",rke.cattle.io/init-node=true -o json | jq -r '.items[0].metadata.ownerReferences[0].name') -o json | jq -r '.metadata.ownerReferences[0].name' |
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 | |
for pod in $(kubectl get pods --no-headers -l app=rancher -n cattle-system | cut -d ' ' -f1); do | |
echo Collecting pprof information for $pod - this will take some time. | |
kubectl -n cattle-system exec $pod -c rancher -- curl -s http://localhost:6060/debug/pprof/profile -o profile; | |
kubectl -n cattle-system cp $pod:profile pprof-$pod-profile -c rancher; | |
kubectl -n cattle-system exec $pod -c rancher -- curl -s http://localhost:6060/debug/pprof/goroutine -o goroutine; | |
kubectl -n cattle-system cp $pod:goroutine pprof-$pod-goroutine -c rancher; | |
kubectl -n cattle-system exec $pod -c rancher -- curl -s http://localhost:6060/debug/pprof/heap -o heap; | |
kubectl -n cattle-system cp $pod:heap pprof-$pod-heap -c rancher; | |
kubectl -n cattle-system exec $pod -c rancher -- curl -s http://localhost:6060/debug/pprof/threadcreate -o threadcreate; |
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
crictl -r /var/run/k3s/containerd/containerd.sock exec -it $(crictl -r /var/run/k3s/containerd/containerd.sock ps | grep etcd | awk '{print $1}') /bin/bash |
NewerOlder