Skip to content

Instantly share code, notes, and snippets.

@iul1an
Created August 14, 2020 04:17
Show Gist options
  • Save iul1an/0488a5709baa75c0b7bfca63a3b34ce2 to your computer and use it in GitHub Desktop.
Save iul1an/0488a5709baa75c0b7bfca63a3b34ce2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# variables
export K3S_KUBECONFIG_MODE="666"
# install K3s
curl -sfL https://get.k3s.io | sh -s - \
--disable-network-policy \
--disable "servicelb" \
--disable "traefik" \
--disable "metrics-server"
# update k3s unit file to kill all subprocesses when stopping
sudo sed -i "s/KillMode=process/KillMode=mixed/g" /etc/systemd/system/k3s.service
sudo systemctl daemon-reload
# install MetalLB
k3s kubectl apply \
-f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml \
-f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml
k3s kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
k3s kubectl apply -f - <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 10.44.0.2-10.44.255.254
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment