Courseiva
Application Design and BuildmediumMultiple ChoiceObjective-mapped

CKAD Application Design and Build Practice Question

You have a pod with two containers: one runs a web server, and the other is a sidecar that logs the web server's output to a central logging system. Which pattern does this represent?

⚠ Common exam trap

In the CKAD exam, the sidecar pattern is often tested by describing a helper container that performs a supporting function (like logging, monitoring, or proxying), and the trap is confusing it with the ambassador pattern, which specifically handles network proxying or service discovery, not log forwarding.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Sidecar pattern

The sidecar pattern involves deploying a helper container alongside the main application container within the same pod. In this scenario, the sidecar container consumes the web server's logs (e.g., by tailing a shared volume or reading stdout/stderr) and forwards them to a central logging system, such as Elasticsearch or Fluentd. This pattern is a core Kubernetes design principle for extending or enhancing the main container without modifying its code.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Sidecar pattern

    Why this is correct

    The sidecar pattern adds a helper container to the same pod as the main application container. The helper extends or enhances the main container's behavior, such as by collecting logs, forwarding metrics, or managing file synchronization. Both containers share the pod lifecycle, so they start and stop together, and can communicate via localhost or a shared volume. This matches a web server paired with a logging agent or similar enhancement.

  • Decorator pattern

    Why it's wrong here

    The decorator pattern is a classic object-oriented design pattern that dynamically attaches responsibilities to objects, but it is not one of the recognized multi-container pod patterns in Kubernetes. Kubernetes defines three standard sidecar-like patterns: sidecar, ambassador, and adapter. Using 'decorator' would be inaccurate because it refers to class-level composition, not container-level process composition, and it has no specific deployment meaning in a pod spec.

  • Ambassador pattern

    Why it's wrong here

    The ambassador pattern uses a proxy container to represent remote services locally, handling network connectivity, authentication, or failover. The ambassador container sits between the main container and the outside world, so the main container always connects to localhost while the ambassador forwards traffic. In a web server pair, unless the second container is specifically proxying or abstracting external connections, calling it an ambassador would be a mischaracterization.

  • Adapter pattern

    Why it's wrong here

    The adapter pattern normalizes the main container's output to a standardized interface, often by transforming log formats or metrics so that external systems can consume them consistently. It does not enhance functionality but rather reconciles differences between the main container and the outside world. If the second container merely adds capabilities like TLS termination or request logging without converting output formats, it is a sidecar, not an adapter.

About these practice questions

Courseiva writes every CKAD question from scratch — 160 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKAD practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKAD exam.