Certified Kubernetes Administrator (CKA) Practice Test

Question: 1 / 400

How do you create a service to expose a deployment's pods externally?

Use kubectl create service directly

Copy the yaml for a service and edit

To create a service that exposes a deployment's pods externally, using a YAML file is a widely adopted and best practice approach. This method allows you to define the necessary configurations for the service in a structured format, which can include details such as the service type (ClusterIP, NodePort, or LoadBalancer), selector labels to target the appropriate pods, and port mappings.

Editing a YAML file that outlines the service specifications provides the benefits of version control and clarity. It allows for easy modifications and visibility into the configuration, which is particularly useful for team collaborations and during troubleshooting.

The other methods may lack the flexibility and clarity that the YAML approach offers. For instance, creating a service directly through kubectl without a YAML file can be less intuitive and harder to manage. Manually entering each pod setting is both time-consuming and prone to errors, while using kubectl apply without a YAML file does not allow for the explicit configuration needed to ensure the service routes traffic correctly to the intended pods. Thus, the chosen method of editing a YAML file stands out for its effectiveness in managing Kubernetes resources.

Get further explanation with Examzify DeepDiveBeta

Manually enter each pod setting

Use kubectl apply without a yaml file

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy