Single Node Kubernetes on CoreOS - Complete Setup Guide
Setting up a lightweight, single-node Kubernetes environment is perfect for development, testing, and learning purposes. This guide walks you through deploying Kubernetes on Fedora CoreOS - a minimal, container-focused operating system designed for running containerized workloads.
We’ll break this process into two main stages:
- Setting up the CoreOS virtual machine
- Installing and configuring Kubernetes
Prerequisites
Before starting, ensure you have the following on your host system:
- Fedora CoreOS qcow2 image (download here)
- podman installed (
dnf install podman
) - libvirt and virt-install tools (
dnf install libvirt virt-install
) - A generated SSH key pair (
ssh-keygen -t ed25519
)
Stage 1: Basic CoreOS Setup
1. Create Basic Ignition Config
Ignition is the CoreOS configuration system. Create a file named basic.bu
:
variant: fcosversion: 1.4.0passwd: users: - name: core ssh_authorized_keys: - YOUR_SSH_PUBLIC_KEY_HERE
storage: files: - path: /etc/hostname mode: 0644 contents: inline: | k8s-node
Replace YOUR_SSH_PUBLIC_KEY_HERE
with the content of your ~/.ssh/id_ed25519.pub
file.
2. Generate Ignition File
Convert the Butane configuration to an Ignition file:
podman run --interactive --rm \ quay.io/coreos/butane:release \ --pretty --strict < basic.bu > basic.ign
3. Create VM Script
Create a script named start-node.sh
to launch your CoreOS VM:
#!/bin/sh
IGN_CONFIG=/path/to/basic.ignIMAGE=/path/to/fedora-coreos.qcow2VM_NAME=k8s-nodeVCPUS=2RAM_MB=4096DISK_GB=20STREAM=stable
chcon --verbose --type svirt_home_t ${IGN_CONFIG}virt-install --connect="qemu:///system" \ --name="${VM_NAME}" \ --vcpus="${VCPUS}" \ --memory="${RAM_MB}" \ --os-variant="fedora-coreos-$STREAM" \ --import --graphics=none \ --disk="size=${DISK_GB},backing_store=${IMAGE}" \ --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${IGN_CONFIG}"
Update the paths to your Ignition config file and CoreOS image.
4. Launch VM
chmod +x start-node.sh./start-node.sh
5. Note VM IP Address
During boot, you’ll see network information. Look for a line showing the IP address assigned to the VM: