Skip to content

Instantly share code, notes, and snippets.

@sergsoares
Created March 7, 2026 20:20
Show Gist options
  • Select an option

  • Save sergsoares/c1a3ca8ba8c4924e912a6a54e3bf18c1 to your computer and use it in GitHub Desktop.

Select an option

Save sergsoares/c1a3ca8ba8c4924e912a6a54e3bf18c1 to your computer and use it in GitHub Desktop.
Ralphex Plan file output

Deploy snotes to k0scluster via Flux

Overview

Build the apps/snotes project as a container image tagged docker.io/localhost/snotes:latest, import it directly into k0s containerd (no SSH needed — same machine), and create Flux-managed Kubernetes manifests in clusters/thelab/snotes/ following the clusters/thelab/apps/ pattern. Git sync is explicitly disabled via env var. imagePullPolicy is Never so k0s uses the locally imported image.

Context

  • Files involved:
    • apps/snotes/Makefile — add new local-only build/import targets
    • apps/snotes/Dockerfile — existing, no changes needed
    • clusters/thelab/snotes/namespace.yaml — new
    • clusters/thelab/snotes/snotes-deployment.yaml — new
    • clusters/thelab/snotes/kustomization.yaml — new
  • Related patterns: clusters/thelab/apps/ (namespace + deployment + kustomization structure)
  • Dependencies: podman (build tool), k0s installed locally on same machine

Development Approach

  • Infrastructure/manifest work — no application code changes, no test suite requirement
  • Complete each task fully before moving to the next

Implementation Steps

Task 1: Install podman build tool

Files:

  • No file changes (system install)

  • Check if podman is installed: podman --version

  • If missing, install: apt-get install -y podman

  • Verify: podman version

Task 2: Add local-only build/import targets to apps/snotes/Makefile

Files:

  • Modify: apps/snotes/Makefile

  • Add build-snotes target: podman build --platform linux/amd64 -t docker.io/localhost/snotes:latest .

  • Add import-snotes target: podman save docker.io/localhost/snotes:latest | k0s ctr -n k8s.io images import -

  • Add publish-snotes target combining both: depends on build-snotes import-snotes

Task 3: Build and import the image

Files:

  • No file changes (runtime step)

  • Run make publish-snotes from apps/snotes/

  • Verify image is available in k0s containerd: k0s ctr -n k8s.io images ls | grep snotes

  • Confirm docker.io/localhost/snotes:latest tag is present

Task 4: Create snotes Kubernetes manifests

Files:

  • Create: clusters/thelab/snotes/namespace.yaml

  • Create: clusters/thelab/snotes/snotes-deployment.yaml

  • Create: clusters/thelab/snotes/kustomization.yaml

  • Create namespace.yaml with namespace snotes (matching apps/namespace.yaml pattern)

  • Create snotes-deployment.yaml with:

    • Deployment in namespace snotes
    • image: docker.io/localhost/snotes:latest
    • imagePullPolicy: Never
    • containerPort: 7000
    • env: GIT_SYNC_ENABLED=false
    • env: FLATNOTES_AUTH_TYPE=none (flatnotes app env var name, value none for no auth)
    • resources: requests/limits (matching nginx pattern)
    • ClusterIP Service on port 7000
  • Create kustomization.yaml with namespace snotes, referencing both yaml files

  • Check if clusters/thelab/kustomization.yaml exists; if so, add snotes to its resources list

  • Git add, commit, and push the new manifests to trigger Flux reconciliation

Task 5: Verify acceptance criteria

  • Verify Flux reconciles without errors: k0s kubectl get kustomization -n flux-system
  • Verify snotes namespace exists: k0s kubectl get ns snotes
  • Verify pod is running: k0s kubectl get pods -n snotes
  • Verify GIT_SYNC_ENABLED=false in running pod: k0s kubectl exec -n snotes <pod> -- env | grep GIT_SYNC

Task 6: Update documentation

  • Move this plan to docs/plans/completed/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment