Skip to content

kravii/ODP-DC

Repository files navigation

Hetzner Baremetal DC & Kubernetes Cluster Setup

A comprehensive solution for setting up a VM Data Center and Kubernetes cluster on Hetzner baremetal servers with automated provisioning, monitoring, and management capabilities.

πŸ—οΈ Architecture Overview

This project provides:

  • Pre-provisioned Server Support: Works with existing Rocky Linux 9 baremetal servers
  • Shared RAID Storage: 1.8TB RAID storage shared across all nodes for K8s and VMs
  • Automated K8s Setup: High-availability Kubernetes cluster with 3 control plane nodes
  • SSH Key Management: Flexible SSH key and port configuration
  • Resource Pooling: Unified resource management across all baremetal servers
  • VM Provisioning: GUI-based VM creation with multiple OS options
  • Storage Management: Shared RAID storage (1.8TB) with dynamic allocation and monitoring
  • Monitoring: Comprehensive monitoring with Grafana dashboards
  • User Management: RBAC with namespace isolation
  • Scalability: Support for up to 200 baremetal servers and 300 VMs

πŸš€ Features

Core Infrastructure

  • βœ… Automated Kubernetes cluster setup with HA control plane
  • βœ… Resource pooling from multiple baremetal servers
  • βœ… Support for up to 200 baremetal servers
  • βœ… Automated VM provisioning (up to 300 VMs)
  • βœ… Multiple OS support (CentOS7, RHEL7/8/9, RockyLinux9, Ubuntu20/22/24, OEL8.10)

Management & Monitoring

  • βœ… Rancher-based cluster management
  • βœ… GUI for adding/removing servers from cluster
  • βœ… Resource allocation and scaling per namespace
  • βœ… Comprehensive monitoring dashboard
  • βœ… Slack/JIRA notification system
  • βœ… Health monitoring for all baremetal servers

Security & Access

  • βœ… User management with admin/user roles
  • βœ… Namespace-based resource isolation
  • βœ… Default user acceldata with SSH key on all VMs/containers
  • βœ… RBAC configuration

πŸ“ Project Structure

β”œβ”€β”€ terraform/                 # Infrastructure as Code
β”‚   β”œβ”€β”€ hetzner/              # Hetzner provider configuration
β”‚   β”œβ”€β”€ kubernetes/           # K8s cluster setup
β”‚   └── monitoring/           # Monitoring infrastructure
β”œβ”€β”€ ansible/                  # Configuration management
β”‚   β”œβ”€β”€ playbooks/           # Ansible playbooks
β”‚   β”œβ”€β”€ roles/               # Reusable roles
β”‚   └── inventory/           # Server inventory
β”œβ”€β”€ kubernetes/               # K8s manifests and configs
β”‚   β”œβ”€β”€ cluster-setup/       # Cluster initialization
β”‚   β”œβ”€β”€ monitoring/          # Monitoring stack
β”‚   └── applications/        # Application deployments
β”œβ”€β”€ monitoring/               # Monitoring configuration
β”‚   β”œβ”€β”€ prometheus/          # Prometheus configs
β”‚   β”œβ”€β”€ grafana/             # Grafana dashboards
β”‚   └── alertmanager/        # Alerting rules
β”œβ”€β”€ vm-provisioning/         # VM management system
β”‚   β”œβ”€β”€ api/                 # REST API for VM operations
β”‚   β”œβ”€β”€ frontend/            # Web GUI
β”‚   └── templates/           # VM templates
β”œβ”€β”€ scripts/                 # Utility scripts
└── docs/                    # Documentation

πŸ› οΈ Prerequisites

Management Machine

  • Terraform >= 1.5.0
  • Ansible >= 2.12.0
  • kubectl >= 1.28.0
  • Helm >= 3.12.0
  • Docker >= 20.10.0
  • SSH access to baremetal servers

Baremetal Servers

  • Operating System: Rocky Linux 9 (latest)
  • CPU: Minimum 2 cores, recommended 4+ cores
  • RAM: Minimum 4GB, recommended 8GB+
  • Storage: Minimum 40GB, recommended 100GB+
  • Network: Stable network connectivity
  • Access: Root or sudo access to all servers
  • SSH: SSH access with private key

πŸš€ Quick Start

  1. Clone the repository

    git clone <repository-url>
    cd hetzner-dc-k8s-setup
  2. Configure environment

    cp .env.example .env
    # Edit .env with your server IPs and SSH configuration
  3. Prepare servers (if not already done)

    # Follow the Rocky Linux setup guide
    # See docs/rocky-linux-setup.md for detailed instructions
  4. Configure infrastructure

    cd terraform
    terraform init
    terraform plan
    terraform apply
  5. Setup Kubernetes cluster

    cd ../ansible
    ansible-playbook -i inventory/hosts.yml playbooks/prepare-servers.yml
    ansible-playbook -i inventory/hosts.yml playbooks/setup-k8s-cluster.yml
  6. Deploy monitoring stack

    cd ../kubernetes
    kubectl apply -f monitoring/
  7. Access Rancher dashboard

    kubectl port-forward svc/rancher-server 8080:80
    # Open http://localhost:8080

πŸ“Š Monitoring

The monitoring stack includes:

  • Prometheus: Metrics collection and storage
  • Grafana: Visualization and dashboards
  • AlertManager: Alert routing and notification
  • Node Exporter: Baremetal metrics
  • cAdvisor: Container metrics

Access Grafana at http://<grafana-service>:3000 (default: admin/admin)

πŸ”§ Management Tools

This project integrates with:

  • Rancher: Cluster management and GUI
  • Helm: Package management
  • kubectl: Command-line interface
  • k9s: Terminal-based UI
  • Telepresence: Local development integration

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

πŸ”„ Version History

  • v1.0.0: Initial release with basic K8s cluster setup
  • v1.1.0: Added VM provisioning capabilities
  • v1.2.0: Enhanced monitoring and alerting
  • v1.3.0: GUI improvements and user management

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •