[PostgreSQL connection in Kubernetes]
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- docker, docker-compose, kubernetes, postgresql
- Área
- databases, devops, documentation
Línea de trabajo
Comienza localizando el archivo o índice de contribuciones de las FAQ del repositorio para el curso ai-dev-tools-zoomcamp y, después, lee las entradas cercanas y cualquier guía de contribución. Documenta la explicación de DNS de localhost frente a Service, la configuración de postgres:5432 y las comprobaciones de carga de imágenes de kind; se considera terminado cuando la respuesta es fácil de encontrar, precisa y coherente con el formato del repositorio.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Course
ai-dev-tools-zoomcamp
Question
When deploying Agent Relay and PostgreSQL from Docker Compose to a local kind Kubernetes cluster, why does Agent Relay fail to connect to PostgreSQL when the database host is set to localhost, and what should be changed?
Answer
localhost refers to the current container/pod, not to another Kubernetes service. Therefore, when Agent Relay runs in its own pod, setting the PostgreSQL host to localhost makes it try to find PostgreSQL inside the Agent Relay container.
The solution is to expose PostgreSQL through a Kubernetes Service and use the Service DNS hostname as the database host.
For example, if the PostgreSQL Service is named:
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
ports:
- port: 5432
targetPort: 5432
Agent Relay should connect using:
postgres:5432
instead of:
localhost:5432
The PostgreSQL connection configuration should therefore use the Kubernetes Service name, for example:
postgresql://<user>:<password>@postgres:5432/<database>
After applying the Kubernetes manifests, the connection can be verified from the Agent Relay pod with:
kubectl get pods
kubectl get services
kubectl logs deployment/agent-relay
This is different from Docker Compose, where the Compose service name can also be used for container-to-container communication. In Kubernetes, the equivalent mechanism is the Kubernetes Service and its DNS name.
For a local kind cluster, the Agent Relay image also needs to be available inside the cluster. If the image is built locally, it can be loaded with:
docker build -t agent-relay:local .
kind load docker-image agent-relay:local
Then the Kubernetes Deployment can reference:
image: agent-relay:local
imagePullPolicy: IfNotPresent
This allows the locally built Agent Relay image to run in kind without requiring the image to be pushed to a remote registry.
Checklist
- I have searched existing FAQs and this question is not already answered
- The answer provides accurate, helpful information
- I have included any relevant code examples or links
- Lenguaje dominante
- Python
- Estrellas
- 7
- Forks
- 20
- Merge medio
- 7 d 9 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DataTalksClub/faq
-
[FAQ] How to fix "ValueError: Only sparse matrices with 32-bit integer indices are accepted" with DictVectorizerPosiblemente ocupada @github-actions la tomó hace 2 días. Abiertofaq-proposal
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
DataTalksClub/faq#493 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[FAQ]Homework 4 (2026) Q2/Q6Posiblemente ocupada @github-actions la tomó hace 3 días. Abiertofaq-proposal
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
DataTalksClub/faq#491 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[FAQ] Homework 4 (2026) Q2/Q6: Why does my model's AUC (0.732) lose to `lead_score` alone, and why does C=0.001 beat C=1?Posiblemente ocupada @github-actions la tomó hace 3 días. Abiertofaq-proposal
Dificultad 1/5 Menos de una hora Aptitud para principiantes 87/100
DataTalksClub/faq#489 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
DataTalksClub/faq#486 ·
Los mantenedores suelen responder en 2 días
-
[FAQ]Posiblemente ocupada @github-actions la tomó hace 5 días. Abiertofaq-proposal
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
DataTalksClub/faq#484 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de DataTalksClub/faq
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
google-agentic-commerce/AP2#388 ·
-
area:codegen backend:cuda backend:hip bug direction:input
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
CrossGL/crosstl#3061 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
rlaope/oh-my-hermes#2304 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
mochan-tk/agentic-dev-kit-for-codex#64 ·
Los mantenedores suelen responder en 1 día
-
Windows ARM memory-leakAbiertobug docs performance
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 3 días