1. Core Concepts (13%)

Creating a Pod and Inspecting it

  1. Create the namespace ckad-prep.

  2. In the namespace ckad-prep create a new Pod named mypod with the image nginx:2.3.5. Expose the port 80.

  3. Identify the issue with creating the container. Write down the root cause of issue in a file named pod-error.txt.

  4. Change the image of the Pod to nginx:1.15.12.

  5. List the Pod and ensure that the container is running.

  6. Log into the container and run the ls command. Write down the output. Log out of the container.

  7. Retrieve the IP address of the Pod mypod.

  8. Run a temporary Pod using the image busybox, shell into it and run a wget command against the nginx Pod using port 80.

  9. Render the logs of Pod mypod.

  10. Delete the Pod and the namespace.

First, create the namespace.

$ kubectl create namespace ckad-prep

Next, create the Pod in the new namespace.

$ kubectl run mypod --image=nginx:2.3.5 --restart=Never --port=80 --namespace=ckad-prep
pod/mypod created

You will see that the image cannot be pulled as it doesn’t exist with this tag.

The list of events can give you a deeper insight.

Go ahead and edit the existing Pod. Alternatively, you could also just use the kubectl set image pod mypod mypod=nginx --namespace=ckad-prep command.

After setting an image that does exist, the Pod should render the status Running.

You can shell into the container and run the ls command.

Retrieve the IP address of the Pod with the -o wide command line option.

Remember to use the --rm to create a temporary Pod.

If you don’t see a command prompt, try pressing enter.

The logs of the Pod should show a single line indicating our request.

Delete the Pod and namespace after you are done.

最后更新于