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
Renovate Bot 040a4d5455
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
Update docker.io/drone/drone Docker tag to v2.4.0
2021-09-23 16:42:58 +00:00
_apps install miniflux rss reader 2021-08-27 20:32:20 +02:00
_test only warn for some policies 2020-05-04 21:15:38 +02:00
argocd Update quay.io/argoproj/argocd Docker tag to v2.1.2 2021-09-09 15:00:56 +00:00
cert-manager upgrade cert manager 2021-08-24 21:06:10 +02:00
docspell Merge pull request 'Update docker.io/docspell/joex Docker tag to v0.26.0' (#518) from renovate/docker.io-docspell-joex-0.x into master 2021-09-09 18:15:19 +00:00
drone Update docker.io/drone/drone Docker tag to v2.4.0 2021-09-23 16:42:58 +00:00
familydb allways pull image 2021-05-04 20:54:17 +02:00
graphs Update grafana/grafana Docker tag to v8.1.3 2021-09-09 15:00:53 +00:00
healthcheck correct ns for hc 2021-08-26 23:12:21 +02:00
influxdb Update influxdb Docker tag to v1.8.9 2021-08-10 21:00:51 +00:00
ioteer new connection to ttn v3 2021-09-12 21:05:02 +02:00
ipapi use default echoip template 2021-04-18 13:23:47 +02:00
k8up update k8up helm and wrestic image 2021-08-25 13:24:07 +02:00
kube-cleanup-operator Update quay.io/lwolf/kube-cleanup-operator Docker tag to v0.8.2 2021-07-09 18:00:52 +00:00
kube-system Update us.gcr.io/k8s-artifacts-prod/autoscaling/vpa-recommender Docker tag to v0.9.2 2021-01-15 15:00:40 +00:00
miniflux configure miniflux 2021-08-27 21:00:29 +02:00
mosquitto upgrade mosquitto 2021-05-02 15:34:54 +02:00
owntracks Update quay.io/oauth2-proxy/oauth2-proxy Docker tag to v7 2021-08-24 18:42:35 +00:00
pylokid install pylokid 2020-02-08 15:59:06 +01:00
renovate Update renovate/renovate Docker tag to v27.15.0 2021-09-22 16:43:03 +00:00
sealed-secrets update status on sealed secrets 2021-08-24 23:10:00 +02:00
stakater-reloader Update stakater/reloader Docker tag to v0.0.99 2021-07-30 07:00:43 +00:00
system-upgrade-controller Update rancher/system-upgrade-controller Docker tag to v0.7.5 2021-09-09 15:00:59 +00:00
tobru-ch Update ghost Docker tag to v4.15.0 2021-09-21 16:43:22 +00:00
traccar Update docker.io/traccar/traccar Docker tag to v4.14 2021-08-24 18:42:13 +00:00
.drone.yml use kubernetes for drone build 2021-08-24 21:38:05 +02:00
README.md rshared info 2021-08-24 20:09:26 +02:00
renovate.json statping is gone 2021-09-09 20:15:42 +02:00

README.md

GitOps for tbrnt k3s hosting

Build Status

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
  • _tests contains some Open Policy Agent rego files which are used in the Drone CI pipeline to validate configuration.

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

Add rshared mount option to root filesystem for node-exporter to work correctly.

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