In Kubernetes, what is the main purpose of a service with type LoadBalancer?
Think about how external users can access your service from outside the cluster.
A LoadBalancer service type creates an external load balancer in supported cloud providers, giving the service a public IP address for external access.
What is the expected output of kubectl get svc for a LoadBalancer service just created in a cloud environment?
kubectl get svc my-loadbalancer-serviceJust after creation, the cloud provider has not yet provisioned the load balancer.
Immediately after creating a LoadBalancer service in a cloud environment, the EXTERNAL-IP shows <pending> until the cloud provider provisions the load balancer.
Which YAML snippet correctly defines a Kubernetes service of type LoadBalancer exposing port 80?
Check the service type and protocol used for HTTP traffic.
The correct YAML uses type: LoadBalancer and TCP protocol for port 80, which is standard for HTTP.
You created a LoadBalancer service in Kubernetes, but kubectl get svc shows <pending> in the EXTERNAL-IP column. What is the most likely cause?
Think about what provisions the external IP for LoadBalancer services.
LoadBalancer services require cloud provider support to provision an external IP. On local clusters like Minikube or bare metal, this IP stays pending.
What is the correct order of steps to expose a Kubernetes app externally using a LoadBalancer service?
Create both YAML files before applying them to the cluster.
The logical order is to first create the Deployment YAML, then define the Service YAML selecting the Deployment's pods, then apply both YAML files to the cluster, and finally check the EXTERNAL-IP once provisioned.