goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.61k stars 4.72k forks source link

harbor-core can't connect harbor-database. #20413

Closed echo-machile closed 1 week ago

echo-machile commented 4 months ago

root@k8s-master:/home/iot/kubekey/harbor# kubectl logs harbor-core-bff64c49d-cppwz -n iot Appending internal tls trust CA to ca-bundle ... find: '/etc/harbor/ssl': No such file or directory Internal tls trust CA appending is Done. 2024-05-10T07:47:20Z [INFO] [/controller/artifact/annotation/parser.go:71]: the annotation parser to parser artifact annotation version v1alpha1 registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.cncf.helm.config.v1+json registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.cnab.manifest.v1 registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.oci.image.index.v1+json registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.docker.distribution.manifest.list.v2+json registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.docker.distribution.manifest.v1+prettyjws registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.oci.image.config.v1+json registered 2024-05-10T07:47:20Z [INFO] [/controller/artifact/processor/processor.go:59]: the processor to process media type application/vnd.docker.container.image.v1+json registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/native/adapter.go:36]: the factory for adapter docker-registry registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/harbor/adaper.go:31]: the factory for adapter harbor registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/dockerhub/adapter.go:26]: Factory for adapter docker-hub registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/huawei/huawei_adapter.go:41]: the factory of Huawei adapter was registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/googlegcr/adapter.go:35]: the factory for adapter google-gcr registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/awsecr/adapter.go:43]: the factory for adapter aws-ecr registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/azurecr/adapter.go:15]: Factory for adapter azure-acr registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/aliacr/adapter.go:31]: the factory for adapter ali-acr registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/jfrog/adapter.go:46]: the factory of jfrog artifactory adapter was registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/quay/adapter.go:54]: the factory of Quay adapter was registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/helmhub/adapter.go:30]: the factory for adapter helm-hub registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/gitlab/adapter.go:17]: the factory for adapter gitlab registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/dtr/adapter.go:22]: the factory of dtr adapter was registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/artifacthub/adapter.go:30]: the factory for adapter artifact-hub registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/tencentcr/adapter.go:41]: the factory for adapter tencent-tcr registered 2024-05-10T07:47:20Z [INFO] [/pkg/reg/adapter/githubcr/adapter.go:29]: the factory for adapter github-ghcr registered 2024-05-10T07:47:20Z [INFO] [/core/controllers/base.go:155]: Config path: /etc/core/app.conf 2024-05-10T07:47:20Z [INFO] [/core/main.go:180]: initializing cache ... 2024-05-10T07:47:20Z [INFO] [/core/main.go:190]: initializing configurations... 2024-05-10T07:47:20Z [INFO] [/lib/config/systemconfig.go:197]: key path: /etc/core/key 2024-05-10T07:47:20Z [INFO] [/lib/config/config.go:92]: init secret store 2024-05-10T07:47:20Z [INFO] [/core/main.go:192]: configurations initialization completed 2024-05-10T07:47:20Z [INFO] [/common/dao/base.go:67]: Registering database: type-PostgreSQL host-harbor-database port-5432 database-registry sslmode-"disable" 2024-05-10T07:47:21Z [ERROR] [/common/utils/utils.go:106]: failed to connect to tcp://harbor-database:5432, retry after 2 seconds :dial tcp 10.233.11.4:5432: i/o timeout 2024-05-10T07:47:25Z [ERROR] [/common/utils/utils.go:106]: failed to connect to tcp://harbor-database:5432, retry after 2 seconds :dial tcp 10.233.11.4:5432: i/o timeout 2024-05-10T07:47:31Z [ERROR] [/common/utils/utils.go:106]: failed to connect to tcp://harbor-database:5432, retry after 2 seconds :dial tcp 10.233.11.4:5432: i/o timeout 2024-05-10T07:47:41Z [ERROR] [/common/utils/utils.go:106]: failed to connect to tcp://harbor-database:5432, retry after 2 seconds :dial tcp 10.233.11.4:5432: i/o timeout 2024-05-10T07:47:59Z [ERROR] [/common/utils/utils.go:106]: failed to connect to tcp://harbor-database:5432, retry after 2 seconds :dial tcp 10.233.11.4:5432: i/o timeout 2024-05-10T07:48:20Z [FATAL] [/core/main.go:207]: failed to initialize database: failed to connect to tcp:harbor-database:5432 after 60 seconds root@k8s-master:/home/iot/kubekey/harbor# kubectl get pods -n iot NAME READY STATUS RESTARTS AGE harbor-chartmuseum-6b88c5f544-8rl5x 1/1 Running 0 69m harbor-core-bff64c49d-cppwz 0/1 CrashLoopBackOff 15 (78s ago) 69m harbor-database-0 1/1 Running 0 69m harbor-jobservice-7dd96f69fb-72krs 0/1 CrashLoopBackOff 9 (5m ago) 69m harbor-nginx-79cd8b9f96-bfvx6 0/1 Running 12 (3m16s ago) 69m harbor-notary-server-59fdf6948c-wr2bz 0/1 CrashLoopBackOff 16 (3m17s ago) 69m harbor-notary-signer-55574fbdfd-xlfxs 0/1 CrashLoopBackOff 16 (2m23s ago) 69m harbor-portal-6bfb7684b5-54mzs 1/1 Running 0 69m harbor-redis-0 1/1 Running 0 69m harbor-registry-db8b47cd9-9hshn 2/2 Running 0 69m harbor-trivy-0 1/1 Running 0 69m hh-v1-565f56c5c8-px7xx 2/2 Running 0 14d mysql-7z0mkf-74564dc74f-8njmh 1/1 Running 2 (14d ago) 14d nfs-subdir-external-provisioner-fbc4f7767-zwfnc 0/1 ContainerCreating 0 133m

MinerYang commented 4 months ago

Please dump the harbor-database log or descriptions for details.

DaanSelen commented 3 months ago

I am running into the same issue, with me it comes down to the ownership of the volume which Postgres is using. Which is not owner by postgres, and it takes issue with that.

echo-machile commented 3 months ago

oh , maybe , thank you.

发自我的iPhone

------------------ Original ------------------ From: dselen @.> Date: Mon,May 27,2024 7:40 PM To: goharbor/harbor @.> Cc: 刘广全 @.>, Author @.> Subject: Re: [goharbor/harbor] harbor-core can't connect harbor-database.(Issue #20413)

I am running into the same issue, with me it comes down to the ownership of the volume which Postgres is using. Which is not owner by postgres, and it takes issue with that.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

DaanSelen commented 3 months ago

oh , maybe , thank you.

Hey, this might be of help. The way I worked around this is by setting the security context in the harbor template to the nobody user ID and GID. Then Postgres works and harbor starts up succesfully! Though this might be a good thing to be said in documentation.

github-actions[bot] commented 1 month ago

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

github-actions[bot] commented 1 week ago

This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.