[英]traefik, bare-metal kubernetes : secret doesnt exist
我正在裸機(v1.10.2)和最新traefik(v1.6.2)上使用kubernetes作為入口。 我想啟用traefik路由到httpS服務時看到以下問題。 Error configuring TLS for ingress default/cheese: secret default/traefik-cert does not exist
秘密存在! 為什么它報告沒有?
根據評論:traefik服務帳戶無法訪問秘密。 但是我不明白為什么。
詳細信息如下:
kubectl get secret dex-tls -oyaml --as gem-lb-traefik
Error from server (Forbidden): secrets "dex-tls" is forbidden: User "gem-lb-traefik" cannot get secrets in the namespace "default"
$ kubectl describe clusterrolebinding gem-lb-traefik
Name: gem-lb-traefik
Labels: <none>
Annotations: <none>
Role:
Kind: ClusterRole
Name: gem-lb-traefik
Subjects:
Kind Name Namespace
---- ---- ---------
ServiceAccount gem-lb-traefik default
$ kubectl describe clusterrole gem-lb-traefik
Name: gem-lb-traefik
Labels: <none>
Annotations: <none>
PolicyRule:
Resources Non-Resource URLs Resource Names Verbs
--------- ----------------- -------------- -----
endpoints [] [] [get list watch]
pods [] [] [get list watch]
secrets [] [] [get list watch]
services [] [] [get list watch]
ingresses.extensions [] [] [get list watch]
我仍然不明白為什么我會從服務帳戶中收到秘密無法訪問的錯誤
首先,在這種情況下,您不能使用--as gem-lb-traefik
密鑰來檢查對機密的訪問,因為它試圖以用戶 gem-lb-traefik
身份運行命令,但是您沒有這樣的用戶,只能有ClusterRole ServiceAccount gem-lb-traefik
。 此外,對任何不存在的用戶使用--as <user>
鍵會提供與您類似的錯誤:
Error from server (Forbidden): secrets "<secretname>" is forbidden: User "<user>" cannot get secrets in the namespace "<namespace>"
因此,正如@IgnacioMillán所述,您需要檢查Traefik的設置並根據官方文檔進行修復。 您可能錯過了Traefik DaemonSet描述中的ServiceAccount。 另外,您需要檢查Traefik DaemonSet是否與使用ClusterRoleBinding的ServiceAccount位於相同的命名空間中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.