For an applied example, see Showcase.
Kubernetes Structure
The diagram below represents a basic web application. An Ingress controls where traffic from the Internet is routed. Depending on the path, a Service is exposed, which selects Pods. The selection is made using Labels (represented as dotted lines.) Deployments control the Pods, which are wrappers for Containers. The Backend Pods communicate with the Database using the Database Service, which is discoverable from within the Backend Pods using DNS. The Database persists data using a Persistent Volume Claim (PVC).
flowchart LR
A[Web] -->|*.app.konst.fish| B(Ingress)
B -->|/api| C{{Backend Service}}
subgraph Backend
C-. app=backend .-> D[Backend Pod]
C-. app=backend .-> E[Backend Pod]
H(Backend Deployment) --> D
H --> E
end
B -->|/| F{{Frontend Service}}
subgraph Frontend
F-. app=frontend .-> G[Frontend Pod]
I(Frontend Deployment) --> G
end
subgraph Database
D --> J{{Database Service}}
E --> J
J -. app=db .-> K[Database Pod]
L(Database StatefulSet) --> K
K --> M[(Database PVC)]
end
Kubernetes Manifests
Deployment
Service
Ingress
Also see Ingress Nginx