[英]Setting up Traefik as Kubernetes Ingress on GCP
我正在嘗試遵循此Traefik用戶指南: https ://docs.traefik.io/user-guide/kubernetes/
用戶指南和我的設置之間的主要區別在於,該指南假定我在Minikube上,而我正在嘗試在Google Cloud Platform(GCP)上獲得此設置。 我是Kubernetes的新手,但是我認為我對基本原理有很好的了解。
無論如何,關於以上用戶指南中介紹的基於角色的訪問控制配置,我一直收到此錯誤:
來自服務器的錯誤(禁止):創建“ rbac.yml”時出錯:cl usterroles.rbac.authorization.k8s.io禁止“ traefik-ingress-controller”:嘗試授予額外的特權:[PolicyRule {資源:[“服務“],APIGroups:[”“],動詞:[” get“]} PolicyRule {資源ces:[”服務“],APIGroups:[”“],動詞:[” list“]} PolicyRule {資源:[”服務“],APIGroups:[”“],動詞:[” watch“]} PolicyRule {資源:[”端點“],APIGroups:[”“],動詞:[” get“]} PolicyRule {解決方法:[ “ endpoints”],APIGroups:[“”],動詞:[“ list”]} PolicyRule {資源:[“ endpoints”],APIGroups:[“”],動詞:[“ watch”]} PolicyRule {資源:[ “ secrets”],APIGroups:[“”],動詞:[“ get”]} PolicyRule {資源:[“ secrets”],APIGroups:[“”],動詞:[“ list”]} PolicyRule {資源:[ “ secrets”],APIGroups:[“”],動詞:[“ watch”]} PolicyRule {資源:[“ ingresses”],APIGroups:[“ extensions”],動詞:[“ get”]} PolicyRule {資源: [“入口”],APIGroups:[“擴展名]],動詞:[”列表“]} PolicyRule {資源:[”入口“]],APIGroups:[”擴展名 s“],動詞:[” watch“]}] user=&{evan@sherwood.io [system:authenti cated] map [authenticator:[GKE]]} ownerrules = [PolicyRule {資源:[” selfsubjectaccessreviews“]], APIGroups:[“ authorization.k8s.io”],動詞:[“ create”]} PolicyRule {資源:[“ selfsubjectrulesreviews”],APIGroups:[“ authorization.k8s.io”],動詞:[“ create”]} PolicyRule {NonResourceURLs:[“ / api”“ / api / ”“ / apis”“ / apis / ”“ / healthz”“ /swagger-2.0.0.pb-v1”“ /swagger.json”“ / swaggerapi”“ / swaggerapi / *“” /版本“],動詞:[” get“]}] ruleResolutionErrors = []
我感覺自己正在遇到特權升級預防和引導 ,但是我不確定要改變/執行什么才能克服此問題。
如您所參考的文檔所述,您需要升級用戶的權限,至少要達到允許更改RBAC規則的程度。
最簡單的方法是添加一個分配cluster-admin
權限的ClusterRoleBinding。 YAML將如下所示:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: megacorp-cluster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: john.doe@megacorp.com
YAML假定您在GKE上注冊的用戶電子郵件地址是john.doe@megacorp.com
。 在kubectl apply
該清單后,您應相應地擴展Traefik的RBAC規則。
請注意, cluster-admin
基本上是cluster-admin
的根用戶。 如果您打算進一步限制特權,則還可以有更多選擇權限。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.