Skip to content

Instantly share code, notes, and snippets.

@sw360cab
Created September 29, 2021 14:42
Show Gist options
  • Save sw360cab/1e6400025b981760e4259fede4dc687e to your computer and use it in GitHub Desktop.
Save sw360cab/1e6400025b981760e4259fede4dc687e to your computer and use it in GitHub Desktop.
Bash Script that enables a K8S cluster by installing Rancher K3S and Helm
#!/bin/sh
# Run remotely with -> source <(curl -s http://<remote-address-of-this-script>.sh)
set -e
# Run as su
if [ `id -u` -ne 0 ]
then
echo "You need to be root to run this script"
exit 1
fi
apt update && apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
# Install K3S
curl -sfL https://get.k3s.io | sh -
# Change permission to Rancher file
chmod 775 /etc/rancher/k3s/k3s.yaml
# Install Helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash -
echo "Cluster installed and active"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment