Cluster Bootstrap¶
This page documents how to bootstrap a fresh cluster from scratch.
The process is mostly automated via task bootstrap:kubernetes, with a small number
of deliberate manual gates for destructive or interactive operations.
Prerequisites¶
Cloudflare setup (one-time, before first bootstrap)¶
1. Create a Cloudflare API token¶
Go to Cloudflare API Tokens and create a token using the Edit zone DNS template:
- Name:
kubernetes - Permissions:
- Zone → DNS → Edit
- Account → Cloudflare Tunnel → Read
- Scope: limit to your account and zone
2. Create the Cloudflare Tunnel¶
cloudflared tunnel login
cloudflared tunnel create --credentials-file cloudflare-tunnel.json kubernetes
The credentials file contains AccountTag, TunnelID, and TunnelSecret.
3. Build the cloudflared ingress config¶
Create a config.yaml for cloudflared that routes tunnel traffic to the internal gateway.
See cluster/apps/system/cloudflared/values.yaml for the expected structure — the file is
stored verbatim as the CLOUDFLARE_TUNNEL_INGRESS secret.
4. Create Bitwarden Secrets Manager entries¶
Create each secret in BWS and note its UUID. Then update the UUID in the referenced file.
| Secret name | Value | Referenced in (UUID) |
|---|---|---|
cloudflare-email |
Cloudflare account email | bitwarden_secrets.tf (22151db9-…) |
cloudflare-apikey |
API token from step 1 | bitwarden_secrets.tf (b89913d7-…) |
cloudflare-domain |
Domain name (e.g. example.com) |
bitwarden_secrets.tf (3080c3a1-…) |
cloudflare-tunnel-id |
TunnelID from credentials JSON |
bitwarden_secrets.tf, cluster-secrets-externalsecret.yaml, cloudflared/externalsecret.yaml (50908d50-…) |
cloudflare-account-tag |
AccountTag from credentials JSON |
cloudflared/externalsecret.yaml (46669c66-…) |
cloudflare-tunnel-secret |
TunnelSecret from credentials JSON |
cloudflared/externalsecret.yaml (95af22e2-…) |
cloudflare-tunnel-ingress |
Full config.yaml content from step 3 |
cloudflared/externalsecret.yaml (8f4d213f-…) |
After creating each secret in BWS, replace the placeholder UUID in the referenced file with the UUID BWS assigned.
5. Run Terraform¶
This configures DNS records, WAF rules, and WARP private network routes.
Before running bootstrap:
- Talos machine configs generated:
task talos:init(runstask talos:generateviatalosctl+envsubst) .envrcsourced viadirenv— the following env vars must be set:BWS_TOKEN— Bitwarden Secrets Manager machine account tokenKUBECONFIG— path to the kubeconfig fileTALOSCONFIG— path toprovision/talos/clusterconfig/talosconfigBWS_PROJECT_ID— optional; the Bitwarden project that.envrcloads secrets from. Unset or empty keeps the project the file used before, so the local devcontainer is unchanged. A workspace of another type sets it to read its own project.- All secrets stored in Bitwarden Secrets Manager with their UUIDs referenced in
cluster/apps/core/argocd/resources/cluster-secrets-externalsecret.yaml - Configuration committed and pushed to the
mainbranch (ArgoCD reads from git) - AdGuard Home has a manual DNS rewrite:
k8s.<private-domain> → 192.168.48.1(the cluster VIP). This is required before phase 3 (apps) wherekubectlfirst connects tohttps://k8s.<private-domain>:6443. External-dns will take over maintaining this entry once deployed, but it does not exist yet during bootstrap.
Bootstrap sequence¶
1. Apply Talos config to nodes (manual)¶
talosctl apply-config --nodes 192.168.48.2 --insecure -f provision/talos/clusterconfig/home-mc1.yaml
talosctl apply-config --nodes 192.168.48.3 --insecure -f provision/talos/clusterconfig/home-mc2.yaml
talosctl apply-config --nodes 192.168.48.4 --insecure -f provision/talos/clusterconfig/home-mc3.yaml
Use --insecure on first boot before the cluster PKI is established.
On subsequent re-applies (e.g. config changes), omit --insecure.
2. Run the automated bootstrap¶
This single command runs the following phases in sequence:
| Phase | Task | What happens |
|---|---|---|
| 1 | etcd |
Bootstraps the etcd leader; retries until the first control-plane node accepts the bootstrap call |
| 2 | kubeconfig |
Fetches kubeconfig from Talos into $KUBECONFIG |
| 3 | apps |
Runs helmfile (provision/talos/apps/helmfile.yaml) to install Cilium, CoreDNS and kubelet-csr-approver with the values of their ArgoCD apps; waits for all nodes Ready |
| 4 | eso-bootstrap |
Creates the external-secrets namespace and injects bitwarden-access-token K8s Secret from $BWS_TOKEN |
| 5 | rook |
Wipes Rook data directories (/var/lib/rook) and raw disk partition tables on every node |
| 6 | argocd |
Creates an empty cluster-secrets placeholder Secret, applies the ArgoCD kustomize, applies the root bootstrap-application.yaml, and waits for argocd-server Available |
Bootstrap helmfile¶
Talos installs neither a CNI nor CoreDNS (KubeFlannelCNIConfig removed, KubeCoreDNSConfig disabled), and ArgoCD
needs both: pod networking, and cluster DNS to reach GitHub. So task bootstrap installs Cilium, CoreDNS and
kubelet-csr-approver with helmfile first, and ArgoCD adopts them later.
- The releases use the same chart and values as the ArgoCD apps (
cluster/apps/core/cilium,cluster/apps/system/coredns,cluster/apps/system/kubelet-csr-approver). Those apps are wrapper charts that nest the values under the dependency name, soprovision/talos/apps/app-values.yaml.gotmplreads each app'svalues.yamland passes the inner map. A file passed as is would be silently ignored by the upstream chart. - The task sets
CLUSTER_DIRfor the template. task lint:bootstrap(also run by the Manifest lint workflow) renders the helmfile and checks that the settings the cluster cannot start without arrive (Cilium kube-proxy replacement, IPAM, KubePrism address; the CoreDNS service IP; the approver's settings) and that each release's chart version equals its app'sChart.yaml. Renovate updates the two in separate PRs; merge them together.
Until 2026-11-30 the helmfile could not run: CLUSTER_DIR was never exported, the paths missed apps/, the values
were passed wrapped, and the CoreDNS release was gone while kubelet-csr-approver still needed it. No bootstrap had
run since those changes.
Hubble TLS after bootstrap¶
The cilium app issues Hubble's certificates with cert-manager, which is not there when the helmfile runs, so the
helmfile overrides hubble.tls.auto.method to cronJob and certgen issues them first. When ArgoCD takes over:
- If the
ciliumapp's first auto-sync failed because the cert-manager CRDs (Certificate,Issuer) did not exist yet, sync it by hand once thecert-managerapp is Healthy: ArgoCD does not retry an auto-sync of the same revision after its five retries. - Check
kubectl -n kube-system get certificate:hubble-ca,hubble-server-certsandhubble-relay-client-certsReady. - Delete the bootstrap
certgenobjects. The app no longer renders them and does not prune, and a leftover CronJob would overwrite cert-manager's Secrets every four months. The CronJob and its Jobs share the labelk8s-app=hubble-generate-certs; the RBAC objects only the name (list withgetbefore deleting):
kubectl -n kube-system delete cronjob,job -l k8s-app=hubble-generate-certs
kubectl -n kube-system delete serviceaccount,role,rolebinding hubble-generate-certs
kubectl -n kube-system delete secret cilium-ca
3. Check Rook Ceph storage¶
Rook Ceph auto-syncs like every other app, with prune off, so there is no manual gate: as soon as
ArgoCD discovers the appsets it deploys the operator and the cluster, and the CephCluster formats
the disks wiped in the rook phase. Any disk Rook is allowed to use can be claimed without a
further step.
If rook-ceph-cluster fails because the operator's CRDs were not there yet, ArgoCD does not retry
an auto-sync of the same revision. Sync it by hand:
rook-sync syncs the operator first, waits for its deployment to be Available, then syncs the
cluster.
4. Log in to ArgoCD (local admin)¶
On first bootstrap OIDC is unavailable because Keycloak has not deployed yet.
A local mmalyska account is configured with admin rights as a fallback:
Once Keycloak is deployed and its realm/client are configured, re-run task argocd:login
to switch to SSO login.
Chicken-and-egg problems and how they are resolved¶
Cilium before pods¶
Cilium is deployed as a DaemonSet before pod networking exists. Cilium pods start via
kubelet directly, configure the CNI plugin on each node's filesystem, and only then
does general pod networking become available. The apps phase waits for all nodes Ready
before proceeding.
Bitwarden secrets before External Secrets Operator¶
ESO is an ArgoCD-managed system app and cannot run until ArgoCD is deployed. But ArgoCD's
repo-server CMP sidecar mounts the cluster-secrets K8s Secret as a required volume —
it won't start without it. This is resolved in two steps:
eso-bootstrapinjects thebitwarden-access-tokenintoexternal-secretsnamespace so that ESO can authenticate with Bitwarden the moment it starts.argocdpre-creates an emptycluster-secretsK8s Secret so the repo-server sidecar can mount it and start. Once ESO deploys (sync-wave-5, first among system apps) and processes thecluster-secretsExternalSecret, the K8s Secret is populated with real values and Kubernetes automatically updates the running volume mount — no restart needed.
Keycloak OIDC¶
ArgoCD is configured to use Keycloak for OIDC, but Keycloak itself is deployed by ArgoCD as
a system app. On first bootstrap, ArgoCD starts with OIDC failing (Keycloak not reachable).
The local mmalyska admin account works as a fallback until Keycloak is ready.
k8s endpoint DNS before external-dns¶
kubectl connects to https://k8s.<private-domain>:6443 (the cluster VIP at 192.168.48.1)
starting at phase 3. The DNSEndpoint that registers this name in AdGuard lives in the
adguard-dns app, which is deployed by ArgoCD — which itself isn't running yet.
This is resolved by adding a manual static rewrite in AdGuard Home
(k8s.<private-domain> → 192.168.48.1) before bootstrap. Once external-dns deploys and
reconciles the DNSEndpoint, it takes ownership of the entry and the manual rewrite becomes
redundant.
Rook Ceph disk initialization¶
Rook Ceph requires completely clean disks (no partition table, no filesystem metadata). The
rook phase runs wipe Jobs on every node before ArgoCD deploys the Rook operator, ensuring
disks are ready when the CephCluster resource is first reconciled.
Post-bootstrap checklist¶
-
kubectl get nodes— all 3 nodesReady -
task argocd:login— ArgoCD accessible with local admin - Rook Ceph operator + cluster synced (
task bootstrap:rook-syncif the auto-sync failed) - Hubble certificates Ready from cert-manager and bootstrap
certgenobjects deleted ("Hubble TLS after bootstrap") -
kubectl -n rook-ceph get cephcluster— CephCluster statusHEALTH_OK - Keycloak deployed and realm/client configured
-
task argocd:login— SSO login works - All ArgoCD apps
Synced/Healthy
Re-bootstrapping an existing cluster¶
If wiping and re-bootstrapping a cluster that previously had data:
- Ensure Talos nodes are re-imaged or reset:
talosctl reset --nodes <ip> --graceful=false - Re-apply Talos configs (step 1 above)
- Run
task bootstrap:kubernetes— all phases are idempotent except the rook wipe (which is intentionally destructive; it will wipe whatever is on the disks)
_[VIP]: Virtual IP (Used for high-availability controlplanes)
_[HA]: High Availability (often reduntant hardware/software)
_[PVC]: k8s resource - Persistent Volume Claim
_[PV]: k8s resource - Persistent Volume
_[CNI]: k8s networking - Container Network Interface
_[k8s]: Shortening of Kurbenetes
_[CRD]: Custom Resource Definitions
_[S3]: Simple Storage Service
_[NFS]: Network File System
_[DR]: Disaster Recovery