Skip to content

adhasahar97/homelab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Homelab

Description

This homelab project is a self-hosted Kubernetes cluster that leverages modern infrastructure-as-code practices and GitOps workflows. The project combines several powerful technologies to create a robust, secure, and maintainable home infrastructure:

  • Self-hosted Kubernetes cluster for container orchestration
  • Cloudflare Tunnel for secure external access
  • Terraform for infrastructure provisioning and management
  • ArgoCD for GitOps-based continuous delivery

Motivation

The motivation behind this homelab project is to:

  • Learn and experiment with Kubernetes in a production-like environment
  • Implement modern DevOps practices at home
  • Create a secure and scalable infrastructure for personal projects
  • Gain hands-on experience with infrastructure-as-code and GitOps
  • Build a reliable platform for self-hosted services

Diagram

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  Local Network  │────▶│  Cloudflare     │────▶│  Kubernetes     │
│                 │     │  Tunnel         │     │  Cluster        │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                                                         │
                                                         ▼
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  Terraform      │────▶│  ArgoCD         │────▶│  Applications   │
│  State          │     │  GitOps         │     │  & Services     │
└─────────────────┘     └─────────────────┘     └─────────────────┘

Pre-requisites

Before setting up this homelab, ensure you have the following:

  • Software Requirements:
    • Only tested on MacOs. If you're using Windows, consider setting all this up inside WSL2 instead.
    • AWS account for storing Terraform statefile in S3 bucket
    • Kubernetes installed on your machine (You can use minikube or k3s)
    • kubectl CLI tool on your local machine
    • Git
    • Cloudflare account with domain registered
    • GitHub Actions Runner on your local machine. If you're on Windows, please install this inside WSL2.

Usage

  1. Fork this repository:

    git clone https://github.com/<username>/homelab.git
    cd homelab
  2. Configure your GitHub Actions Secrets and Variables:

    Secrets secrets

    Variables variables

Usage

  1. Access ArgoCD:

    kubectl port-forward svc/argocd-server -n argocd 8080:443
    # Access at https://localhost:8080
  2. Deploy applications using ArgoCD:

    # Create an application
    kubectl apply -f applications/my-app.yaml
  3. Monitor Cloudflare Tunnel:

    # Check tunnel status
    cloudflared tunnel list

For more detailed information about each component, please refer to their respective documentation:

Description

This homelab project is a self-hosted Kubernetes cluster that leverages modern infrastructure-as-code practices and GitOps workflows. The project combines several powerful technologies to create a robust, secure, and maintainable home infrastructure:

  • Self-hosted Kubernetes cluster for container orchestration
  • Cloudflare Tunnel for secure external access
  • Terraform for infrastructure provisioning and management
  • ArgoCD for GitOps-based continuous delivery

Motivation

The motivation behind this homelab project is to:

  • Learn and experiment with Kubernetes in a production-like environment
  • Implement modern DevOps practices at home
  • Create a secure and scalable infrastructure for personal projects
  • Gain hands-on experience with infrastructure-as-code and GitOps
  • Build a reliable platform for self-hosted services

Diagram

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  Local Network  │────▶│  Cloudflare     │────▶│  Kubernetes     │
│                 │     │  Tunnel         │     │  Cluster        │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                                                         │
                                                         ▼
┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  Terraform      │────▶│  ArgoCD         │────▶│  Applications   │
│  State          │     │  GitOps         │     │  & Services     │
└─────────────────┘     └─────────────────┘     └─────────────────┘

Pre-requisites

Before setting up this homelab, ensure you have the following:

  • Software Requirements:
    • AWS account for storing Terraform statefile in S3 bucket
    • Kubernetes installed on your machine (You can use minikube or k3s)
    • kubectl CLI tool
    • Git
    • Cloudflare account with domain registered

Configuring Terraform backend to use S3 Bucket

Installation

  1. Clone this repository:

    git clone https://github.com/adhasahar97/homelab.git
    cd homelab
  2. Initialize Terraform:

    cd terraform
    terraform init
  3. Configure your variables:

    cp terraform.tfvars.example terraform.tfvars
    # Edit terraform.tfvars with your configuration
  4. Apply Terraform configuration:

    terraform apply

Usage

  1. Access the Kubernetes Dashboard:

    kubectl proxy
    # Access at http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
  2. Access ArgoCD:

    kubectl port-forward svc/argocd-server -n argocd 8080:443
    # Access at https://localhost:8080
  3. Deploy applications using ArgoCD:

    # Create an application
    kubectl apply -f applications/my-app.yaml
  4. Monitor Cloudflare Tunnel:

    # Check tunnel status
    cloudflared tunnel list

For more detailed information about each component, please refer to their respective documentation:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published