Public GitOps repository for showing how I run my services on k3s https://tobru.ch/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Renovate Bot 76f7c8565b Update renovate/renovate Docker tag to v34.48.3 11 hours ago
_apps install volsync 2 months ago
_test only warn for some policies 3 years ago
acmedns disable registration 1 year ago
argocd only cm once 3 months ago
cert-manager Merge pull request 'Update quay.io/jetstack/cert-manager-cainjector Docker tag to v1.9.1' (#968) from renovate/quay.io-jetstack-cert-manager-cainjector-1.x into master 4 months ago
docspell Update docker.io/postgres Docker tag to v13.8 4 months ago
drone Update dependency docker.io/drone/drone to v2.12.1 6 months ago
familydb allways pull image 2 years ago
graphs update grafana chart 3 months ago
headscale Revert "new config for new headscale version" 2 months ago
healthcheck correct ns for hc 1 year ago
influxdb modernize influx ingress 3 months ago
ioteer traccar env var 1 year ago
ipapi fix ingresses 12 months ago
k8up install k8up crds 12 months ago
kube-cleanup-operator Update quay.io/lwolf/kube-cleanup-operator Docker tag to v0.8.2 1 year ago
kube-system add traefik redirect middleware 5 months ago
linkding Update sissbruecker/linkding Docker tag to v1.15.0 3 months ago
mealie Update docker.io/hkotel/mealie Docker tag to v0.5.6 10 months ago
miniflux Merge pull request 'Update docker.io/postgres Docker tag to v13.8' (#1000) from renovate/docker.io-postgres-13.x into master 4 months ago
mosquitto Update docker.io/eclipse-mosquitto Docker tag to v2.0.15 4 months ago
mqttwarn Update ghcr.io/jpmens/mqttwarn-full Docker tag to v0.29.1 3 months ago
odoo pull odoo addons in initcontainer 4 months ago
owntracks set http prefix for tours 3 months ago
pylokid install pylokid 3 years ago
renovate Update renovate/renovate Docker tag to v34.48.3 11 hours ago
sealed-secrets Update quay.io/bitnami/sealed-secrets-controller Docker tag to v0.17.3 10 months ago
stakater-reloader Update stakater/reloader Docker tag to v0.0.125 3 days ago
system-upgrade-controller Update dependency rancher/system-upgrade-controller to v0.9.1 9 months ago
tobru-ch Update ghost Docker tag to v5.25.0 1 day ago
traccar Update docker.io/mariadb Docker tag to v10.9 3 months ago
.drone.yml use kubernetes for drone build 1 year ago
README.md rshared info 1 year ago
renovate.json statping is gone 1 year ago

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