Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
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:
1variant: fcos2version: 1.4.03passwd:4 users:5 - name: core6 ssh_authorized_keys:7 - YOUR_SSH_PUBLIC_KEY_HERE8
9storage:10 files:11 - path: /etc/hostname12 mode: 064413 contents:14 inline: |15 k8s-nodeReplace 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:
1podman run --interactive --rm \2 quay.io/coreos/butane:release \3 --pretty --strict < basic.bu > basic.ign3. Create VM Script#
Create a script named start-node.sh to launch your CoreOS VM:
1#!/bin/sh2
3IGN_CONFIG=/path/to/basic.ign4IMAGE=/path/to/fedora-coreos.qcow25VM_NAME=k8s-node6VCPUS=27RAM_MB=40968DISK_GB=209STREAM=stable10
11chcon --verbose --type svirt_home_t ${IGN_CONFIG}12virt-install --connect="qemu:///system" \13 --name="${VM_NAME}" \14 --vcpus="${VCPUS}" \15 --memory="${RAM_MB}" \16 --os-variant="fedora-coreos-$STREAM" \17 --import --graphics=none \18 --disk="size=${DISK_GB},backing_store=${IMAGE}" \19 --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#
1chmod +x start-node.sh2./start-node.sh5. Note VM IP Address#
During boot, you’ll see network information. Look for a line showing the IP address assigned to the VM: