Cloud and Container Basics

readinessProbe:
  httpGet:
    path: /ready
    port: 8080
  periodSeconds: 5

A web application cannot handle requests for about 60 seconds after starting, while it loads its cache, and returns 503 from /ready during that time. Which of the following correctly describes the effect of adding the settings above to the Pod's container?

  1. AWhile /ready fails, the Pod is removed from the Service's routing targets and receives no requests, and the container is not restarted
  2. BThe container is restarted each time /ready fails, so it keeps restarting before the cache has finished loading
  3. CUntil /ready succeeds, the Pod is not assigned to any node, and the container is not started
Show answer and explanation

Answer: A. While /ready fails, the Pod is removed from the Service's routing targets and receives no requests, and the container is not restarted

A readiness probe checks whether a container is ready to accept requests and, while it fails, removes the Pod from the Service's routing targets. An HTTP probe treats a response of at least 200 and below 400 as success, so no requests are routed while 503 is returned, and requests arrive once the application is ready. Restarting the container on failure is the job of a liveness probe; giving an application that is slow to start only a liveness probe with a short interval can cause repeated restarts. Which node a Pod runs on is decided by the scheduler, not by probes.

  • A. Correct. A readiness probe decides whether requests are routed to the Pod.
  • B. Restarting on failure is done by a liveness probe. A readiness probe failure does not restart the container.
  • C. Probes are run against containers that have already been assigned to a node and started. Assignment is decided by the scheduler.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. In a web application on Kubernetes, the check performed by the liveness probe was made to include whether the application can connect to the database it depends on. Which of the following is the most likely problem with this setting?
  2. A Kubernetes HorizontalPodAutoscaler has a target CPU utilization of 70% and a range of 1 to 10 Pods. Currently the average CPU utilization of 5 Pods is 30%. When the required number of Pods is computed as ⌈current number × current utilization ÷ target utilization⌉ (⌈ ⌉ means rounding up), which of the following is the required number of Pods?
  3. In a Deployment whose Pod containers have the settings above, four Pods are running, each using 400m (0.4 cores) of CPU. The HorizontalPodAutoscaler's target CPU utilization is 60%, and the required number of Pods is computed as ⌈current number × current utilization ÷ target utilization⌉. Which of the following is the required number of Pods?
  4. In Kubernetes, which of the following correctly describes the resource requests and limits set for a container?
  5. A node has allocatable resources of 4 CPU cores and 8 GiB of memory. Each Pod's container has requests of 500m CPU and 1.5 GiB memory and limits of 1 CPU core and 2 GiB memory. There are no other Pods and no system reservations. Which of the following is the maximum number of Pods that can be placed on this node?