Setting up a home lab or a production environment for Kubernetes often requires network segmentation. Using VLANs (Virtual LANs) allows you to isolate your K8s traffic from your general house or office traffic.
In this guide, we will configure a MikroTik Router to trunk two VLANs (100 and 300) over a single cable to a Proxmox host, specifically optimized for automated provisioning and security.
Why Isolate Kubernetes Traffic?
Isolating Kubernetes into its own VLAN (like VLAN 300) isn’t just about tidiness; it’s a security and operational necessity:
- Broadcast Storm Prevention: Kubernetes clusters (and the CNI plugins like Calico or Flannel) generate significant internal traffic. Isolation ensures this doesn’t slow down your “Home” or “Work” devices.
- Security (Blast Radius): If a container is compromised, a dedicated VLAN acts as a firewall boundary, preventing an attacker from easily scanning your personal devices on other VLANs.
- PXE Booting Requirements: PXE relies on DHCP broadcasts to find a boot server. In a “flat” network, your K8s nodes might catch a “normal” IP from your home router instead of the specialized PXE instructions meant for cluster deployment.
Part 1: MikroTik Configuration
1. Create the VLAN and DHCP (with PXE)
| |
2. Firewall Isolation (Best Practices)
We want a “One-Way Mirror” effect: You can manage the K8s nodes from your PC, but the K8s nodes cannot touch your PC or the Router’s settings.
| |
3. Configure the Bridge Trunk
| |
Part 2: Proxmox Configuration
1. Enable VLAN Awareness
- Navigate to System > Network on your Proxmox node.
- Edit
vmbr0. - Check the VLAN Aware box and Apply Configuration.
2. Assigning VLANs to VMs
In the Hardware tab of your VM, edit the Network Device and set the VLAN Tag to 300.
Best Practices for K8s Nodes
- Static Leases: Use the “Make Static” feature in MikroTik for your Control Plane nodes. K8s components like
etcdare sensitive to IP changes. - MAC Pinning: When using PXE, ensure your Proxmox VM has a manually assigned MAC address so your deployment server consistently identifies the node.
Summary Table
| VLAN | Purpose | Gateway | Access Level |
|---|---|---|---|
| 100 | Management | 192.168.10.1 | Full Access |
| 300 | K8s / PXE | 192.168.30.1 | Internet Only (Isolated) |