有没有人将 Stellar 的 Docker Compose 迁移到 Kubernetes 并解决了 Stellar Horizo​​n DB 的问题?

Has anyone migrated Stellar's Docker Compose to Kubernetes and fixed the issue with Stellar Horizon DB?

我可能遇到了 Horizo​​n 中描述的相同问题:如果数据库连接失败则不退出 #898 (https://github.com/stellar/go/issues/898),但设置方案不同。

我正在将 https://github.com/satoshipay/docker-stellar-horizon Docker Compose 定义迁移到 Kubernetes。我已经能够迁移大部分设置,但遇到了 Horizo​​n 的问题,即在启动期间未创建数据库。我相信我拥有出色的核心,依赖于按设计工作的 Postgres 和作为启动一部分创建的数据库,但 Horizo​​n 的设置不同。

我目前遇到的问题如下...

Horizo​​n Server Pod 日志

todkapmcbookpro:kubernetes todd$ kubectl get pods
NAME                                READY     STATUS             RESTARTS   AGE
postgres-horizon-564d479db4-2xvqd   1/1       Running            0          20m
postgres-sc-9f5f7fb4-prlpr          1/1       Running            0          22m
stellar-core-7ff77b4db8-tx4mt       1/1       Running            0          18m
stellar-horizon-6cff98554b-d7djn    0/1       CrashLoopBackOff   8          18m
todkapmcbookpro:kubernetes todd$ kubectl logs stellar-horizon-6cff98554b-d7djn
Initializing Horizon database...
2019/05/02 12:58:09 connect failed: pq: database "stellar-horizon" does not exist
Horizon database initialization failed (possibly because it has been done before)
2019/05/02 12:58:09 pq: database "stellar-horizon" does not exist
todkapmcbookpro:kubernetes todd$ 

Horizo​​n Postgres DB pod 日志

todkapmcbookpro:kubernetes todd$ kubectl logs postgres-horizon-564d479db4-2xvqd
2019-05-02 12:40:06.424 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-05-02 12:40:06.424 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2019-05-02 12:40:06.437 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-05-02 12:40:06.444 UTC [23] LOG:  database system was interrupted; last known up at 2019-05-02 12:38:19 UTC
2019-05-02 12:40:06.453 UTC [23] LOG:  database system was not properly shut down; automatic recovery in progress
2019-05-02 12:40:06.454 UTC [23] LOG:  redo starts at 0/1636FB8
2019-05-02 12:40:06.454 UTC [23] LOG:  invalid record length at 0/1636FF0: wanted 24, got 0
2019-05-02 12:40:06.454 UTC [23] LOG:  redo done at 0/1636FB8
2019-05-02 12:40:06.459 UTC [1] LOG:  database system is ready to accept connections
2019-05-02 12:42:35.675 UTC [30] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:42:35.690 UTC [31] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:42:37.123 UTC [32] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:42:37.136 UTC [33] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:42:50.131 UTC [34] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:42:50.153 UTC [35] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:43:16.094 UTC [36] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:43:16.115 UTC [37] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:43:57.097 UTC [38] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:43:57.111 UTC [39] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:45:21.050 UTC [40] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:45:21.069 UTC [41] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:48:05.122 UTC [42] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:48:05.145 UTC [43] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:53:07.077 UTC [44] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:53:07.099 UTC [45] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:58:09.084 UTC [46] FATAL:  database "stellar-horizon" does not exist
2019-05-02 12:58:09.098 UTC [47] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:03:18.055 UTC [48] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:03:18.071 UTC [49] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:08:28.057 UTC [50] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:08:28.078 UTC [51] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:13:42.071 UTC [52] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:13:42.097 UTC [53] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:18:55.128 UTC [54] FATAL:  database "stellar-horizon" does not exist
2019-05-02 13:18:55.152 UTC [55] FATAL:  database "stellar-horizon" does not exist

如果 Horizo​​n 和 Core 的设置相同(特别是因为它与数据库配置 env 属性相关),那将是理想的。我想我的设置是正确的,但可能遗漏了一些细微的东西。

我有一个发生故障的 WIP 分支。我在这个分支中包含了一个快速设置脚本以及一个 minikube 设置。 https://github.com/todkap/stellar-testnet/tree/k8-deploy/kubernetes

我们能够解决并发表了一篇演示端到端流程的文章。 https://itnext.io/how-to-deploy-a-stellar-validator-on-kubernetes-with-helm-a111e5dfe437