Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[PostgreSQL connection in Kubernetes]

クローズ 初心者向け
#417 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@github-actions がすでに取り組んでいます。

2026年9月24日 から。

  • #418 @github-actions による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, docker-compose, kubernetes, postgresql

調査の方向性

まず、コース ai-dev-tools-zoomcamp に関するリポジトリの FAQ の貢献用ファイルまたはインデックスを見つけ、近くにあるエントリと貢献に関するガイダンスを読んでください。localhost と Service の DNS の違いの説明、postgres:5432 の設定、kind のイメージ読み込みの確認方法を文書化してください。回答が見つけやすく、正確で、リポジトリの形式と一貫していれば完了です。

索引モデルが issue の本文から書いたものです。

説明

faq-proposal
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
主要言語
Python
スター
7
フォーク
19
平均マージ
11日 23時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DataTalksClub/faq のほかの issue

DataTalksClub/faq の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。