KCNA · Question #37
Can a Kubernetes Service expose multiple ports?
The correct answer is B. Yes, but you must specify an unambiguous name for each port.. Kubernetes Services can expose multiple ports, provided that each port definition within the service is assigned a unique, unambiguous name.
Question
Can a Kubernetes Service expose multiple ports?
Options
- ANo, you can only expose one port per each Service.
- BYes, but you must specify an unambiguous name for each port.
- CYes, the only requirement is to use different port numbers.
- DNo, because the only port you can expose is port number 443.
How the community answered
(36 responses)- A3% (1)
- B86% (31)
- C8% (3)
- D3% (1)
Why each option
Kubernetes Services can expose multiple ports, provided that each port definition within the service is assigned a unique, unambiguous name.
This statement is incorrect; Kubernetes Services are designed to support exposing multiple ports.
A Kubernetes Service can indeed expose multiple ports, allowing different functionalities or protocols to be accessible through a single service entry point. When defining multiple ports, each entry in the `ports` array must be given a distinct `name` to uniquely identify and refer to it.
While different port numbers are necessary, the critical requirement for multiple ports is that each port definition must have a unique name, not just different numbers.
This statement is incorrect; Kubernetes Services can expose any valid port number, not exclusively port 443.
Concept tested: Kubernetes Service multiple port exposure
Source: https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services
Topics
Community Discussion
No community discussion yet for this question.