Question

error accessing external endpoint kubernetes in digital ocean

Guys, I deployed a .NET WEB API application to Kubernets, however, when I try to access the external endpoint provided by LoadBalancer, nothing returns, do I need to configure anything else? Can anyone help me?

my configuration;

**

apiVersion: apps/v1

kind: Deployment

metadata:

  name: car-companie-deployment

  labels:

    app: car-companie-deployment

spec:

  replicas: 1

  selector:

    matchLabels:

      app: car-companie-deployment

  template:

    metadata:

      labels:

        app: car-companie-deployment

    spec:

      containers:

      - name: car-companie-container

        image: <IMAGE>

        ports:

        - containerPort: 80



---

apiVersion: v1

kind: Service

metadata:

  name: car-companie-service

spec:

  selector:

    app: car-companie-deployment

  ports:

  - protocol: TCP

    port: 80

    targetPort: 80

  type: LoadBalancer

**

images pods : https://imgur.com/a/N1esvEd


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 16, 2023

Hi there,

There are a few things that I could suggest checking in order to further troubleshoot the issue that you are facing:

  1. First, check the status of the service to ensure the LoadBalancer has provisioned an external IP:

    kubectl get svc car-companie-service
    

    If the “EXTERNAL-IP” is still pending, that means the LoadBalancer is still provisioning, and you’ll need to wait. If an IP is listed, that’s the IP you’ll use to access your service.

  2. Ensure that your .NET API application inside the container is indeed listening on port 80. If it’s listening on a different port, you’ll need to adjust the containerPort value accordingly.

  3. Ensure the pods associated with the deployment are running correctly.

    kubectl get pods -l app=car-companie-deployment
    

    Check for any restarts or issues with the pods.

  4. Inspect the logs of a pod to see if there are any error messages or startup issues:

    kubectl logs [POD_NAME] -c car-companie-container
    

    Replace [POD_NAME] with one of the pod names from the previous command.

  5. Try accessing the application within the cluster to see if it’s an external issue or if the app itself isn’t responding:

    kubectl run -it --rm debug --image=busybox -- sh wget -qO- http://car-companie-service
    

    This will try to access your service from a temporary pod within the cluster.

Let me know how it goes and feel free to share the extra details that you’ve gathered here so I could try to advise you further!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel