GitHub Actions
Automatiseer clusterprovisioning en configuratiesync met GitHub Actions.
Vereisten
- Een repository met je
cluster.lok8s.yaml - lok8s CLI beschikbaar in CI (geïnstalleerd via
b env add) - Repository-secrets geconfigureerd in GitHub
Vereiste secrets
Voeg deze toe in je repository-instellingen onder Settings > Secrets and variables > Actions:
| Secret | Beschrijving |
|---|---|
HCLOUD_TOKEN | Hetzner Cloud API-token |
SSH_PRIVATE_KEY | Privé-SSH-sleutel voor toegang tot nodes |
KUBECONFIG | Base64-gecodeerde kubeconfig (voor syncworkflows) |
Provision-workflow
Maak .github/workflows/provision.yml:
yaml
name: Provision Cluster
on:
workflow_dispatch:
inputs:
action:
description: 'Action to perform'
required: true
default: 'provision'
type: choice
options:
- provision
- destroy
jobs:
provision:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lok8s
run: b env add github.com/kernpilot/lok8s
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
- name: Provision
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
run: lo provisionSync-workflow
Maak .github/workflows/sync.yml om configuratiewijzigingen toe te passen bij een push:
yaml
name: Sync Cluster
on:
push:
branches: [main]
paths:
- 'cluster.lok8s.yaml'
- 'deploy/**'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lok8s
run: b env add github.com/kernpilot/lok8s
- name: Setup kubeconfig
run: |
mkdir -p ~/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
- name: Infrastructuur reconcilen
env:
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
run: lo provision
- name: Platform uitrollen
run: lo deploylo provision is idempotent — bij herhaald uitvoeren wordt het cluster gereconcilieerd naar je spec. lo deploy rolt de platform-/workloadmanifesten onder deploy/ uit.
Volgende stappen
- Registratie — registreren bij het kubehz-dashboard
- KubeOne — provisioner-details
- CAPI — Cluster API-provisioner
Documentstatus
| Aspect | Detail |
|---|---|
| Status | active |
| Laatst herzien | 2026-04-04 |