Skip to content

Instantly share code, notes, and snippets.

View sirkirby's full-sized avatar
:octocat:

Chris Kirby sirkirby

:octocat:
View GitHub Profile
@sirkirby
sirkirby / k3s-agent-haproxy.sh
Created October 6, 2023 15:08
k3s agent install haproxy
# use the same token you used earlier
# set the server ip address to your new VIP
curl -sfL https://get.k3s.io | K3S_TOKEN=DC87A250BCBA499994CF808CEADD1BCC sh -s - agent --server https://192.168.1.100:6443
@sirkirby
sirkirby / keepalived-secondary-conf.sh
Created October 5, 2023 20:56
keepalived secondary configuration
# assuming lb2 is 192.168.1.21
vrrp_script chk_haproxy {
script 'killall -0 haproxy' # faster than pidof
interval 2
}
vrrp_instance haproxy-vip {
interface eth1
state BACKUP
priority 100
@sirkirby
sirkirby / keepalived-primary-conf.sh
Last active October 5, 2023 20:56
keepalived primary configuration
# assuming lb1 is 192.168.1.20
vrrp_script chk_haproxy {
script 'killall -0 haproxy' # faster than pidof
interval 2
}
vrrp_instance haproxy-vip {
interface eth1
state MASTER
priority 200
@sirkirby
sirkirby / ha-proxy-setup.sh
Created October 3, 2023 21:41
HAProxy Config
sudo nano /etc/haproxy/haproxy.cfg
# add the following config, ctrl-x then y to exit and save
frontend k3s-frontend
bind *:6443
mode tcp
option tcplog
default_backend k3s-backend
@sirkirby
sirkirby / k3s-ha-cluster-install.sh
Last active February 19, 2024 23:01
k3s ha cluster setup
# server-1: 192.168.1.10
# server-2: 192.168.1.11
# server-3: 192.168.1.12
# lb-VIP : 192.168.1.100
# generate your own unique token
# server-1
curl -sfL https://get.k3s.io | K3S_TOKEN=DC87A250BCBA499994CF808CEADD1BCC sh -s - server \
--cluster-init \
--tls-san=192.168.1.100
@sirkirby
sirkirby / kubectl-install.sh
Last active October 23, 2023 15:03
kubernetes-cli.sh
## For Mac, install kubectl and helm (you'll need it later)
brew install kubernetes-cli helm
## For Windows, run terminal as Admin
choco install kubernetes-cli kubernetes-helm
@sirkirby
sirkirby / k3s-install.sh
Created October 3, 2023 19:43
k3s single node install
# on the metal or VM that will be your first node
curl -sfL https://get.k3s.io | sh -
# once complete, copy the cluster confing file..you'll need that later
# save it to a local file or your password manager
sudo cat /etc/rancher/k3s/k3s.yaml
@sirkirby
sirkirby / choco-install-ngrok.sh
Created September 19, 2023 15:30
install ngrok on windows
choco install ngrok
# add your ngrok access token
# get token from https://dashboard.ngrok.com/get-started/your-authtoken
ngrok config add-authtoken 1234556566
@sirkirby
sirkirby / ngrok-tcp-tunnel.sh
Created September 19, 2023 15:20
Start ngrok tcp tunnel
# proxy to vnc port
ngrok tcp --region=us --remote-addr=1.tcp.ngrok.io:99999 5900
# or via Docker. Tunnel ports are random and will be specific to your tunnel
docker run -it -e NGROK_AUTHTOKEN=1232121212 ngrok/ngrok tcp 5900 --region=us --remote-addr=7.tcp.ngrok.io:99999
@sirkirby
sirkirby / ngrok-brew.sh
Created September 19, 2023 14:37
install ngrok on mac
brew install ngrok
# add your ngrok access token
# get token from https://dashboard.ngrok.com/get-started/your-authtoken
ngrok config add-authtoken 1234556566