I'm trying to set up a Kubernetes cluster at home with Cilium and the gateway API, and it's working well for single-container pods. However, I'm facing an issue with a pod that has multiple containers - specifically, the Paperless container can't connect to the Redis container. Here's a bit of my setup: I'm using Talos VMs for the environment, and I'm deploying my containers through Argo CD. The configuration for my pod looks like this:
- Paperless is running on port 8000
- Redis is set to listen on port 6379, and I've specified the Redis connection in the environment variable as redis://redis:6379.
Can anyone help me troubleshoot this connection issue?
4 Answers
Remember, when containers are co-located in the same pod, they share the same network namespace. Therefore, using 127.0.0.1 lets you reach Redis directly.
You might want to think about running Redis and Paperless in separate pods. Also, your addressing seems a bit inconsistent, which could lead to confusion.
It seems you're treating Kubernetes like Docker. Unlike Docker, Kubernetes doesn't automatically resolve container names like 'redis'. Since both containers are in the same pod, you can connect to Redis at redis://127.0.0.1:6379. Alternatively, for a more Kubernetes-native approach, consider separating them into different pods and using a service to handle the DNS resolution, like redis://..svc.cluster.local.
For better scalability, consider using separate Deployments for these containers. Kubernetes assigns an IP per Pod, not per container, so when they're in the same Pod, you can access Redis using redis://localhost:6379.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux