Build an Internal Developer Platform — Backstage, Golden Paths & Crossplane›02 · Lab: hub and workload clusters on kind

Lesson 02 of 11 · Foundations

Lab: hub and workload clusters on kind

Build the lab used for the rest of the track on one machine: a hub cluster running Gitea and Argo CD, two workload clusters registered in Argo CD with labels that describe them, and Backstage running locally against the hub.

Practitioner → Advanced
Key wordskindhub and spokemanagement clusterworkload clustersGiteaArgo CDcluster Secretcluster labelsBackstage locallab

What we build

                       your laptop (Docker)
┌─────────────── hub (kind) ────────────────┐   ┌──── wl-1 (kind) ────┐  ┌──── wl-2 (kind) ────┐
│ Gitea      :3300  (Git server, orgs/repos) │   │ ring 0, shared      │  │ ring 1, dedicated   │
│ Argo CD    :8080  (GitOps for the fleet)   │──►│ apps on :8881       │  │ apps on :8882       │
└────────────────────────────────────────────┘   └─────────────────────┘  └─────────────────────┘
Backstage :3000 / :7007 runs on the laptop (Node.js), talking to Gitea and the hub.

The hub plays the management cluster: it holds Git and Argo CD. The workload clusters stand in for production clusters in different rings, tiers or regions. About 8 GB of free memory is comfortable.

The hub is the head office: it keeps the plans (Git) and sends instructions (Argo CD). The workload clusters are branch offices that do the actual work. Each branch has a sign on the door saying what kind of branch it is, so head office knows what to send where.

Step 1: three kind clusters

Give each cluster a fixed API port and map a NodePort to the laptop:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: hub
networking:
  apiServerAddress: "127.0.0.1"
  apiServerPort: 6550
nodes:
- role: control-plane
  extraPortMappings:
  - { containerPort: 30300, hostPort: 3300, listenAddress: "127.0.0.1" }   # Gitea
  - { containerPort: 30808, hostPort: 8080, listenAddress: "127.0.0.1" }   # Argo CD

Create wl-1 (port 6551, map 30880 → 8881) and wl-2 (6552, 30880 → 8882) the same way, then kind create cluster --config <file> for each.

Step 2: Gitea in the hub

Install Gitea with its Helm chart, configured for a lab: SQLite, no HA database or cache, and the HTTP service as NodePort 30300. Check the chart's README for the value names of your chart version.

# gitea-values.yaml (lab only)
postgresql-ha: { enabled: false }
postgresql: { enabled: false }
valkey-cluster: { enabled: false }
valkey: { enabled: false }
gitea:
  admin: { username: gitea-admin, password: change-me-lab-only, email: admin@example.local }
  config:
    database: { DB_TYPE: sqlite3 }
    session: { PROVIDER: memory }
    cache: { ADAPTER: memory }
    queue: { TYPE: level }
service:
  http: { type: NodePort, nodePort: 30300 }
$ helm repo add gitea-charts https://dl.gitea.com/charts/
$ helm install gitea gitea-charts/gitea -n gitea --create-namespace -f gitea-values.yaml

Create an organisation golden (for services created by the golden path) and an access token for automation.

Step 3: Argo CD in the hub

$ kubectl create namespace argocd
$ kubectl apply -n argocd --server-side -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
$ kubectl -n argocd patch cm argocd-cmd-params-cm --type merge -p '{"data":{"server.insecure":"true"}}'
$ kubectl -n argocd patch svc argocd-server -p '{"spec":{"type":"NodePort","ports":[{"name":"http","port":80,"targetPort":8080,"nodePort":30808}]}}'
$ kubectl -n argocd rollout restart deploy argocd-server

server.insecure (no TLS) is for the lab only.

Step 4: register the workload clusters, with labels

Argo CD stores clusters as Secrets labelled argocd.argoproj.io/secret-type: cluster. Add your own labels describing each cluster: they drive placement and rollout order later.

apiVersion: v1
kind: Secret
metadata:
  name: cluster-wl-1
  namespace: argocd
  labels:
    argocd.argoproj.io/secret-type: cluster
    fleet.example.io/ring: "0"
    fleet.example.io/tenancy: shared
    fleet.example.io/compliance: standard
    fleet.example.io/region: eu-west
type: Opaque
stringData:
  name: wl-1
  server: https://wl-1-control-plane:6443
  config: |
    {"tlsClientConfig":{"caData":"<base64 CA>","certData":"<base64 client cert>","keyData":"<base64 client key>"}}

Take the CA, certificate and key from kind get kubeconfig --name wl-1 --internal. The server address must be the container name, because Argo CD runs inside the hub container: 127.0.0.1:6551 would point at the hub itself. Register wl-2 with ring: "1", tenancy: dedicated, compliance: regulated.

Lab credentials only

Admin client certificates in Secrets are fine for a laptop lab. In production, use a dedicated ServiceAccount per cluster with least privilege, or cloud IAM-based authentication (EKS/AKS/GKE integrations), and keep the hub itself locked down: it can change every cluster.

Step 5: Backstage on the laptop

$ npx @backstage/create-app@latest      # name it "backstage"
$ cd backstage
$ yarn --cwd packages/backend add @backstage/plugin-scaffolder-backend-module-gitea

Register the module in packages/backend/src/index.ts with backend.add(import('@backstage/plugin-scaffolder-backend-module-gitea'));, and tell Backstage about Gitea in app-config.local.yaml:

integrations:
  gitea:
    - host: localhost:3300
      username: gitea-admin
      password: ${GITEA_TOKEN}

Start it with yarn start (frontend on :3000, backend on :7007). The next lessons fill the catalog and add the template.

Try it

Build the lab, then run argocd cluster list and the cheat-sheet Secret command. Explain which label you would use to send something only to regulated clusters, and which to order a rollout.

Recap

  • A hub cluster holds Git (Gitea) and GitOps (Argo CD); workload clusters represent rings, tiers and regions.
  • Clusters are registered as labelled Secrets; labels make placement and rollout order data-driven.
  • Inside the hub, use container DNS for cluster addresses; Backstage runs locally with the Gitea integration.

This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.