我正在尝试使用 Terraform Helm 提供程序(https://www.terraform.io/docs/providers/helm/index.html https://www.terraform.io/docs/providers/helm/index.html)将工作负载部署到 GKE 集群。
我或多或少地遵循谷歌的例子 -https://github.com/GoogleCloudPlatform/terraform-google-examples/blob/master/example-gke-k8s-helm/helm.tf https://github.com/GoogleCloudPlatform/terraform-google-examples/blob/master/example-gke-k8s-helm/helm.tf,但我确实想通过手动创建服务帐户来使用 RBAC。
我的 helm.tf 看起来像这样:
variable "helm_version" {
default = "v2.13.1"
}
data "google_client_config" "current" {}
provider "helm" {
tiller_image = "gcr.io/kubernetes-helm/tiller:${var.helm_version}"
install_tiller = false # Temporary
kubernetes {
host = "${google_container_cluster.data-dome-cluster.endpoint}"
token = "${data.google_client_config.current.access_token}"
client_certificate = "${base64decode(google_container_cluster.data-dome-cluster.master_auth.0.client_certificate)}"
client_key = "${base64decode(google_container_cluster.data-dome-cluster.master_auth.0.client_key)}"
cluster_ca_certificate = "${base64decode(google_container_cluster.data-dome-cluster.master_auth.0.cluster_ca_certificate)}"
}
}
resource "helm_release" "nginx-ingress" {
name = "ingress"
chart = "stable/nginx-ingress"
values = [<<EOF
rbac:
create: false
controller:
stats:
enabled: true
metrics:
enabled: true
service:
annotations:
cloud.google.com/load-balancer-type: "Internal"
externalTrafficPolicy: "Local"
EOF
]
depends_on = [
"google_container_cluster.data-dome-cluster",
]
}
我收到以下错误:
Error: Error applying plan:
1 error(s) occurred:
* module.data-dome-cluster.helm_release.nginx-ingress: 1 error(s) occurred:
* helm_release.nginx-ingress: error creating tunnel: "pods is forbidden: User \"client\" cannot list pods in the namespace \"kube-system\""
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
在我手动创建 Helm RBAC 并安装 Tiller 后,会发生这种情况。
我之前也尝试设置“install_tiller=true”,安装 Tiller 时出现完全相同的错误
“kubectl get pods”工作没有任何问题。
这个用户“client”是什么?为什么禁止它访问集群?
Thanks