Bird
0
0

Which YAML configuration correctly defines a Kubernetes LoadBalancer service exposing port 443?

easy📝 Syntax Q3 of 15
Kubernetes - Ingress
Which YAML configuration correctly defines a Kubernetes LoadBalancer service exposing port 443?
AapiVersion: v1 kind: Service metadata: name: my-service spec: type: LoadBalancer ports: - port: 443 targetPort: 443 selector: app: my-app
BapiVersion: v1 kind: Service metadata: name: my-service spec: type: ClusterIP ports: - port: 443 targetPort: 80 selector: app: my-app
CapiVersion: v1 kind: Service metadata: name: my-service spec: type: NodePort ports: - port: 80 targetPort: 443 selector: app: my-app
DapiVersion: apps/v1 kind: Service metadata: name: my-service spec: type: LoadBalancer ports: - port: 80 targetPort: 80 selector: app: my-app
Step-by-Step Solution
Solution:
  1. Step 1: Identify Service Type

    The service must be of type LoadBalancer to expose externally with a cloud provider IP.
  2. Step 2: Confirm Port Configuration

    Port 443 is exposed and targetPort matches 443 for TLS traffic.
  3. Step 3: Validate API Version and Kind

    apiVersion should be v1 and kind Service for service definitions.
  4. Final Answer:

    YAML snippet in apiVersion: v1 kind: Service metadata: name: my-service spec: type: LoadBalancer ports: - port: 443 targetPort: 443 selector: app: my-app correctly defines a LoadBalancer service exposing port 443.
  5. Quick Check:

    Type LoadBalancer + port 443 + correct apiVersion [OK]
Quick Trick: LoadBalancer with matching port and targetPort [OK]
Common Mistakes:
  • Using ClusterIP or NodePort instead of LoadBalancer
  • Mismatched port and targetPort values
  • Incorrect apiVersion or kind

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes