Components

Deep dive into the components included in k8s-provisioner

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.

AreaComponentsPage
Lab DNS and TLSCoreDNS + etcd (storage node), ExternalDNS, cert-managerLab DNS
SecretsHashiCorp Vault, Vault Secrets OperatorVault
IdentityKeycloak (OIDC for kubectl, Grafana SSO)Keycloak
ObservabilityPrometheus, Alertmanager, Grafana, Loki, Alloy, Tempo, OpenTelemetry, KialiObservability
NetworkingCalico, MetalLB, Istiobelow
AutoscalingMetrics Server, HPA, VPA, KEDAbelow
StorageNFS server, NFS dynamic provisionerbelow
Explorer and AIKarpor, Ollama (optional)below

Networking

  • Calico: CNI for pod networking and network policies
  • MetalLB: LoadBalancer IPs (192.168.56.200-250) in Layer 2 mode
  • Istio: service mesh; its ingress gateway serves every lab URL over HTTPS

Istio installation profile

Istio is installed with the default profile:

ProfileIngress GatewayEgress GatewayRecommended 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.


Autoscaling

Metrics Server provides resource metrics:

kubectl top nodes
kubectl top pods -A

Three complementary autoscalers are included:

AutoscalerWhat it scalesTriggerConfig
HPAReplicas (horizontal)CPU, memory, custom metricsNative Kubernetes
VPACPU/memory requests per podHistorical usagecomponents.vpa: "enabled"
KEDAReplicas, down to zeroPrometheus, queues, cron, …components.keda: "enabled"

HPA (Horizontal Pod Autoscaler)

kubectl autoscale deployment my-app --cpu-percent=50 --min=1 --max=10
kubectl get hpa

VPA (Vertical Pod Autoscaler)

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}
ModeBehaviour
OffOnly shows recommendations (kubectl describe vpa)
InitialSets requests at pod creation only
RecreateEvicts pods to apply new requests
AutoSame as Recreate

VPA and HPA should not target the same metric (e.g. both on CPU). Use VPA for right-sizing, HPA for replicas.

KEDA (Kubernetes Event-Driven Autoscaler)

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

Storage

  • NFS server on the storage VM (/exports/k8s-volumes)
  • NFS dynamic provisioner with two StorageClasses:
StorageClassProvisioningUse case
nfs-dynamicAutomatic (default)PVCs create their PVs
nfs-staticManualPre-created PVs with specific paths

Dynamic storage

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-data
spec:
  storageClassName: nfs-dynamic
  accessModes: [ReadWriteMany]
  resources:
    requests:
      storage: 1Gi

Static storage

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.


Kubernetes Explorer (Karpor)

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

AI Backend (Ollama)

Ollama serves the LLM behind Karpor’s AI features. It is installed only when karpor_ai.enabled: true with the ollama backend.

Local models (default)

Run inside the cluster on node01:

ModelRAMQualitySpeed
llama3.2:1b~2 GBBasicVery fast
llama3.2:3b~4 GBGood (default)Fast
qwen2.5-coder:7b~8 GBExcellent for codeModerate
llama3.1:8b~10 GBExcellentSlower

Cloud models (optional)

  1. Create an account at https://ollama.com/signup
  2. Generate an API key at https://ollama.com/settings/keys
  3. Set 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="...")
ModelDescription
minimax-m2.5:cloudTop performer
qwen3-coder:480b-cloudExcellent for code analysis
glm-4.7:cloudGood general purpose

Check and switch models

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

Lab DNS and TLS

CoreDNS + etcd on the storage node, ExternalDNS, and one TLS certificate per Gateway

HashiCorp Vault

Secrets on the storage node, synced into Kubernetes by the Vault Secrets Operator

Keycloak (Identity Provider / SSO)

OIDC authentication for kubectl and Single Sign-On for Grafana

Observability

Metrics, logs and traces, the k8s-lab dashboard, DNS SLOs and service mesh visibility