Question

Can not access to the application with ip

Hi, I created a kubernetes cluster. I created a deployment and service load balancer but I can not access the application through external IP.


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.

Hi there,

When you deploy an application in a DigitalOcean Managed Kubernetes cluster and expose it using a Service of type LoadBalancer, DigitalOcean provisions a load balancer that directs traffic to the appropriate pods.

If you can’t access your application through the external IP, there could be several reasons:

  1. Verify the Service Status:

    Check the status of your Kubernetes service to make sure it’s up and has an external IP assigned:

    kubectl get svc
    

    Ensure that the service shows an EXTERNAL-IP and is not stuck in <pending> status.

  2. Service Port & Target Port:

    When defining your service, make sure the service’s port and the target port match the port your application is listening on within the container.

    For example:

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080
  type: LoadBalancer

Here, the load balancer listens on port 80, but directs traffic to pods on port 8080.

Besides that, you need to ensure that your application is listening on 0.0.0.0 and not 127.0.0.1. If it’s listening only on localhost (127.0.0.1), it won’t be accessible from outside the pod.

You can also try to, log into your DigitalOcean dashboard and navigate to the Networking -> Load Balancers section. Ensure your load balancer is correctly set up, is healthy, and is directing traffic to the correct droplets/nodes.

Besides all that, have you tried checking your application logs?

kubectl logs <pod-name>

And also describe the service to check for any events or issues:

kubectl describe svc <service-name>

Let me know how it goes!

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

Featured on Community

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