Deploying a Docker Application to Kubernetes Quiz

Explore the fundamental steps for moving a Dockerized application to a Kubernetes cluster, from registry authentication to service exposure and access.

  1. Authenticating to a Private Docker Registry

    Which command is used to authenticate to a private Docker registry before pushing an image?

    1. docker connect
    2. kubectl login
    3. docker login
    4. docker authenticate

    Explanation: The correct command to authenticate with a private Docker registry is 'docker login'. 'docker connect' does not exist as a command, and 'kubectl login' is used for Kubernetes clusters, not Docker registries. 'docker authenticate' is not a valid Docker command.

  2. Tagging Docker Images for Private Registry

    What is the purpose of tagging a Docker image with a registry's IP address and port before pushing it?

    1. Verify the image's contents
    2. Specify the destination registry
    3. Increase the image size
    4. Change the image name locally

    Explanation: Tagging an image with a registry's address tells Docker where to send the image during push. It does not increase the image size, change the name locally without destination, or verify contents. The tag determines the remote repository for the push operation.

  3. Running a Container From a Private Registry Image

    After pushing an image to a private registry, which command can be used to run a container using that image?

    1. docker run <registry-address>/<image-name>
    2. kubectl deploy <registry-address>/<image-name>
    3. kubectl start <image-name>
    4. docker execute <image-name>

    Explanation: 'docker run <registry-address>/<image-name>' runs a container from the specified image in a private registry. 'kubectl start' and 'kubectl deploy' are not valid Docker commands, and 'docker execute' is not used for running images.

  4. Creating a Kubernetes Pod With a Private Registry Image

    Which command creates a Kubernetes pod using an image from a private registry?

    1. docker create pod --image=<image-name>
    2. kubectl run <name> --restart=Never --image=<registry-address>/<image-name> --port=80
    3. docker generate pod <image-name>
    4. kubectl start pod <image-name>

    Explanation: 'kubectl run' with the specified parameters creates a pod using the image from the private registry. The other options are not valid Kubernetes or Docker commands for creating pods.

  5. Exposing an Application With a Kubernetes Service

    Which Kubernetes command exposes a running pod as a network service, enabling external access?

    1. docker expose <container-name> --port=80
    2. kubectl service <pod-name> --open
    3. docker publish <image-name> --port=80
    4. kubectl expose pods <pod-name> --type=NodePort --port=80

    Explanation: The 'kubectl expose' command with NodePort type creates a service that maps an external port to the pod. 'docker expose' and 'docker publish' are not valid for exposing Kubernetes services, and 'kubectl service' is not a command.