Kubernetes Container Orchestration Cloud Native Patterns 4 — Questions and Answers
Question 1: The CQRS (Command Query Responsibility Segregation) pattern separates:
- Container startup commands from readiness queries
- Write operations (commands) from read operations (queries) into different models/services (Correct answer)
- Kubernetes API server write requests from read requests
- CI/CD pipeline build stages from deployment stages
Correct answer: Write operations (commands) from read operations (queries) into different models/services
CQRS uses separate models for updating data (commands) and reading data (queries), allowing each side to scale and optimize independently.
Question 2: In the Event Sourcing pattern, what is stored as the primary source of truth?
- The current state snapshot of each entity
- An immutable log of all state-changing events in order (Correct answer)
- Aggregated materialized views updated on each write
- ConfigMaps reflecting the desired state of each resource
Correct answer: An immutable log of all state-changing events in order
Event Sourcing stores every state change as an immutable event; the current state is derived by replaying the event log.
Question 3: Which cloud native pattern coordinates a distributed transaction across multiple microservices without using a two-phase commit?
- Circuit Breaker
- Saga (Correct answer)
- Outbox
- Bulkhead
Correct answer: Saga
The Saga pattern manages distributed transactions by chaining local transactions with compensating transactions on failure, avoiding distributed locks.
Question 4: The 'Transactional Outbox' pattern solves which specific problem in event-driven microservices?
- Ensuring exactly-once delivery of Kafka messages to consumers
- Atomically saving a database record and publishing an event without a distributed transaction (Correct answer)
- Preventing duplicate container restarts during rolling updates
- Synchronizing ConfigMap updates across all pod replicas
Correct answer: Atomically saving a database record and publishing an event without a distributed transaction
The Transactional Outbox pattern writes the event to an outbox table in the same DB transaction as the business record, then a separate process publishes it.
Question 5: In Kubernetes, the 'GitOps' pattern requires that the desired cluster state is:
- Defined imperatively via kubectl commands logged to an audit trail
- Stored declaratively in a Git repository and continuously reconciled by an operator (Correct answer)
- Managed by a CI/CD pipeline that applies changes on each commit
- Enforced by Admission Webhooks that reject non-compliant resources
Correct answer: Stored declaratively in a Git repository and continuously reconciled by an operator
GitOps uses a Git repo as the single source of truth for declarative infrastructure, with operators like Argo CD or Flux continuously reconciling the cluster state.
Question 6: What is the primary advantage of the 'Immutable Infrastructure' pattern when deploying containerized applications?
- Containers can be patched in-place without restarts, reducing downtime
- Servers and containers are never modified after deployment; updates replace them entirely (Correct answer)
- Kubernetes prevents all writes to container filesystems by default
- Pod specs cannot be changed after a Deployment is created
Correct answer: Servers and containers are never modified after deployment; updates replace them entirely
Immutable Infrastructure means any change produces a new artifact (container image) deployed as a replacement, eliminating configuration drift.
Question 7: The 'Service Mesh' pattern in Kubernetes offloads which cross-cutting concerns from application code?
- Database connection pooling and query caching
- mTLS, retries, circuit breaking, and observability at the network layer (Correct answer)
- Container image scanning and vulnerability patching
- Horizontal scaling decisions based on custom metrics
Correct answer: mTLS, retries, circuit breaking, and observability at the network layer
A service mesh like Istio or Linkerd handles mTLS encryption, traffic retries, circuit breaking, and distributed tracing transparently via sidecar proxies.
The CQRS (Command Query Responsibility Segregation) pattern separates: