question

MayankArora-0729 avatar image
0 Votes"
MayankArora-0729 asked shivapatpi-MSFT answered

Load balancer does not resolve when creating Service object

Hi,

I'm creating an external load balancer for my cluster, using

apiVersion: v1
kind: Service
metadata:
name: create-account-service
spec:
type: LoadBalancer
selector:
app: cas
ports:
- port: 5000
targetPort: 5000
name: create-account-service

The External-IP unfortunately does not resolve, im not sure why. I have 2 nodes in a nodes running in the cluster. Any suggestions? Using the default Kubenet configuration

azure-kubernetes-serviceazure-load-balancer
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

shivapatpi-MSFT avatar image
0 Votes"
shivapatpi-MSFT answered

Hello @MayankArora-0729 ,
YAML syntax looks good. Can you check after deploying the above YAML file are you getting EXTERNAL_IP column getting populated with some IP ?
If that column value is in pending state , please do the describe of service

kubectl describe svc create-account-service

In the events section you should be able to see the reason why the IP is not getting provisioned.
Also in the above output check if the endpoints got updated with POD IPs
In the YAML file , Just make sure the selector value is pointing to the pod selector.

You can also try exposing the POD using imperative kubectl command like below:
kubectl expose pod nginx --name=nginx-svc --type=LoadBalancer --port=5000 --target-port=5000 (This command is for exposing a sample nginx pod)

Let us know if that helps out !



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.