How to Set Up External Access for My Kubernetes Cluster?

March 2, 2026 1 answer
Asked by Sourdough starter jar!
Hey folks! I'm trying to configure external access for my application running in a Kubernetes cluster. I have a container with an ingress that listens on port 8080, and I've noticed the ingress details in k9s showing 172 addresses. My goal is to set up a load balancer to enable outside access, but I'm having some trouble making it work based on my current configuration. Here's what I have: ### Ingress Configuration: ```yaml ingresses: my-app: enabled: true className: "traefik" customAnnotations: {} hosts: - host: "myapp.apps.caspersbox.com" paths: - path: /actuator/health serviceName: "my-app" servicePort: 8081 type: "Prefix" - path: / serviceName: "my-app" servicePort: 8080 type: "Prefix" ``` ### Load Balancer Service: ```yaml apiVersion: v1 kind: Service metadata: name: lb-service spec: selector: app: myapp type: LoadBalancer ports: - name: http-ui protocol: TCP port: 443 targetPort: 8080 ``` I set up MetalLB with the following configurations: ```yaml apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: name: default-pool namespace: my-ns spec: addresses: - 192.168.10.25-192.168.10.29 --- apiVersion: metallb.io/v1beta1 kind: L2Advertisement metadata: name: default-advertisement namespace: myns spec: ipAddressPools: - default-pool ``` Now, I have an IP assigned, but I'm seeing a port mapping issue where the port is 443 externally, but it shows port 32470 when I check in k9s. I'm not sure where I went wrong, and I'm looking for either a usable IP address on my network or for the service to be accessible via the host IP. Any suggestions?

Answers

R4 splice
It seems like you're trying to use both an Ingress and a LoadBalancer at the same time, which can be a bit tricky. First, make sure youโ€™re correctly using the Ingress to point to your services. Run `kubectl -A get ingress` to see if the `ADDRESS` column has a value. If you see a LoadBalancer IP there, your Ingress is working fine. If itโ€™s not showing an IP, you need to ensure your service is set up correctly. You canโ€™t change the service type after creation, so you might need to delete and recreate it with the right type or simply switch it to the service that matches what your Ingress points to, adjusting the ports as needed. If youโ€™re okay without the Ingress, just check the `get svc -A` output to see if the `EXTERNAL-IP` is populated. Thatโ€™ll help you determine if the LoadBalancer is set up correctly.

desk__organizer: So just to clarify, are you saying I can disable the Ingress and have the LoadBalancer route directly to the container's port? Also, I turned off the Ingress and updated the LoadBalancer service, but it seems to be ignoring my targetPort settings.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions