Architecture

Cluster topology, secrets and authentication flows, and the lab security posture

Cluster Topology

┌────────────────────────────────────────────────────────────────────────────┐
│                              192.168.56.0/24                               │
│                                                                            │
│  ┌──────────────────┐                  ┌──────────────────────────────────┐│
│  │    Storage       │── NFS mount ────►│            ControlPlane          ││
│  │  192.168.56.20   │◄─ VSO sync ──────│            192.168.56.10         ││
│  │──────────────────│  (HTTPS :8200)   │──────────────────────────────────││
│  │  NFS Server      │◄─ DNS records ───│  kubeadm apiserver (OIDC auth)   ││
│  │  Vault :8200     │  (etcd :2379)    │  Calico · MetalLB · Istio · Kiali││
│  │  CoreDNS :53     │                  │  cert-manager · Keycloak · VSO   ││
│  │  etcd :2379      │                  │  ExternalDNS · KEDA · VPA        ││
│  │  (systemd,       │                  │  Prometheus · Grafana · Loki     ││
│  │   outside k8s)   │                  │  Tempo · Metrics Server          ││
│  └────────┬─────────┘                  └─────────────────┬────────────────┘│
│           │ NFS mount                              kubeadm join            │
│           │                              ┌─────────────────┴──────────────┐│
│           ├─────────────────────────────►│   Node01        │    Node02    ││
│           └─────────────────────────────►│   .56.11        │    .56.12    ││
│                                          │   Worker        │    Worker    ││
│                                          │   Ollama*       │              ││
│                                          └─────────────────┴──────────────┘│
└────────────────────────────────────────────────────────────────────────────┘
  * Ollama only when Karpor AI is enabled. The components listed under
    ControlPlane are installed from there, but their pods are scheduled
    across all nodes.

Vault and the lab DNS (CoreDNS + etcd) run on the storage node outside the Kubernetes cluster (systemd services), so secrets and DNS records survive cluster rebuilds.

VMIPRoleResources
storage192.168.56.20NFS, Vault, lab DNS2 GB / 1 CPU
controlplane192.168.56.10Control plane6 GB / 4 CPU
node01192.168.56.11Worker (+ Ollama when enabled)8 GB / 2 CPU
node02192.168.56.12Worker4 GB / 2 CPU

Networks

NetworkCIDRPurpose
Host-only192.168.56.0/24VM and host communication
Pod10.244.0.0/16Pod networking (Calico)
Service10.96.0.0/12Kubernetes services
MetalLB192.168.56.200-250LoadBalancer IPs (the Istio ingress gateway gets .200)
Lab domainlab.internal<name>.lab.internal, served by CoreDNS on the storage node

Provisioning Order

vagrant up provisions the storage node first, then the control plane, then the workers. The control plane runs kubeadm init and installs the workloads in dependency order:

MetalLB → Istio → cert-manager → Metrics Server → VPA → KEDA → NFS provisioner → Vault → Vault Secrets Operator → ExternalDNS → Prometheus/Grafana → Loki → Tempo → Kiali → Keycloak → Ollama → Karpor

Components set to none in config.yaml are skipped.

Secrets Flow

Vault is the single source of truth; the Vault Secrets Operator (VSO) bridges it into native Kubernetes Secrets:

Vault path (storage :8200, KV v2)        Vault Secrets Operator        K8s Secret (namespace/name)
secret/k8s-provisioner/…
  keycloak/admin            ──────────►  VaultStaticSecret  ───────►  keycloak/keycloak-admin
  keycloak/postgres         ──────────►  VaultStaticSecret  ───────►  keycloak/postgres-credentials
  grafana/admin             ──────────►  VaultStaticSecret  ───────►  monitoring/grafana-admin
  keycloak/clients/grafana  ──────────►  VaultStaticSecret  ───────►  monitoring/grafana-oidc

Each login lives at its own path with plain keys (username/password, or client_id/client_secret), and each Kubernetes Secret mirrors only its own path. See Vault.

Authentication Flow

kubectl logs in against Keycloak; the API server validates the token natively (no impersonation proxy), and group claims map to RBAC:

kubectl ──(1) oidc-login (PKCE, browser)──►  Keycloak  (realm: k8s)
   │                                            │  issuer https://keycloak.lab.internal/realms/k8s
   │ (2) id_token  (groups claim)               │
   ▼                                            ▼
kube-apiserver ──(3) validates via --authentication-config────────────────
   │   trusts the cert-manager lab CA; resolves keycloak.lab.internal via the lab DNS
   ▼
RBAC:  group oidc:k8s-admins → cluster-admin    ·    oidc:k8s-developers → view

Grafana reuses the same Keycloak realm for SSO. See Keycloak.

Component Stack

LayerComponents
ApplicationsYour workloads, examples
PlatformKeycloak, Vault Secrets Operator, Prometheus/Grafana, Loki, Tempo, Kiali, KEDA, VPA
Ingress and DNSIstio ingress gateway, cert-manager, ExternalDNS
Service meshIstio + Envoy sidecars
Load balancingMetalLB (Layer 2)
NetworkingCalico
Kubernetes1.37 (kubeadm)
Container runtimeCRI-O
OSDebian 13 “Trixie”
VirtualizationVirtualBox + Vagrant

Security Posture (lab) and Accepted Risks

This is a lab/learning cluster, not a production environment. The threat model assumes a trusted operator and a trusted local network; nothing is exposed to the internet. These are deliberate trade-offs for that context and would need hardening before handling real user data:

  • No TLS on the Keycloak↔Postgres connection and no encryption at rest for the Postgres data (it lives on a plaintext NFS export). Hardening path: an Istio PeerAuthentication scoped to the Postgres workload (mTLS) and an encrypted StorageClass.
  • Vault uses a self-managed lab CA. Vault serves HTTPS with a certificate from its own CA, generated on the storage node; the CA private key stays on that node and there is no automated rotation (the server certificate lasts 825 days). Hardening path: issue the Vault certificate from a managed PKI and rotate it.
  • Monitoring skips TLS verification in two places. Prometheus scrapes the kubelets and blackbox_exporter probes TLS endpoints without verifying the chain, because kubeadm issues each kubelet a self-signed serving certificate. Hardening path: serverTLSBootstrap: true in the kubelet config.
  • No database backups or retention policy, and the Keycloak app uses the owning Postgres account. Appropriate for ephemeral lab data; not for production.

Credentials are never hardcoded: they are randomly generated, stored in Vault, and synced to Kubernetes Secrets via VSO. API server audit logging is on and shipped to Loki (see Observability).