# Installing k3s

Create `/etc/rancher/k3s/config.yaml`. Must be done before installation.

Run: `curl -sfL https://get.k3s.io | bash`

Copy /etc/rancher/k3s/k3s.yaml to ~/.kube/config. Adjust `server:` url.

Reinstalling:

    k3s-uninstall.sh

Reboot

    cd /etc
    git restore rancher/k3s/config.yaml
    cd
    curl -sfL https://get.k3s.io | bash

# Get kubeconfig

    ssh danneri.dn42.trygvis.io sudo cat /etc/rancher/k3s/k3s.yaml |\
        sed s,https://.*,https://danneri.dn42.trygvis.io:6443, > ~/.kube/config

# Installing Cilium:

    cilium install -f cilium.yaml

old:

    cilium install \
        --set routingMode=native \
        --set ipv4.enabled=true \
        --set ipam.operator.clusterPoolIPv4PodCIDRList=10.0.0.0/8 \
        --set ipv4NativeRoutingCIDR=10.0.0.0/8 \
        --set ipv6.enabled=true \
        --set enableIPv6Masquerade=false \
        --set k8s.requireIPv6PodCIDR=true \
        --set ipam.operator.clusterPoolIPv6PodCIDRList=fdb1:4242:3538:2008:aaaa:aaaa:aaaa::/96 \
        --set ipam.operator.clusterPoolIPv6MaskSize=112 \
        --set ipv6NativeRoutingCIDR=fdb1:4242:3538:2008::/64 \
        --set kubeProxyReplacement=true \
        --set k8sServiceHost=fdb1:4242:3538:2008:9422:d355:95b7:f170 \
        --set k8sServicePort=6443

TODO: check `kubeProxyReplacement=true` / `kube-proxy-replacement`.

# Uninstalling

Run: `k3s-uninstall.sh`. Note that this will delete everything, including `/etc/rancher/k3s/config.yaml`.

    rm -rf \
        /var/lib/cni \
        /etc/cni \
        /var/lib/rancher \
        /run/cilium \
        /run/containerd \
        /etc/sysctl.d/99-zzz-override_cilium.conf

and then do a reboot to really stop Cilium from running.