curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
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
SELECT | |
ROUND(base.mem_MB, 3) as base_mem_MB, | |
ROUND(per_conn.mem_MB, 3) as per_conn_mem_MB, | |
@@GLOBAL.max_connections as max_conn, | |
ROUND(@@GLOBAL.max_connections * per_conn.mem_MB, 3) as max_conn_MB, | |
ROUND(@@GLOBAL.max_connections * per_conn.mem_MB + base.mem_MB, 3) as total_MB | |
FROM | |
( SELECT (@@GLOBAL.key_buffer_size + @@GLOBAL.query_cache_size + @@GLOBAL.tmp_table_size + @@GLOBAL.innodb_buffer_pool_size + @@GLOBAL.innodb_log_buffer_size)/1024/1024 as mem_MB) as base, | |
( SELECT (@@GLOBAL.sort_buffer_size + @@GLOBAL.read_buffer_size + @@GLOBAL.read_rnd_buffer_size + @@GLOBAL.join_buffer_size + @@GLOBAL.thread_stack + @@GLOBAL.binlog_cache_size) /1024/1024 as mem_MB) as per_conn \G |
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
kubectl get x -o yaml | yq e '.items[]|splitDoc' - | awk '/^ name:/{file=$NF".yaml"} !/^--/{s=s $0"\n"} /^---/{print s > (file); close(file); s=""}' |
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 | |
function pod_wait_for_status { | |
while true | |
do | |
STATUS=$(kubectl get pod $1 2>/dev/null|tail -n 1| awk '{print $3}') | |
debug 2 "Pod $1 is in state $STATUS (waiting for $2)" | |
[ "$STATUS" = "$2" ] && break | |
sleep 1 | |
done |
The shorewall documentation explains in http://shorewall.org/Docker.html how to configure shorewall for use with docker. The problem with the configuration is that it only allows connections from the host to the main bridge docker0
. Connections to other networks on dynamically created bridges, with names starting by default with br-
, is blocked. Instead of the recommended contents of /etc/shorewall/interfaces
, use wild-card interface names as follows:
#ZONE INTERFACE OPTIONS
#dock docker0 bridge # disabled default recommendation
dock docker0 physical=docker+,routeback=1
dock br physical=br-+,routeback=1
Run on controlplane
node, uses any found hyperkube
image
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
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
kind: PersistentVolumeClaim | |
apiVersion: v1 | |
metadata: | |
name: rancher-server | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 10Gi |
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
cat /proc/net/tcp| cut -c -36|grep '0A$'| cut -c 16-19| while read line; do echo $((16#$line)); 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 | |
COUNT=$1 | |
tail -n$COUNT /home/ubuntu/metrics.log | \ | |
awk '{M+=$1;U+=$2;N+=$3;S+=$4;I+=$5;T+=$6} END {printf "%d\t=%.2f+%.2f+%.2f+%.2f+%.2f\n",M/NR,U/NR,N/NR,S/NR,I/NR,T/NR}' |