Trouble Connecting Containers in the Same Pod with Cilium

0
10
Asked By CuriousCoder42 On

I'm having some issues connecting two containers within the same pod using Cilium in my home Kubernetes setup. I've got things working smoothly with single-container pods, but now when I try to set up a pod for a paperless application alongside a Redis container, the paperless application can't connect to Redis. I'm using VMs with Talos, Kubernetes with Cilium and the gateway API, and I manage deployments through Argo-CD. Here's the basic setup of the containers I'm using: the paperless container has an environment variable to connect to Redis at 'redis://redis:6379', but it's not working. Any ideas on what I might be doing wrong?

4 Answers

Answered By DevOpsWhiz On

Typically, it's better to have those containers as separate pods. It looks like your addressing and ports might not be quite right, which could be contributing to the connection issue.

Answered By TechGuru99 On

It seems like you might be transitioning from Docker and expecting automatic DNS resolution for the Redis container. In Kubernetes, if both containers are in the same pod, they share the same network. That means you could directly connect to Redis using 'redis://127.0.0.1:6379'. Alternatively, a more standard approach would be to separate them into different pods, create a service for Redis, and then point your paperless app to the service's DNS address like 'redis://..svc.cluster.local'.

Answered By NetworkNerd On

When you have multiple containers in the same pod, they indeed share the same network namespace, so if you're trying to connect to Redis, you could just use '127.0.0.1'.

Answered By K8sEnthusiast On

You should avoid having both containers in the same pod. If you try scaling later, like going to two instances, it could create a problem with your Redis setup. Remember, Kubernetes has an IP per pod rather than per container, and so you would connect via 'redis://localhost:6379' since they're part of the same pod.

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.