/
Ambitwin · source-available, not open source · © 2026 Nicolò Ghignatti
| Word | Meaning | Example |
|---|---|---|
| Pod | One running copy of a service | telemetry-5d8... |
| Deployment | Keeps stateless pods running | k8s/deployments/chat.yml |
| StatefulSet | Same, for pods with their own disk | twin-db-0 |
| PVC | A disk claimed by a pod | twin-data-twin-db-0 |
| Init container | Runs first, must finish before the service starts | wait-for-db |
| k3d | Kubernetes in Docker, for local use | just k8s create |
How the cluster is built. Commands and setup: Kubernetes & Istio.
k8s/k8s/
├── namespace.yml # ambitwin, enrolled in ambient mode
├── istio-gateway.yml # the gateway and one route per service
├── istio-peer-authentication.yml # STRICT mTLS
├── istio-request-authentication.yml # JWT check at the edge
├── istio-agent-authz.yml # who may call agent
├── configmaps/common.yml # shared settings that are not secret
├── deployments/ # 12 stateless services
├── stateful/ # 8 databases, Redis, Kafka
└── monitoring/ # Prometheus, Grafana| Kind | What | If a pod dies |
|---|---|---|
| Deployment | The 12 services | A new one starts anywhere |
| StatefulSet | 4 MongoDB, 4 PostgreSQL, Redis, Kafka | Same name, same disk |
flowchart LR
S["Headless Service: twin-db"] --> P["Pod: twin-db-0"]
P --> V["PVC: twin-data-twin-db-0"]A service must not start before its database. Each pod waits in an init container:
initContainers:
- name: wait-for-db
image: busybox:1.38.0
command: [sh, -c, "until nc -z twin-db 27017; do sleep 2; done"]provisioner also waits for registry and tenancy.claims-gateway waits for tenancy.k8s/configmaps/common.yml.just k8s secrets reads .env and pipes them into kubectl apply. No file is written.claims-gateway-key, a mounted PEM file.A Kubernetes secret is base64, not encryption. RBAC is the real guard. For production, prefer an external manager.
allowPrivilegeEscalation: falseemptyDir at /tmp where neededkubectl rollout restart deployment/digital-twin -n ambitwin
kubectl rollout status deployment/digital-twin -n ambitwin
kubectl rollout undo deployment/digital-twin -n ambitwinThe old pod serves until the new one is ready.
Application images use IfNotPresent, so just k8s load works on k3d without a registry. For a real cluster see Trust & Service Mesh.
PodDisruptionBudget. Losing a pod is an outage.:latest tags mean a rollout may not pick up new code.# why is the pod not ready? read Events at the bottom
kubectl describe pod <pod> -n ambitwin
# logs: current, previous crash, init container
kubectl logs deployment/digital-twin -n ambitwin
kubectl logs <pod> -n ambitwin --previous
kubectl logs <pod> -n ambitwin -c wait-for-db
# shell inside
kubectl exec -it <pod> -n ambitwin -- sh
# recent events
kubectl get events -n ambitwin --sort-by=.lastTimestamp
# which image is really running
kubectl get pod <pod> -n ambitwin -o jsonpath='{.spec.containers[0].image}'k3d refuses connections after a restart? Find the port mapped to 6443:
docker ps --filter name=k3d-ambitwin-serverlb
kubectl config set-cluster k3d-ambitwin --server=https://127.0.0.1:<PORT>