【发布时间】:2020-11-27 23:07:34
【问题描述】:
我刚刚尝试在 Ubuntu 20.04 上的 minikube 中使用 Helm 安装 timescaleDB Single。
安装后通过:
helm install timescaledb timescaledb/timescaledb-single --namespace espace-client-v2
我收到了消息:
➜ ~ helm install timescaledb timescaledb/timescaledb-single --namespace espace-client-v2
NAME: timescaledb
LAST DEPLOYED: Fri Aug 7 17:17:59 2020
NAMESPACE: espace-client-v2
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
TimescaleDB can be accessed via port 5432 on the following DNS name from within your cluster:
timescaledb.espace-client-v2.svc.cluster.local
To get your password for superuser run:
# superuser password
PGPASSWORD_POSTGRES=$(kubectl get secret --namespace espace-client-v2 timescaledb-credentials -o jsonpath="{.data.PATRONI_SUPERUSER_PASSWORD}" | base64 --decode)
# admin password
PGPASSWORD_ADMIN=$(kubectl get secret --namespace espace-client-v2 timescaledb-credentials -o jsonpath="{.data.PATRONI_admin_PASSWORD}" | base64 --decode)
To connect to your database, chose one of these options:
1. Run a postgres pod and connect using the psql cli:
# login as superuser
kubectl run -i --tty --rm psql --image=postgres \
--env "PGPASSWORD=$PGPASSWORD_POSTGRES" \
--command -- psql -U postgres \
-h timescaledb.espace-client-v2.svc.cluster.local postgres
# login as admin
kubectl run -i --tty --rm psql --image=postgres \
--env "PGPASSWORD=$PGPASSWORD_ADMIN" \
--command -- psql -U admin \
-h timescaledb.espace-client-v2.svc.cluster.local postgres
2. Directly execute a psql session on the master node
MASTERPOD="$(kubectl get pod -o name --namespace espace-client-v2 -l release=timescaledb,role=master)"
kubectl exec -i --tty --namespace espace-client-v2 ${MASTERPOD} -- psql -U postgres
它似乎安装得很好。
但是,当执行时:
PGPASSWORD_POSTGRES=$(kubectl get secret --namespace espace-client-v2 timescaledb-credentials -o jsonpath="{.data.PATRONI_SUPERUSER_PASSWORD}" | base64 --decode)
Error from server (NotFound): secrets "timescaledb-credentials" not found
在那之后,我意识到 pod 甚至还没有创建,它给了我以下错误
MountVolume.SetUp failed for volume "certificate" : secret "timescaledb-certificate" not found
Unable to attach or mount volumes: unmounted volumes=[certificate], unattached volumes=[storage-volume wal-volume patroni-config timescaledb-scripts certificate socket-directory timescaledb-token-svqqf]: timed out waiting for the condition
我该怎么办?
【问题讨论】:
-
要使用 kubectl 获取密码,您必须先创建密码。您是否创建了 secrets.yaml 模板来管理密码。? T
-
不,我没有。
-
那么请创建它。这是为了生产吗?如果是这样,我不建议您在值中管理您的秘密,因为任何人都可以访问它。但是,您可以手动创建机密,并再次对其进行 base64 编码。有像 Hashicorp 保险库这样的生产级秘密管理系统,你可以考虑使用它。
-
好的,我周一试试。我应该只把这两个变量放在里面?
-
是的。只有密码。干杯。
标签: kubernetes kubernetes-helm timescaledb