简体   繁体   English

GKE traefik无法创建rbac权限

[英]GKE traefik fails to create rbac permissions

I am trying to install traefik as an ingress controller on GKE (google cloud kubernetes engine) and when I try: 我试图在GKE (谷歌云kubernetes引擎)上安装traefik作为入口控制器,当我尝试:

kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml

I have this error: 我有这个错误:

Error from server (Forbidden): error when creating " https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml ": clusterroles.rbac.authorization.k8s.io "traefik-ingress-controller" is forbidden: attempt to grant extra privileges: [PolicyRule{APIGroups:[""], Resources:["services"], Verbs:["get"]} PolicyRule{APIGroups:[""], Resources:["services"], Verbs:["list"]} PolicyRule{APIGroups:[""], Resources:["services"], Verbs:["watch"]} PolicyRule{APIGroups:[""], Resources:["endpoints"], Verbs:["get"]} PolicyRule{APIGroups:[""], Resources:["endpoints"], Verbs:["list"]} PolicyRule{APIGroups:[""], Resources:["endpoints"], Verbs:["watch"]} PolicyRule{APIGroups:[""], Resources:["secrets"], Verbs:["get"]} PolicyRule{APIGroups:[""], Resources:["secrets"], Verbs:["list"]} PolicyRule{APIGroups:[""], Resources:["secrets"], Verbs:["watch"]} PolicyRule{APIGroups:["extensions"], Resources:["ingresses"], Verbs:["get"]} PolicyRule{APIGroups:["extensions"], Resources:["ingres 服务器出错(禁止):创建“ https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml ”时出错:clusterroles.rbac.authorization.k8s.io“traefik- “ingress-controller”是禁止的:尝试授予额外的权限:[PolicyRule {APIGroups:[“”],Resources:[“services”],动词:[“get”]} PolicyRule {APIGroups:[“”],资源: [“services”],动词:[“list”]} PolicyRule {APIGroups:[“”],资源:[“services”],动词:[“watch”]} PolicyRule {APIGroups:[“”],资源: [“endpoints”],动词:[“get”]} PolicyRule {APIGroups:[“”],资源:[“endpoints”],动词:[“list”]} PolicyRule {APIGroups:[“”],资源: [“endpoints”],动词:[“watch”]} PolicyRule {APIGroups:[“”],资源:[“secrets”],动词:[“get”]} PolicyRule {APIGroups:[“”],资源: [“secrets”],动词:[“list”]} PolicyRule {APIGroups:[“”],资源:[“secrets”],动词:[“watch”]} PolicyRule {APIGroups:[“extensions”],资源:[“ingresses”],动词:[“get”]} PolicyRule {APIGroups:[“extensions”],资源:[“ingres ses"], Verbs:["list"]} PolicyRule{APIGroups:["extensions"], Resources:["ingresses"], Verbs:["watch"]}] user=&{IzoPi4a@gmail.com [system:authenticated] map[user-assertion.cloud.google.com:[ADKE0IBz9kwSuZRZkfbLil8iC/ijcmJJmuys2DvDGxoxQ5yP6Pdq1IQs3JRwDmd/lWm2vGdMXGB4h1QKiwx+3uV2ciTb/oQNtkthBvONnVp4fJGOSW1S+8O8dqvoUNRLNeB5gADNn1TKEYoB+JvRkjrkTOxtIh7rPugLaP5Hp7thWft9xwZqF9U4fgYHnPjCdRgvMrDvGIK8z7ONljYuStpWdJDu7LrPpT0L]]} ownerrules=[PolicyRule{APIGroups:["authorization.k8s.io"], Resources:["selfsubjectaccessreviews" "selfsubjectrulesreviews"], Verbs:["create"]} PolicyRule{NonResourceURLs:["/api" "/api/ " "/apis" "/apis/ " "/healthz" "/openapi" "/openapi/ " "/swagger-2.0.0.pb-v1" "/swagger.json" "/swaggerapi" "/swaggerapi/ " "/version" "/version/"], Verbs:["get"]}] ruleResolutionErrors=[] ses“],动词:[”list“]} PolicyRule {APIGroups:[”extensions“],资源:[”ingresses“],动词:[”watch“]}] user=&{IzoPi4a@gmail.com [system :验证]图[user-assertion.cloud.google.com:[ADKE0IBz9kwSuZRZkfbLil8iC / ijcmJJmuys2DvDGxoxQ5yP6Pdq1IQs3JRwDmd / lWm2vGdMXGB4h1QKiwx + 3uV2ciTb / oQNtkthBvONnVp4fJGOSW1S + 8O8dqvoUNRLNeB5gADNn1TKEYoB + JvRkjrkTOxtIh7rPugLaP5Hp7thWft9xwZqF9U4fgYHnPjCdRgvMrDvGIK8z7ONljYuStpWdJDu7LrPpT0L]]} ownerrules = [{PolicyRule APIGroups:[ “authorization.k8s.io”],资源:[“selfsubjectaccessreviews”“selfsubjectrulesreviews”],动词:[“create”]} PolicyRule {NonResourceURLs:[“/ api”“/ api / ”“/ apis”“/ apis / ”“/ healthz”“/ openapi”“ / openapi / “” / swagger- 2.0.0.pb-v1“”/ swagger.json“”/ swaggerapi“”/ swaggerapi / “”/ version“”/ version /“],动词:[”get“]} ] ruleResolutionErrors = []

The problem is this part only, the other one is created successfully: 问题是这一部分,另一个是成功创建的:

kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: traefik-ingress-controller
rules:
  - apiGroups:
      - ""
    resources:
      - services
      - endpoints
      - secrets
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - extensions
    resources:
      - ingresses
    verbs:
      - get
      - list
      - watch

Based on docs ( https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control ) I tried executing this command but I still get the same error 基于文档( https://cloud.google.com/kubernetes-engine/docs/how-to/role-based-access-control )我尝试执行此命令,但我仍然得到相同的错误

kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=MY_EMAIL_THAT_I_LOGIN_INTO_GCP

Has anyone ever manage to fix this? 有没有人设法解决这个问题? or it just does not work ? 或者它只是不起作用?

I am trying to make a kubernetes cluster without loadBalancer in order to be cheap on my local machine (minikube), I have no such problems. 我想在没有loadBalancer的情况下制作一个kubernetes集群,以便在我的本地机器(minikube)上便宜,我没有这样的问题。

So for everyone who is trying to install traefik on GKE, and you get stuck with that error message, just do that first https://stackoverflow.com/a/46316672/1747159 所以对于那些试图在GKE上安装traefik的人来说,你会遇到这个错误信息,那就先这样做吧https://stackoverflow.com/a/46316672/1747159

# Get password value
$ gcloud container clusters describe CUSTER_NAME --zone ZONE_NAME | grep password

# Pass username and password parameters
$ kubectl apply -f https://raw.githubusercontent.com/containous/traefik/master/examples/k8s/traefik-rbac.yaml --username=admin --password=PASSWORD

Thanks Nicola Ben for helping me figure it out 感谢Nicola Ben帮我搞清楚

The main problem here is that your current user has not enough rights to do this. 这里的主要问题是您当前的用户没有足够的权限来执行此操作。 To create the necessary binding: 要创建必要的绑定:

kubectl create clusterrolebinding cluster-admin-binding \                                               
    --clusterrole=cluster-admin \
    --user=$(gcloud config get-value core/account)

Thanks to istio for the idea. 感谢istio的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM