Architecture
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.
| VM | IP | Role | Resources |
|---|---|---|---|
| storage | 192.168.56.20 | NFS, Vault, lab DNS | 2 GB / 1 CPU |
| controlplane | 192.168.56.10 | Control plane | 6 GB / 4 CPU |
| node01 | 192.168.56.11 | Worker (+ Ollama when enabled) | 8 GB / 2 CPU |
| node02 | 192.168.56.12 | Worker | 4 GB / 2 CPU |
Networks
| Network | CIDR | Purpose |
|---|---|---|
| Host-only | 192.168.56.0/24 | VM and host communication |
| Pod | 10.244.0.0/16 | Pod networking (Calico) |
| Service | 10.96.0.0/12 | Kubernetes services |
| MetalLB | 192.168.56.200-250 | LoadBalancer IPs (the Istio ingress gateway gets .200) |
| Lab domain | lab.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
| Layer | Components |
|---|---|
| Applications | Your workloads, examples |
| Platform | Keycloak, Vault Secrets Operator, Prometheus/Grafana, Loki, Tempo, Kiali, KEDA, VPA |
| Ingress and DNS | Istio ingress gateway, cert-manager, ExternalDNS |
| Service mesh | Istio + Envoy sidecars |
| Load balancing | MetalLB (Layer 2) |
| Networking | Calico |
| Kubernetes | 1.37 (kubeadm) |
| Container runtime | CRI-O |
| OS | Debian 13 “Trixie” |
| Virtualization | VirtualBox + 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
PeerAuthenticationscoped 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: truein 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).