首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Zalando postgres运算符发出config

Zalando postgres运算符发出config
EN

Stack Overflow用户
提问于 2019-10-24 16:41:34
回答 1查看 1.4K关注 0票数 0

下面是操作员的问题。默认清单应用于Kubernetes集群(托管在-prem上),如下所示:https://github.com/zalando/postgres-operator/tree/4a099d698d641b80c5aeee5bee925921b7283489/manifests

验证了操作符名称、configmap或服务帐户定义中是否存在任何问题,但找不出多少问题。

代码语言:javascript
复制
kubectl logs -f postgres-operator-944b9d484-9h796
2019/10/24 16:31:02 Spilo operator v1.2.0
2019/10/24 16:31:02 Fully qualified configmap name: default/postgres-operator
panic: configmaps "postgres-operator" is forbidden: User "system:serviceaccount:default:zalando-postgres-operator" cannot get resource "configmaps" in API group "" in the namespace "default"
goroutine 1 [running]:
github.com/zalando/postgres-operator/pkg/controller.(*Controller).initOperatorConfig(0xc0004a6000)
    /root/go/src/github.com/zalando/postgres-operator/pkg/controller/controller.go:102 +0x687
github.com/zalando/postgres-operator/pkg/controller.(*Controller).initController(0xc0004a6000)
    /root/go/src/github.com/zalando/postgres-operator/pkg/controller/controller.go:253 +0x825
github.com/zalando/postgres-operator/pkg/controller.(*Controller).Run(0xc0004a6000, 0xc000464660, 0xc000047a70)
    /root/go/src/github.com/zalando/postgres-operator/pkg/controller/controller.go:348 +0x2f
main.main()
    /workspace/cmd/main.go:82 +0x256

这里有什么帮助吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-28 13:31:24

我已经在我的环境中设置了postgres-operator,它在我的情况下运行得很好。请确保您遵循了以下步骤:

克隆postgres-operator回购:

代码语言:javascript
复制
$ git clone https://github.com/zalando/postgres-operator
$ cd postgres-operator

Zalando的操作符可以通过两种方式配置--使用经典的configmap或使用CRD配置对象,后者更强大:

代码语言:javascript
复制
$ kubectl create -f manifests/operator-service-account-rbac.yaml 
serviceaccount/zalando-postgres-operator created
clusterrole.rbac.authorization.k8s.io/zalando-postgres-operator created
clusterrolebinding.rbac.authorization.k8s.io/zalando-postgres-operator created

为了使用CRD配置,您必须在postgres-operator本身中更改一个值。更改manifests/postgres-operator.yaml中的最后几行代码,使其读到:

代码语言:javascript
复制
env:
# provided additional ENV vars can overwrite individual config map entries
#- name: CONFIG_MAP_NAME
#  value: "postgres-operator"
# In order to use the CRD OperatorConfiguration instead, uncomment these lines and comment out the two lines above
- name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT
  value: postgresql-operator-default-configuration

该文件中给出的服务帐户名称与运算符服务帐户定义中给出的名称不匹配,因此必须调整和创建引用的实际配置对象。这是放在manifests/postgresql-operator-default-configuration.yaml中的。这些是必须设置的值:

代码语言:javascript
复制
configuration:
  kubernetes:
    pod_environment_configmap: postgres-pod-config
    pod_service_account_name: zalando-postgres-operator

让我们创建操作符和它的配置。

代码语言:javascript
复制
$ kubectl create -f manifests/postgres-operator.yaml 
deployment.apps/postgres-operator created

在输入以下命令之前,请等待几分钟:

代码语言:javascript
复制
$ kubectl create -f postgresql-operator-default-configuration.yaml 
operatorconfiguration.acid.zalan.do/postgresql-operator-default-configuration created

现在,您将能够看到您的POD运行:

代码语言:javascript
复制
$ kubectl get pods
NAME                                 READY   STATUS    RESTARTS   AGE
postgres-operator-599fd68d95-c8z67   1/1     Running   0          21m

你也可以参考这个文章,希望它能帮助你。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58545727

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档