2024-05-22 08:48:51 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2023-11-06 08:42:51 -05:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-07-08 10:39:56 -04:00
2024-06-09 18:35:56 -04:00
2024-07-08 10:39:56 -04:00
2024-05-22 08:48:51 -04:00
2024-07-08 10:39:56 -04:00

Homelab

A project to store homelab stuff.

Table of Contents

Apps

Dashboard

The kubernetes dashboard isn't all that useful but it can sometimes give you a good visual breakdown when things are going wrong. It's sometimes faster than running kubectl get commands over and over.

Create the dashboard and an admin user with:

helm upgrade \
--install \
--namespace kubernetes-dashboard \
--create-namespace \
dashboard-user ./helm/dashboard-user

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Then login with the following:

kubectl -n kubernetes-dashboard create token admin-user
kubectl proxy

Nextcloud

The first chart we'll deploy is nextcloud. This is a custom chart because Nextcloud doesn't support helm installation natively (yet). There is a native Docker image and really detailed installation instructions so we can pretty easily piece together what's required.

This image runs the nextcloud cron job automatically and creates random secrets for all infrastructure - very helpful for a secure deployment, not very helpful for migrating clusters. You'll want to export the secrets and save them in a secure location.

helm upgrade --install \
    nextcloud \
    ./helm/nextcloud \
    --namespace nextcloud \
    --create-namespace

Need to add lots of files? Copy them to the user data dir and then run

./occ files:scan --all

Set up SES with the following links:

https://docs.aws.amazon.com/general/latest/gr/ses.html

To upgrade you'll need to:

  1. Apply the new image in values.yaml

  2. Exec into the container and run the following:

    su -s /bin/bash www-data
    ./occ upgrade
    ./occ maintenance:mode --off
    

See https://docs.nextcloud.com/server/latest/admin_manual/maintenance/upgrade.html#maintenance-mode for more information.

Test Deploy

You can create a test deployment with the following:

helm upgrade --install nextcloud ./helm/nextcloud \
    --namespace nextcloud-test \
    --create-namespace \
    --set nextcloud.domain=nextcloud-test.reeseapps.com \
    --set nextcloud.html.storageClassName=zfs-nfs-enc1 \
    --set nextcloud.html.storage=8Gi \
    --set nextcloud.data.storageClassName=zfs-nfs-enc1 \
    --set nextcloud.data.storage=8Gi \
    --set postgres.storageClassName=zfs-nfs-enc1 \
    --set postgres.storage=8Gi \
    --set redis.storageClassName=zfs-nfs-enc1 \
    --set redis.storage=8Gi \
    --set show_passwords=true \
    --dry-run

Gitea

Gitea provides a helm chart here. We're not going to modify much, but we are going to solidify some of the default values in case they decide to change things. This is the first chart (besides ingress-nginx) where we need to pay attention to the MetalLB annotation. This has been set in the values.yaml file.

Staging

There is a gitea-staging.yaml file with staging values. This should be installed in the gitea-staging namespace. Follow the instructions below, but replace the gitea namespace with gitea-staging. Staging is useful for testing major release upgrades, especially since Gitea tends to change how values.yaml is structured.

Install

First we need to create the gitea admin secret

kubectl create namespace gitea
kubectl create secret generic gitea-admin-secret \
    -n gitea \
    --from-literal=username='gitea-admin' \
    --from-literal=password="$(pwgen -c -s 64 | head -n 1)" \
    --from-literal=email=''
helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
helm upgrade --install \
    gitea \
    gitea-charts/gitea \
    --values gitea/gitea-values.yaml \
    --namespace gitea \
    --create-namespace

If you need to backup your database you can run:

# Backup
kubectl exec -it -n gitea gitea-postgresql-0 -- \
    pg_dump \
    --no-owner \
    --dbname=postgresql://gitea:gitea@localhost:5432 > gitea_backup.db

# Take gitea down to zero pods
kubectl scale statefulset gitea --replicas 0

# Drop the existing database
kubectl exec -it -n gitea gitea-postgresql-0 -- psql -U gitea

\c postgres;
drop database gitea;
CREATE DATABASE gitea WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
exit

# restore from backup
kubectl exec -it -n gitea gitea-postgresql-0 -- \
    psql \
    postgresql://gitea:gitea@localhost:5432 gitea < gitea_backup.db

# Restore gitea to 1 pod
kubectl scale statefulset gitea --replicas 1

Minecraft

Minecraft is available through the custom helm chart (including a server downloader). The example below installs nimcraft. For each installation you'll want to create your own values.yaml with a new port. The server-downloader is called "minecraft_get_server" and is available on Github.

Nimcraft

helm upgrade --install \
    nimcraft \
    ./helm/minecraft \
    --namespace nimcraft \
    --create-namespace

Testing

helm upgrade --install \
    testcraft \
    ./helm/minecraft \
    --namespace testcraft \
    --create-namespace \
    --set port=25566

Courtnie

helm upgrade --install \
    courtniecraft \
    ./helm/minecraft \
    --namespace courtniecraft \
    --create-namespace \
    --set port=25568

Snapdrop

Snapdrop is a file sharing app that allows airdrop-like functionality over the web

helm upgrade --install \
    snapdrop \
    ./helm/snapdrop \
    --namespace snapdrop \
    --create-namespace

Jellyfin

This assumes you have a media NFS share.

helm upgrade --install \
    jellyfin \
    ./helm/jellyfin \
    --namespace jellyfin \
    --create-namespace

Iperf3

This creates a basic iperf3 server.

helm upgrade --install \
    iperf3 \
    ./helm/iperf3 \
    --namespace iperf3 \
    --create-namespace

Wordpress

The bitnami wordpress chart allows enough customization to work on a custom K3S server. With some tweaks it's quite good. Use the values in bitnami/wordpress.yaml as a starting point.

helm upgrade --install \
    wordpress \
    -f bitnami/wordpress.yaml \
    --set wordpressUsername=admin \
    --set wordpressPassword=password \
    --set mariadb.auth.rootPassword=secretpassword \
    oci://registry-1.docker.io/bitnamicharts/wordpress

Grafana

https://grafana.com/docs/grafana/latest/setup-grafana/installation/kubernetes/

Grafana has a kubernetes yaml they prefer you use. See kubectl/grafana.yaml.

kubectl apply -f kubectl/grafana.yaml
Description
No description provided
Readme 31 MiB
Languages
Python 61.6%
Shell 18.8%
Dockerfile 13.1%
Jinja 5.1%
DIGITAL Command Language 1.4%