How to Access a Container in a K3d Cluster Using External Address?

0
1
Asked By CuriousCactus42 On

I'm trying to access a container within a pod in my K3d cluster via an external address, but I'm hitting some snags. I've set up my K3d cluster with specific configurations, using the command: `k3d cluster create fedora --api-port 6550 --k3s-arg "--disable=traefik@server:0" --k3s-arg "disable=servicelb@server:0" --no-lb --registry-use k3d-fedora.local:65000 --agents 4 --wait`. Next, I added Nginx as an ingress controller and installed MetalLB to handle load balancing. I've also defined an IP address pool and configured my ingress rules. My issue is that although the `ingress-nginx-controller` shows an assigned IP, I'm unable to ping or access that IP externally. Additionally, I'm seeing an error regarding a missing TLS secret in the logs, which I understand I need to address. Do I just need to create a secret with a PEM file? Would it need both the certificate chain and the key?

1 Answer

Answered By TechyTomato88 On

It sounds like you're pretty close! Just a couple of things: The ingress controller should be the one getting an IP from MetalLB, and it's normal for your app's ingress not to have an external IP. Since you're on K3d, reaching that MetalLB IP from outside the cluster might not work due to Docker networking. I'd recommend exposing the controller using host port mapping or creating a NodePort service. That way, you can access your app using the host's IP and specified port.

InquisitiveNinja01 -

Could you clarify what you mean by host port mapping? Is it like defining a port that the host machine will use to access the service? I found this snippet online that seems related: it shows how to set up a NodePort service, but I'm unsure how the ports work together.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.