1. Init Container
- 👶 Layman’s Definition: Like a setup crew that gets the room ready before the event starts.
- 💻 Technical Explanation: Runs before the main app to perform one-time setup tasks like pulling configs or checking dependencies
initContainers:
– name: init-secrets
image: vault-cli
command: [“sh”, “-c”, “vault pull /secrets > /app/secrets.json”]
2. Main (Application) Container
- 👶 Layman’s Definition: The star performer of the show — it’s what people actually came to see.
- 💻 Technical Explanation: Runs the core application (e.g., web server, API, backend service) that delivers the primary functionality.
containers:
– name: web-app
image: node:18
ports:
3. Sidecar Container
- 👶 Layman’s Definition: A helper working next to the main performer, like someone handling the lights or sound.
- 💻 Technical Explanation: Runs alongside the main container in the same Pod to provide support — for logging, monitoring, or proxies.
containers:
– name: web-app
image: node:18
– name: log-shipper
image: fluentd
volumeMounts:
– name: logs
mountPath: /var/log/app
4. Stateless Container
- 👶 Layman’s Definition: Like a vending machine — it doesn’t remember who used it.
- 💻 Technical Explanation: Doesn’t retain data between restarts; ideal for scalable services like APIs or frontends.
containers:
– name: react-ui
image: my-react-app:latest
ports:
5. Stateful Container
- 👶 Layman’s Definition: Like a bank account — it remembers your balance every time.
- 💻 Technical Explanation: Stores data using persistent storage; used for apps like databases or message queues that need to retain state.
containers:
– name: postgres-db
image: postgres:14
volumeMounts:
– name: db-storage
6. Job Container
- 👶 Layman’s Definition: Like a worker who comes in, does a single task, and leaves.
- 💻 Technical Explanation: Executes a specific task once (like data processing or cleanup) and exits when finished.
apiVersion: batch/v1
kind: Job
metadata:
name: migrate-data
spec:
template:
spec:
containers:
– name: migrator
image: data-migrator
command: [“python”, “migrate.py”]
restartPolicy: Never
7. CronJob Container
- 👶 Layman’s Definition: Like a scheduled alarm clock that rings at a set time to trigger a task.
- 💻 Technical Explanation: Runs on a fixed schedule (e.g., daily or weekly) to perform repeated tasks like backups or reports.
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-backup
spec:
schedule: “0 2 * * *”
jobTemplate:
spec:
template:
spec:
containers:
– name: backup
image: backup-tool
command: [“sh”, “-c”, “backup.sh”]
restartPolicy: OnFailure
Ephemeral Container
- 👶 Layman’s Definition: Like a repair technician temporarily called in to fix an issue.
- 💻 Technical Explanation: Used temporarily for debugging live Pods; not part of the original app deployment.
ephemeralContainers:
– name: debugger
image: busybox
command: [“sh”]
stdin: true
tty: true
9. Proxy Container
- 👶 Layman’s Definition: Like a receptionist who forwards visitors to the right person.
- 💻 Technical Explanation: Manages communication and routing between services; often handles security or load balancing (e.g., Envoy).
containers:
– name: envoy
image: envoyproxy/envoy:v1.25
ports:
– containerPort: 15001
Adapter/Bridge Container
- 👶 Layman’s Definition: Like a translator between two people speaking different languages.
- 💻 Technical Explanation: Converts data or formats to help incompatible services work together smoothly.
containers:
– name: adapter
image: data-adapter
command: [“python”, “convert.py”]
Security Container
- 👶 Layman’s Definition: Like a guard or vault manager who handles keys and access.
- 💻 Technical Explanation: Manages secrets, certificates, or authentication processes to keep your app secure.
containers:
– name: vault-agent
image: vault:latest
command: [“vault”, “agent”, “-config=/vault/config.hcl”]
Leave a Reply