Lab DNS and TLS
CoreDNS + etcd on the storage node, ExternalDNS, and one TLS certificate per Gateway
k8s-provisioner installs a complete stack of Kubernetes components. Most manifests are generated in Go from config.yaml and applied with kubectl; a few upstream charts (VPA, KEDA, NFS provisioner, Vault Secrets Operator, Karpor) are installed with Helm at the versions pinned in config.yaml.
| Area | Components | Page |
|---|---|---|
| Lab DNS and TLS | CoreDNS + etcd (storage node), ExternalDNS, cert-manager | Lab DNS |
| Secrets | HashiCorp Vault, Vault Secrets Operator | Vault |
| Identity | Keycloak (OIDC for kubectl, Grafana SSO) | Keycloak |
| Observability | Prometheus, Alertmanager, Grafana, Loki, Alloy, Tempo, OpenTelemetry, Kiali | Observability |
| Networking | Calico, MetalLB, Istio | below |
| Autoscaling | Metrics Server, HPA, VPA, KEDA | below |
| Storage | NFS server, NFS dynamic provisioner | below |
| Explorer and AI | Karpor, Ollama (optional) | below |
192.168.56.200-250) in Layer 2 modeIstio is installed with the default profile:
| Profile | Ingress Gateway | Egress Gateway | Recommended for |
|---|---|---|---|
minimal | ❌ | ❌ | Istiod only, gateways managed separately |
default | ✅ | ❌ | Production: balanced resources and security |
demo | ✅ | ✅ | Learning and demos |
ambient | ✅ | ❌ | Production without sidecars |
demo enables verbose telemetry, sets no resource limits and relaxes security, so it is not used here. To control outbound traffic, enable the egress gateway explicitly:
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
profile: default
components:
egressGateways:
- name: istio-egressgateway
enabled: true
Every web UI has its own Gateway and its own certificate: see Lab DNS for why a shared certificate breaks routing.
Metrics Server provides resource metrics:
kubectl top nodes
kubectl top pods -A
Three complementary autoscalers are included:
| Autoscaler | What it scales | Trigger | Config |
|---|---|---|---|
| HPA | Replicas (horizontal) | CPU, memory, custom metrics | Native Kubernetes |
| VPA | CPU/memory requests per pod | Historical usage | components.vpa: "enabled" |
| KEDA | Replicas, down to zero | Prometheus, queues, cron, … | components.keda: "enabled" |
kubectl autoscale deployment my-app --cpu-percent=50 --min=1 --max=10
kubectl get hpa
Adjusts CPU and memory requests from observed usage.
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: my-app-vpa
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
updatePolicy:
updateMode: "Auto" # Off, Initial, Recreate, Auto
resourcePolicy:
containerPolicies:
- containerName: my-app
minAllowed: {cpu: 50m, memory: 64Mi}
maxAllowed: {cpu: 2, memory: 2Gi}
| Mode | Behaviour |
|---|---|
Off | Only shows recommendations (kubectl describe vpa) |
Initial | Sets requests at pod creation only |
Recreate | Evicts pods to apply new requests |
Auto | Same as Recreate |
VPA and HPA should not target the same metric (e.g. both on CPU). Use VPA for right-sizing, HPA for replicas.
Scales on external sources, including Prometheus, and can scale to zero.
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: my-app-scaler
spec:
scaleTargetRef:
name: my-app
minReplicaCount: 0
maxReplicaCount: 10
triggers:
- type: prometheus
metadata:
serverAddress: http://prometheus.monitoring.svc:9090
threshold: "100"
query: sum(rate(http_requests_total{app="my-app"}[2m]))
Scale on a schedule:
triggers:
- type: cron
metadata:
timezone: America/Sao_Paulo
start: "0 8 * * 1-5"
end: "0 18 * * 1-5"
desiredReplicas: "3"
kubectl get scaledobject
kubectl describe scaledobject my-app-scaler
/exports/k8s-volumes)| StorageClass | Provisioning | Use case |
|---|---|---|
nfs-dynamic | Automatic (default) | PVCs create their PVs |
nfs-static | Manual | Pre-created PVs with specific paths |
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-data
spec:
storageClassName: nfs-dynamic
accessModes: [ReadWriteMany]
resources:
requests:
storage: 1Gi
apiVersion: v1
kind: PersistentVolume
metadata:
name: my-pv
spec:
storageClassName: nfs-static
capacity:
storage: 5Gi
accessModes: [ReadWriteMany]
nfs:
server: 192.168.56.20
path: /exports/k8s-volumes/my-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
storageClassName: nfs-static
accessModes: [ReadWriteMany]
resources:
requests:
storage: 5Gi
NFS is fine for a lab, but it has no redundancy: if the storage node is down, Loki, Tempo and Keycloak’s database stop too.
Karpor is a Kubernetes explorer with search and AI-powered analysis. It is disabled by default because it needs ~1.5 CPU and ~2 GB RAM. To enable it:
components:
karpor: "enabled"
karpor_ai:
enabled: true # also installs Ollama
Open https://karpor.lab.internal.
kind:Deployment # All deployments
namespace:monitoring kind:Pod # Pods in the monitoring namespace
label:app=nginx # Resources with label app=nginx
name:*api* # Resources with "api" in the name
kubectl get pods -n karpor
kubectl logs -n karpor -l app.kubernetes.io/component=karpor-server
Ollama serves the LLM behind Karpor’s AI features. It is installed only when karpor_ai.enabled: true with the ollama backend.
Run inside the cluster on node01:
| Model | RAM | Quality | Speed |
|---|---|---|---|
llama3.2:1b | ~2 GB | Basic | Very fast |
llama3.2:3b | ~4 GB | Good (default) | Fast |
qwen2.5-coder:7b | ~8 GB | Excellent for code | Moderate |
llama3.1:8b | ~10 GB | Excellent | Slower |
karpor_ai.model to a cloud model and provide the key with OLLAMA_API_KEY (or store it in Vault: vault kv patch secret/k8s-provisioner/api-keys ollama_api_key="...")| Model | Description |
|---|---|
minimax-m2.5:cloud | Top performer |
qwen3-coder:480b-cloud | Excellent for code analysis |
glm-4.7:cloud | Good general purpose |
kubectl get pods -n ollama
kubectl exec -n ollama deployment/ollama -- ollama list
# Pull another model and restart Karpor
kubectl exec -n ollama deployment/ollama -- ollama pull llama3.1:8b
kubectl rollout restart deployment/karpor-server -n karpor
CoreDNS + etcd on the storage node, ExternalDNS, and one TLS certificate per Gateway
Secrets on the storage node, synced into Kubernetes by the Vault Secrets Operator
OIDC authentication for kubectl and Single Sign-On for Grafana
Metrics, logs and traces, the k8s-lab dashboard, DNS SLOs and service mesh visibility