下面是操作员的问题。默认清单应用于Kubernetes集群(托管在-prem上),如下所示:https://github.com/zalando/postgres-operator/tree/4a099d698d641b80c5aeee5bee925921b7283489/manifests
验证了操作符名称、configmap或服务帐户定义中是否存在任何问题,但找不出多少问题。
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这里有什么帮助吗?
发布于 2019-10-28 13:31:24
我已经在我的环境中设置了postgres-operator,它在我的情况下运行得很好。请确保您遵循了以下步骤:
克隆postgres-operator回购:
$ git clone https://github.com/zalando/postgres-operator
$ cd postgres-operatorZalando的操作符可以通过两种方式配置--使用经典的configmap或使用CRD配置对象,后者更强大:
$ 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中的最后几行代码,使其读到:
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中的。这些是必须设置的值:
configuration:
kubernetes:
pod_environment_configmap: postgres-pod-config
pod_service_account_name: zalando-postgres-operator让我们创建操作符和它的配置。
$ kubectl create -f manifests/postgres-operator.yaml
deployment.apps/postgres-operator created在输入以下命令之前,请等待几分钟:
$ kubectl create -f postgresql-operator-default-configuration.yaml
operatorconfiguration.acid.zalan.do/postgresql-operator-default-configuration created现在,您将能够看到您的POD运行:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
postgres-operator-599fd68d95-c8z67 1/1 Running 0 21m你也可以参考这个文章,希望它能帮助你。
https://stackoverflow.com/questions/58545727
复制相似问题