Public GitOps repository for showing how I run my services on k3s https://tobru.ch/
This repository has been archived on 2023-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Tobias Brunner c50c8a709e auto update statping 2020-04-01 21:15:49 +02:00
_apps auto update statping 2020-04-01 21:15:49 +02:00
argocd choose correct template 2020-03-31 22:47:16 +02:00
cert-manager Merge pull request 'Update quay.io/jetstack/cert-manager-cainjector Docker tag to v0.14.1' (#84) from renovate/docker-quay.io-jetstack-cert-manager-cainjector-0.x into master 2020-03-26 20:08:04 +00:00
drone Update docker.io/drone/drone Docker tag to v1.7.0 2020-03-28 02:00:25 +00:00
graphs upgrade chart and config for reverse proxy 2020-03-31 20:46:26 +02:00
influxdb disable influx reporting 2020-03-16 20:19:57 +01:00
jitsi enable etherpad 2020-03-26 21:34:27 +01:00
k8up move k8up rules to monitoring 2020-03-07 20:52:58 +01:00
loki move config and enable retention 2020-03-01 14:34:21 +01:00
monitoring upgrade all the things 2020-03-31 21:07:00 +02:00
mosquitto move acls and passwds to sealed secrets 2020-01-26 20:30:42 +01:00
owntracks only keep 1 backup job 2020-03-21 14:30:41 +01:00
pylokid install pylokid 2020-02-08 15:59:06 +01:00
renovate Update renovate/renovate Docker tag to v19.189 2020-03-30 08:00:28 +00:00
sealed-secrets Update quay.io/bitnami/sealed-secrets-controller Docker tag to v0.12.1 2020-03-31 18:00:29 +00:00
stakater-reloader Update stakater/reloader Docker tag to v0.0.58 2020-03-30 16:00:27 +00:00
statping Update docker.io/hunterlong/statping Docker tag to v0.90.21 2020-03-31 22:00:36 +00:00
tobru-ch Update ghost Docker tag to v3.12.1 2020-03-31 01:00:32 +00:00
README.md add hint about sysctl 2020-03-21 16:32:57 +01:00
renovate.json auto update statping 2020-04-01 21:15:49 +02:00

README.md

GitOps for tbrnt k3s hosting

Repo structure

  • Each subdirectory is a namespace
  • _apps is the meta directory for Argo CD apps
  • Another private repo contains stuff in a more approachable format, f.e. for dealing with updating sealed-secrets: gitops-tbrnt-private

Usage

Argo CD

Access

Either

sudo -E kubefwd svc -n argocd and then https://argocd-server/

or

kubectl port-forward svc/argocd-server -n argocd 8080:443 and then https://localhost:8080/

CLI

  • argocd login argocd-server
  • argocd app list
  • argocd app sync <name>

Kubeseal (Sealed Secrets)

See README of apps. Basically:

kubeseal --controller-namespace sealed-secrets -o yaml -n MYNS < ../../gitops-tbrnt-private/MYNS/MYSECRET.yaml > MYSECRET-secret.yaml

Bootstrap GitOps

After installing k3s, do:

# install Argo CD
kubectl create ns argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
argocd login argocd-server

# Restore Sealed Secrets secret key
kubectl create ns sealed-secrets
kubectl apply -f ../gitops-tbrnt-private/sealed-secrets/master-key.yaml

# Instantiate Argo Root App
kubectl apply -f _apps/apps.yaml

# Let Argo CD do it's job
argocd app sync apps
argocd app sync sealed-secrets
argocd app sync -l app.kubernetes.io/instance=apps

TODO:

  • Restore PVCs via K8up

k3s on Alpine

Installing: Alpine

Basically follow the Alpine wiki.

Then install prerequisites and some essential packages:

apk add \
  vim \
  iptables \
  wireguard-virt \
  bash \
  curl

Needs community repo enabled in /etc/apk/repositories.

Tweak Sysctl in /etc/sysctl.conf:

fs.inotify.max_user_instances = 8192
fs.inotify.max_user_watches = 524288

Installing: k3s

Via k3sup:

k3sup install \
  --ip=185.95.218.11 \
  --user=root \
  --local-path=~/.kube/config_knurrli2 \
  --sudo=false \
  --k3s-extra-args='--tls-san knurrli.tobrunet.ch --cluster-cidr 10.44.0.0/16 --flannel-backend wireguard'

Helpful infos

Paths

  • Volumes: /var/lib/rancher/k3s/storage/
  • Config: /etc/rancher/k3s/
  • Manifests: /var/lib/rancher/k3s/server/manifests/

Links

Configure Wireguard

/etc/network/interfaces

auto wg0
iface wg0 inet static
    address 10.42.42.16
    netmask 255.255.255.0
    pre-up ip link add dev wg0 type wireguard
    pre-up wg setconf wg0 /etc/wireguard/wg0.conf
    post-up ip route add 10.42.42.0/24 dev wg0
    post-down ip link delete dev wg0