Git Product home page Git Product logo

kube-homelab's Introduction

homelab

A Kubernetes based setup to run a home server.

getting started

I had also created a video where I show how I set the homelab up for my use.

requirements

  • Linux nodes (a VM, Raspberry PI, Tower PC)
  • Docker installed on the node
  • systemd configured on the nodes (this is because k3s runs as a systemd service)
  • ssh configured with a keypair - password based authentication is not supported

terminology

  • Any reusable part of this project will be an atom.
  • Various parts of the setup are put into different terraform modules to be used as a workspace, each. This is also called a molecule.

software to run the terraform molecules

  • terraform installed on the agent which will execute terraform (can be the node itself as well) - currently required_version = ">=1.3.0"
  • terraform-backend-git if you want to use a git repository to store terraform state.

order of molecules

  1. k3s
  2. cluster-resources

running the molecules

Only if you are using a remote backend

  • Fill .envrc with all the required values. Place one .envrc in each molecule, this will help segregate their values and also because each molecule should have its own state file, so export TF_BACKEND_GIT_GIT_STATE= will change. I use state-<MOLECULE_NAME>.json as the pattern
  • Import all environment variables by running . .envrc in the directory of the molecule
  • Run the terraform init as follows - terraform init -backend-config="address=${BACKEND}" -backend-config="lock_address=${BACKEND}" -backend-config="unlock_address=${BACKEND}" the BACKEND env var is setup based on the other env vars in .envrc

If you use local backend

  • Remove the backend "http" {} from all molecules and init the molecules terraform init
  • Now run terraform apply -var-file=inputs.tfvars (modify the inputs.tfvars as per your liking)

Read any specific requirements per molecule in their readme.

test bed

I'm using my Raspberry Pi 4 as my home server and all testing is done on it.

  • Raspberry Pi 4
  • Ubuntu Server 22.04
  • docker 20.10.12

apps

jellyfin

Jellyfin is a media server. Play all your local video content.

pihole (looking at other alternatives too)

Local DNS

nextcloud

File Sharing

setting up your machine

You can either use k3d to try out locally, or like I am, using a server. I have k3s installed on my Raspberry Pi 4.

k3s setup

Run the following to setup the cluster.

$ curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION='v1.21.14+k3s1' sh -

Now you can run terraform -chdir=iac plan to check what's getting installed.

Finally, run terraform -chdir=iac apply --auto-approve to install everything.

kube-homelab's People

Contributors

mrsauravsahu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cyber-paul

kube-homelab's Issues

improv: use feature flags to setup standard features

currently the only way to install things is the list of items to install with helm

  • make it feature flag based, so specific things can be installed.
  • to install non-standard apps, continue to support the helm list

feat: automate DNS entries in pihole

All hosts in the list passed to cluster-resources molecules (apart from nip.io ones) should be added as DNS entries in pihole to be able to access them on the network.

Currently this is done manually and thus is just an extra step to get everything working.

Automate this.

feat: setup Kubernetes with terraform

  • ability to run on same machine or remotely
  • k3s setup
  • health check at the end for k3s
  • install same ssh key
  • make the run scale across many hosts (currently only the pi) - can test it on docker ubuntu images
  • make the atom/molecule or component/blueprint project structure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.