Skip to content

Instantly share code, notes, and snippets.

@travnewmatic
Last active June 24, 2021 03:47
Show Gist options
  • Save travnewmatic/d14c24700e6eb90e6750e9d9ea296318 to your computer and use it in GitHub Desktop.
Save travnewmatic/d14c24700e6eb90e6750e9d9ea296318 to your computer and use it in GitHub Desktop.
#!/bin/bash
# wipe old k3s
bash /usr/local/bin/k3s-agent-uninstall.sh; bash /usr/local/bin/k3s-uninstall.sh
# install k3s https://rancher.com/docs/k3s/latest/en/installation/install-options/
curl -sfL https://get.k3s.io | \
K3S_KUBECONFIG_MODE="644" \
sh -s - \
server \
--cluster-init \
--disable traefik \
--disable servicelb \
--disable local-storage
# move kube config to home dir
sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config && sudo chown $USER $HOME/.kube/config
# helm https://helm.sh/docs/intro/install/
#curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
#helm repo add jetstack https://charts.jetstack.io
#helm repo add bitnami https://charts.bitnami.com/bitnami
#helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
#helm repo add democratic-csi https://democratic-csi.github.io/charts/
#helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
#helm repo add argo https://argoproj.github.io/argo-helm
#helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
#helm repo update
# MetalLB install https://metallb.universe.tf/installation/#installation-by-manifest
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.10.2/manifests/metallb.yaml
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.1.211/32 # change this https://metallb.universe.tf/configuration/#layer-2-configuration
EOF
#!/bin/bash
# wipe old k3s
bash /usr/local/bin/k3s-agent-uninstall.sh; bash /usr/local/bin/k3s-uninstall.sh
# get $TOKEN from first master node in /var/lib/rancher/k3s/server/token
curl -sfL https://get.k3s.io | \
K3S_TOKEN=$TOKEN \
K3S_URL=https://192.168.1.211:6443 \ # ip on first master node
sh -s - \
server \
--cluster-init \
--disable traefik \
--disable servicelb \
--disable local-storage
#!/bin/bash
# wipe old k3s
bash /usr/local/bin/k3s-agent-uninstall.sh; bash /usr/local/bin/k3s-uninstall.sh
# get $TOKEN from first master node in /var/lib/rancher/k3s/server/token
curl -sfL https://get.k3s.io | \
K3S_TOKEN=$TOKEN \
K3S_URL=https://192.168.1.211:6443 \ # ip on first master node
sh -s -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment