Skip to content

Instantly share code, notes, and snippets.

@dkeightley
Last active October 19, 2021 08:34
Show Gist options
  • Save dkeightley/6ba1cefd5dbd3e2583485dce61ffb63a to your computer and use it in GitHub Desktop.
Save dkeightley/6ba1cefd5dbd3e2583485dce61ffb63a to your computer and use it in GitHub Desktop.
Single node RKE2 cluster userdata
#!/bin/sh
PUBLIC_IP=$(curl ifconfig.io)
# export INSTALL_RKE2_VERSION="v1.20.5+rke2r1"
curl -sfL https://get.rke2.io | sh -
mkdir -p /etc/rancher/rke2
cat > /etc/rancher/rke2/config.yaml <<EOF
write-kubeconfig-mode: "0640"
tls-san:
- "${PUBLIC_IP}"
- "${PUBLIC_IP}.nip.io"
EOF
systemctl enable rke2-server
systemctl start rke2-server
cat >> /etc/profile <<EOF
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
export CRI_CONFIG_FILE=/var/lib/rancher/rke2/agent/etc/crictl.yaml
PATH="$PATH:/var/lib/rancher/rke2/bin"
alias k=kubectl
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment