Cloud and Container Basics

In Kubernetes, a Pod gets a different IP address every time it is recreated. Which of the following resources lets other applications connect, through a name and address that do not change, to several Pods selected by labels, with the load spread across them?

  1. AConfigMap
  2. BService
  3. CPersistentVolume
Show answer and explanation

Answer: B. Service

A Service gives the set of Pods that match its label selector a virtual IP address and a DNS name that stay the same within the cluster, and distributes incoming traffic to those Pods. Even when Pods are replaced, clients only need to connect using the Service's name, so they do not need to know the Pods' addresses. To expose it outside the cluster, set the type to NodePort or LoadBalancer, or use an Ingress. A ConfigMap is a resource for configuration values, and a PersistentVolume is one for persistent storage.

  • A. A ConfigMap is a resource for passing configuration values to Pods separately from the image.
  • B. Correct. A Service distributes traffic to several Pods through a stable name and address.
  • C. A PersistentVolume is a resource representing storage that remains even when Pods are recreated.
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 Kubernetes cluster, HTTPS requests arriving for one host name should be routed to the api Service if the path begins with /api, and to the web Service otherwise. Which of the following resources is suitable for defining this routing rule?
  2. A database password is stored in a Kubernetes Secret. Which of the following correctly describes a Secret?
  3. 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?
  4. 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?
  5. 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?