无法连接Google Cloud Run中PostgreSQL边车容器的求助
Google Cloud Run中Invidious容器无法连接PostgreSQL边车容器(无需付费VPC)
我尝试在Google Cloud Run中运行Invidious Web容器,使其与PostgreSQL边车容器通信,以下是我的服务YAML配置片段:
spec: containerConcurrency: 80 timeoutSeconds: 300 serviceAccountName: 328305070564-compute@developer.gserviceaccount.com containers: - name: invidious-1 image: ceramicwhite/invidious:build-3450896@sha256:4b90f6123c14a140c0c5aa39fbb1b49e520832b68a2d5606e11062592b7015cd ports: - name: http1 containerPort: 3000 env: - name: INVIDIOUS_CONFIG value: | db: dbname: db-name user: my-username password: super-secret host: localhost port: 5432 check_tables: true external_port: 3000 captcha_enabled: false admins: ["umbrel"] default_user_preferences: feed_menu: ["Trending", "Subscriptions", "Playlists"] default_home: Trending hmac_key: "${APP_SEED}" resources: limits: cpu: 1000m memory: 512Mi startupProbe: timeoutSeconds: 240 periodSeconds: 240 failureThreshold: 1 tcpSocket: port: 3000 - name: postgres1 image: postgres:13.7@sha256:03652c675ae177af98ddd50f9f4b4b2cf8ad38d0e116aa68fe670fbc2cf250fc env: - name: POSTGRES_DB value: db-name - name: POSTGRES_USER value: my-username - name: POSTGRES_PASSWORD value: super-secret resources: limits: cpu: 1000m memory: 1Gi volumeMounts: - name: in-memory-1 mountPath: /var/lib/postgresql/data/ volumes: - name: in-memory-1 emptyDir: medium: Memory sizeLimit: 2G traffic: - percent: 100 latestRevision: true
根据配置及官方文档,预期Invidious容器可通过localhost:5432连接PostgreSQL容器,但容器启动失败,报错如下:
{ "textPayload": "Caused by: Error connecting to 'localhost:5432': Connection refused (Socket::ConnectError)", "insertId": "6567d327000e76387751e45a", "resource": { "type": "cloud_run_revision", "labels": { "project_id": "complete-agency-406616", "service_name": "invidious", "location": "us-central1", "revision_name": "invidious-00017-zms", "configuration_name": "invidious" } }, "timestamp": "2023-11-30T00:11:19.947768Z", "labels": { "container_name": "invidious-1", "instanceId": "0087599d428e073fef5c3ed8cac751f0df4ddf6710c3884e7ba9212319f7d82d07ac9ef1b0ccb73104a618d398bdb8135c6cf22faba200e7dcea2130a6f14f90eea2e64c" }, "logName": "projects/complete-agency-406616/logs/run.googleapis.com%2Fstderr", "receiveTimestamp": "2023-11-30T00:11:19.975329453Z" }
我还尝试使用127.0.0.1、postgres1替代localhost,均出现相同的连接失败问题。
请问在不搭建付费VPC的情况下,如何从入口容器访问边车容器?
内容的提问来源于stack exchange,提问作者johncorser
相关产品推荐
相关产品推荐

