• Stars
    star
    210
  • Rank 187,585 (Top 4 %)
  • Language
    Python
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My HomeLab environment

Preface

WARNING Currently longhorn does not support kubernetes 1.25 ( automatic upgrades have been disabled due to this for the future as well. Going to do it manually )

This repository contains basic HELM local charts for application installation as well as FluxCD2 HelmReleases for GitOps. I'm not going to move away from the local helm charts where possible as they make this repository pretty beginner-friendly.

๐Ÿ“– Check out the Documentation

๐Ÿ Getting Started

  1. Prerequisites
  2. Cluster Setup
  3. Cert Manager
  4. Setting Up Renovate 5Backups

Main tools used

  1. FluxCD 2 - GitOps for my HomeLab.
  2. Renovate - Checks for updates to actions, helm charts, helm releases, docker containers.
  3. ingress-nginx - Kubernetes ingress. This is used to access services using reverse proxy instead of exposing them on a port.
  4. cert-manager + reflector - cert-manager generates certificates for my services and reflector duplicates the generated ssl certificate secret to all the namespaces. The secret is called ingress.
  5. Longhorn - K8S native storage.
  6. SimpleSecrets - Kubernetes secret manager.
  7. Calico - Provides Networking for my HomeLab
  8. Ansible - Used to provision the architecture
  9. Velero - K8S and PVC backup. Free and open source by VMware
  10. Kube-vip - For a Virtual IP that I can use to access all my servers

GitOps ๐Ÿšง

GitOps is applied wherever possible using Flux2. CI/CD is done by bootstrapping flux into my cluster. Flux polls GitHub for changes and applies them automatically on my server. It is currently pretty stable and works fine

Image updates

Image updates are done via Renovate Bot ๐Ÿค–. Renovate bot does periodic scans for new image versions and submits pull request for each change.

Accessing services ( ingress-nginx, cert-manager )

Apps are currently exposed by ingress-nginx and have SSL certificates provided by cert-manager. A wildcard certificate is issued for my domain *.stefangenov.site and when the secret is created it is replicated in all namespace as ingress to be consumed by the ingress resources. This replication is needed because Let's encrypt rate limits certificate requests.

๐Ÿ–ฅ๏ธ Exposing Apps

As a legacy approach I used to expose my apps via NodePort. This ability is removed but can be easily enabled by removing the commented out nodePort values in the Helm Charts, and I also try to add this functionality to future apps and services I install.

Storage ( Longhorn )

Longhorn is a great replicated storage option with a great UI for better visualisation. It's fast and tailor made for k8s. Developed by the same people responsible for k3s/rancher and other great tools. Official site

Networking ( Calico CNI )

Calico is a great and mature CNI/IPAM software that is fast, scalable and feature rich. Source code

SimpleSecrets ( Secrets Management )

This is a tool that I've been developing in my spare time. It is not audited or tested by security professionals ! It allows for you to store secrets via the UI/API and create K8S Secrets by creating a SimpleSecrets object instead, allowing me to commit SimpleSecrets to git, while not exposing anything to the internet.

Backup ( Velero )

Velero allows me to back up selected namespaces and ( with the help of restic ) ship the data to different sources. In my case I'm using the velero AWS plugin.

The velero backup runs on a schedule every day during the evening hours and I pay around ~ $4 each month

What if I don't want to use Flux

Well it's absolutely fine. You can go to Helm/apps and install any app you want ( e.g. helm install media media -n media --create-namespace ). However things like ingress, cert-management, longhorn are handled only via Flux. Information on the helm chart that is used can be found in the helm-release.yaml for the specific service. Let's look at an example:

---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
    name: longhorn-system # What to call the deployment 
    namespace: longhorn-system # Where to install the helm chart 
spec:
    interval: 5m # How often do we poll for changes
    install:
        createNamespace: true # Same as --create-namespace
    chart:
        spec:
            chart: longhorn # Which chart to use
            version: 1.2.4 # Which version of the chart
            interval: 5m
#           Where to find information for this chart ( in my case I have a HelmRepository defined in cluster/homelab/helm/longhorn-system
            sourceRef: 
                kind: HelmRepository 
                name: longhorn-system
                namespace: flux-system
#   Overwriting some values
    values:
        ingress:
            enabled: true
            host: longhorn.stefangenov.site
            ingressClassName: nginx
            tls: true
            tlsSecret: ingress

        service:
            ui:
                type: NodePort
                nodePort: 30030

This would be the same as:

  1. Creating a new file with the content:

    values.yaml:

    ingress:
        enabled: true
        host: longhorn.stefangenov.site
        ingressClassName: nginx
        tls: true
        tlsSecret: ingress
    
    service:
        ui:
            type: NodePort
            nodePort: 30030
  2. Running: helm repo add longhorn https://charts.longhorn.io; helm repo update to add the longhorn helm repo

  3. Running: helm install longhorn/longhorn --name longhorn --create-namespace -n longhorn-system -f values.yaml

More Repositories

1

SimpleSecrets

K8S Secrets Manager Operator
TypeScript
26
star
2

docker-wallabag

Jinja
4
star
3

EventRequest

A backend server in NodeJs
JavaScript
4
star
4

.dotfiles

Welp, you know.... the files of dot
Lua
3
star
5

SimpleSecretsFrontend

Frontend to https://github.com/Michaelpalacce/SimpleSecrets written in VueJS3
Vue
2
star
6

NAT

NodeJS Aria Tools
TypeScript
2
star
7

Home

Contains information about my Home Setup
2
star
8

personal-website-vue

Personal website written in vue
JavaScript
2
star
9

docker-dailynotes

Multiarch dailynotes image
Dockerfile
2
star
10

docker-shiori

Automated docker arm build of https://github.com/go-shiori/shiori
Dockerfile
2
star
11

YellowSite

CSS
1
star
12

ChatApp

A simple chat app using NodeJS EventRequest and Socket.io
JavaScript
1
star
13

goip

Automatically updates IP address in various dns providers.
Go
1
star
14

docker-focalboard

A multiarch build of https://github.com/mattermost/focalboard
Dockerfile
1
star
15

gobi

Go Bi-Directional Sync With API
Go
1
star
16

ansible-docker-compose

Installs docker compose using ansible on Linux
1
star
17

MichaelPalacce

1
star
18

TorrentNAB

JavaScript
1
star
19

MajesticFrontEnd

PHP
1
star
20

PersonalWebsite

My Personal Website
EJS
1
star
21

ansible-kubernetes-master-security

Security for kubernetes master
1
star
22

auth

PHP
1
star
23

EventRequest-Benchmarks

Benchmarks for EventRequest
JavaScript
1
star
24

Gridzilla

PHP
1
star
25

Docker

A collection of docker projects
Dockerfile
1
star
26

Ansible

Just the test env used to test the roles
1
star
27

Social

PHP
1
star
28

ansible-kubernetes-cluster

Sets up a kubernetes cluster with kubeadm. Supports multiple master stacked setup
1
star
29

ansible-kubernetes-preflight

Ansible role used to setup all the kubernetes dependencies and binaries.
1
star
30

ansible-helm

Ansible role to install helm
1
star
31

ShoppingCart

PHP
1
star
32

ansible-docker

Installs docker
1
star
33

er_redis_data_server

Redis data server plugin for EventRequest
JavaScript
1
star
34

er_memcached_data_server

Plugin for event_request that implements a memcached data server
JavaScript
1
star
35

docker-kubectl

kubectl with sh ( for velero )
Dockerfile
1
star
36

Server

A simple storage solution app to be run on localhost
JavaScript
1
star
37

spacetraders-gui

VueJS3 gui for spacetraders.io. WIP
Vue
1
star
38

docker-vaultwarden-backup

Shell
1
star
39

tooljet

Dockerfile
1
star
40

docker-dashy

Dockerized dashy
Dockerfile
1
star
41

chatter

PHP
1
star
42

fs-browser

A package that allows you to paginate the file system.
JavaScript
1
star
43

advent-of-code

Advent of code is an advent calendar of small programming puzzles
Go
1
star