Post

First Portable Microcluster Build

In this guide, we will walk through the process of building a portable microcluster using 4 OptiPlex 3060 micros, focusing on infrastructure management and s....

# First Portable Microcluster Build: A Comprehensive Guide for Homelab and Self-Hosted Environments

In this guide, we will walk through the process of building a portable microcluster using 4 OptiPlex 3060 micros, focusing on infrastructure management and system administration. This project caters to experienced sysadmins and DevOps engineers who seek to expand their homelab or self-hosted environments with an affordable, high-performance solution.

Introduction (200-300 words)

The title of this project signifies the construction of our first portable microcluster. In essence, we’re creating a compact, self-contained data center that can be easily transported and deployed in various locations. This setup offers numerous benefits for homelab enthusiasts, software developers, and anyone wishing to run self-hosted services with minimal reliance on third-party infrastructure.

By the end of this guide, you will learn how to install, configure, and manage a portable microcluster. You’ll gain valuable insights into system administration, infrastructure management, and network setup for your homelab or personal projects.

Prerequisites (300-400 words)

System Requirements

  • 4 OptiPlex 3060 Micros (each with as much RAM and SSD as possible)
  • GL-INET SF-T1200 Network Switch
  • Ubuntu Server 20.04 LTS (or other preferred Linux distribution)
  • Docker and Kubernetes (optional, depending on use case)

Software Requirements

  • Ansible 2.11.x
  • Terraform 0.15.x
  • Helm 3.x

Network Requirements

  • Static IP addresses for each node in the cluster
  • A subnet that can accommodate all nodes (e.g., 192.168.1.0/24)
  • Firewall rules to allow necessary traffic between nodes and external access

User Permissions & Access Levels

Ensure you have root or sudo privileges on each node and the ability to execute scripts as needed.

Installation & Setup (800-1000 words)

We will leverage Ansible for provisioning our nodes, Terraform for network setup, and Helm for managing Kubernetes services.

Provisioning Nodes with Ansible

  1. Create an inventory file with the IP addresses of your nodes:
    1
    2
    3
    4
    5
    
    [nodes]
    node1 ansible_host=<IP_ADDRESS_OF_NODE1>
    node2 ansible_host=<IP_ADDRESS_OF_NODE2>
    node3 ansible_host=<IP_ADDRESS_OF_NODE3>
    node4 ansible_host=<IP_ADDRESS_OF_NODE4>
    
  2. Write an Ansible playbook to install Ubuntu Server 20.04 LTS, Docker, and Kubernetes (if needed).

Network Setup with Terraform

  1. Create a Terraform configuration file for the GL-INET SF-T1200 switch:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
provider "glinet" {
  # Your Gl-inet API Token here
}

resource "glinet_device" "switch" {
  name = "Microcluster Switch"

  vlan {
    id       = 1
    ip      = "192.168.1.1/24"
  }

  port {
    interface_name = "Eth0"
    ip             = "192.168.1.254/24"
  }
}
  1. Apply the Terraform configuration:
    1
    2
    
    terraform init
    terraform apply
    

Service Configuration

  1. Write a Helm chart for your desired service (e.g., Prometheus, Grafana) and deploy it using Helm.

Configuration (600-800 words)

Adjust various configuration options to suit your needs:

  • Ansible playbooks: Customize roles for specific tasks or applications.
  • Terraform configuration files: Modify network settings, subnets, and firewall rules as needed.
  • Helm charts: Tweak service parameters, resource limits, and other settings.

Security Hardening

  • Use SSH keys for secure access to nodes.
  • Enable AppArmor or similar security modules on Ubuntu Server 20.04 LTS.
  • Configure firewall rules restrictively, allowing only necessary traffic.

Performance Optimization

  • Adjust Kubernetes resource limits and requests based on node capabilities.
  • Tune system settings such as swap space, kernel parameters, and network buffers for optimal performance.

Usage & Operations (400-600 words)

  • Common operations include scaling the cluster, adding or removing nodes, and deploying new services using Helm.
  • Monitor your microcluster with tools like Prometheus and Grafana to ensure smooth operation.
  • Regularly backup your data and configurations to avoid data loss in case of hardware failures or other incidents.

Troubleshooting (300-400 words)

  • Common issues may include network connectivity problems, service deployment errors, and resource exhaustion.
  • Debug commands like journalctl, docker logs, and kubectl logs can help identify and resolve these issues.
  • Performance tuning tips include optimizing resource usage, caching, and load balancing.

Conclusion (200-300 words)

Congratulations on building your first portable microcluster! With this knowledge, you’ll be well-equipped to manage self-hosted services, expand your homelab, and gain hands-on experience in system administration. For more advanced topics, explore concepts like container orchestration, distributed databases, and cloud native applications.

Happy learning, and remember to share your experiences with the DevOps community! For additional resources and best practices, refer to the following links:

This post is licensed under CC BY 4.0 by the author.