From Docker Compose to Kubernetes: A Complete Practical Guide Quiz

A comprehensive quiz exploring the migration journey from Docker Compose setups to production-ready Kubernetes deployments in real-world application environments.

  1. Container Orchestration Differences

    Which feature does Kubernetes provide that is not natively available in Docker Compose for managing containers at scale?

    1. Automatic pod rescheduling after failures
    2. Simple network linking with service names
    3. Multi-container definition in a single file
    4. Basic environment variable injection

    Explanation: Kubernetes automatically reschedules failed pods to maintain the desired state, improving resiliency in production. Docker Compose lacks built-in orchestration for automatic container recovery. Both tools allow multi-container definitions and basic environment variable injection, while simple network linking is available in both but not as advanced as Kubernetes' service discovery.

  2. Configuration Management

    What is a key advantage of using Kubernetes Secrets compared to Docker Compose for sensitive configuration data?

    1. Automatic generation of database schemas
    2. Built-in container image scanning
    3. Inline support for conditional logic in the configuration
    4. Native support for encrypted storage of credentials

    Explanation: Kubernetes Secrets enable encrypted storage and distribution of sensitive data like passwords or tokens. Docker Compose typically relies on plain environment variables, lacking encryption. Automatic schema generation and image scanning are not roles for configuration storage, and conditional logic is handled elsewhere, not directly by Kubernetes Secrets.

  3. Persistent Storage Handling

    In a production environment running databases, why is Kubernetes PersistentVolume important compared to standard Docker Compose volumes?

    1. It allows storing images in a local cache for faster pulls
    2. It automatically manages network routing between containers
    3. It composes multiple containers into a single shared memory space
    4. It can be dynamically provisioned and bound to pods, surviving pod restarts and rescheduling

    Explanation: Kubernetes PersistentVolumes provide infrastructure-agnostic, dynamically provisioned storage that survives pod restarts and migrations. Docker Compose volumes are simpler and often host-bound, risking data loss on host or container changes. The other options describe unrelated features such as image caching, network routing, or shared memory, which are not the core advantage here.

  4. Service Discovery and Load Balancing

    How does Kubernetes improve service discovery and routing over Docker Compose in complex applications?

    1. By disabling inter-container communication by default
    2. By only allowing static port mappings for each container
    3. By using internal DNS-based service names with built-in load balancing
    4. By requiring all containers to share a single network interface

    Explanation: Kubernetes assigns DNS names to services and offers built-in load balancing for traffic distribution. Docker Compose supports service naming but lacks advanced DNS and load balancing capabilities. The other options describe limitations or incorrect behaviors not present in Kubernetes' networking model.

  5. Automation and Deployment Workflow

    Which approach is recommended for automating deployment to Kubernetes, minimizing manual steps compared to Docker Compose workflows?

    1. Directly running containers using low-level CRI commands
    2. Manually editing each container's configuration before every deployment
    3. Relying on interactive CLI terminal input for each deployment
    4. Using automated scripts and declarative YAML files applied with kubectl

    Explanation: Automated scripts and declarative YAML manifest files streamline and repeatably manage Kubernetes deployments, minimizing manual work. Manual editing, low-level runtime commands, and per-deployment interactive input are error-prone and not scalable, especially compared to declarative and automated approaches.