A GitHub Action for installing and configuring microk8s - a lightweight, pure-upstream Kubernetes designed for developers, edge, IoT, and CI/CD.
- ✅ Automatic installation of microk8s via snap
- ✅ Support for different versions and channels
- ✅ Easy addon management (dns, storage, ingress, etc.)
- ✅ Waits for cluster readiness
- ✅ Outputs kubeconfig path for easy integration
- ✅ No cleanup required - designed for ephemeral GitHub Actions runners
name: Test with microk8s
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup microk8s
id: microk8s
uses: fenio/setup-microk8s@v1
- name: Deploy and test
run: |
kubectl apply -f k8s/
kubectl wait --for=condition=available --timeout=60s deployment/my-app| Input | Description | Default |
|---|---|---|
version |
microk8s version/channel to install (e.g., 1.28, 1.29/stable, latest/edge) |
latest/stable |
addons |
Comma-separated list of addons to enable (e.g., dns,storage,ingress) |
dns,storage |
wait-for-ready |
Wait for cluster to be ready before completing | true |
timeout |
Timeout in seconds to wait for cluster readiness | 300 |
dns-readiness |
Wait for CoreDNS to be ready and verify DNS resolution works | true |
| Output | Description |
|---|---|
kubeconfig |
Path to the kubeconfig file (typically ~/.kube/config) |
- name: Setup microk8s
uses: fenio/setup-microk8s@v1- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
version: '1.28/stable'- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
addons: 'dns,storage,ingress,metallb'- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
addons: 'none'- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
version: 'latest/edge'- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
timeout: '300' # 5 minutesmicrok8s supports many addons out of the box:
dns- CoreDNS for cluster DNS resolutionstorage- Default hostpath storage provideringress- NGINX Ingress Controllerdashboard- Kubernetes Dashboardregistry- Private container registrymetrics-server- Kubernetes Metrics Serverprometheus- Prometheus monitoringistio- Istio service meshmetallb- MetalLB load balancercert-manager- Certificate management- And many more...
Run microk8s enable --help to see all available addons.
- Verifies the platform is Linux (microk8s requirement)
- Installs microk8s using snap with the specified channel
- Adds the current user to the microk8s group
- Waits for microk8s to be ready
- Enables specified addons
- Exports the kubeconfig to
~/.kube/config - Sets up kubectl alias for convenience
- Optionally waits for the cluster to become fully ready
No cleanup needed - GitHub Actions runners are ephemeral and destroyed after each workflow run, so there's no need to restore system state.
- Linux only - microk8s requires a Linux system
- Runs on
ubuntu-latestor other Linux runners - Requires
snapto be installed (pre-installed on Ubuntu) - Requires
sudoaccess for snap installation
microk8s only supports Linux. If you need Kubernetes on other platforms, consider:
- macOS: Use setup-minikube
- Windows: Use setup-minikube
If the cluster doesn't become ready in time, increase the timeout:
- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
timeout: '300' # 5 minutesIf you encounter issues with addons, you can disable them and enable manually:
- name: Setup microk8s
uses: fenio/setup-microk8s@v1
with:
addons: 'none'
- name: Enable addons manually
run: |
microk8s enable dns
microk8s enable storageThe action automatically adds the user to the microk8s group. If you still encounter permission issues:
- name: Fix permissions
run: |
sudo usermod -a -G microk8s $USER
sg microk8s -c 'microk8s status'This action is written in pure bash and requires no build step. Just edit setup.sh and test!
MIT License - see LICENSE file for details.
- microk8s - Lightweight Kubernetes by Canonical
- setup-k0s - Zero friction Kubernetes (k0s)
- setup-k3s - Lightweight Kubernetes (k3s)
- setup-kubesolo - Ultra-lightweight Kubernetes
- setup-minikube - Local Kubernetes (Minikube)
- setup-talos - Secure, immutable Kubernetes OS (Talos)