我使用this repo使用Terraform创建了一个AWS EKS集群。现在,我尝试在this guide
之后添加一个ALB kubernetes入口控制器一切正常,直到我尝试添加kubernetes集群角色为止。然后我得到这个错误:
kubernetes_cluster_role.alb-ingress:正在创建...
错误:发布 “ https://E8475B1B3693C979073BF0D721D876A7.sk1.ap-southeast-1.eks.amazonaws.com/apis/rbac.authorization.k8s.io/v1/clusterroles”: 拨打tcp:查询 E8475B1B3693C979073BF0D721D876A7.sk1.ap-southeast-1.eks.amazonaws.com 在127.0.0.53:53上:没有这样的主机
在main.tf第6行的资源“ kubernetes_cluster_role”中 “ alb-ingress”:6:资源“ kubernetes_cluster_role”“ alb-ingress” {
在所有其他基础结构都就绪的情况下(或没有,我得到相同的错误),这是我产生错误的最少代码。
provider "aws" {
region = "ap-southeast-1"
version = "~> 2.65.0"
}
resource "kubernetes_cluster_role" "alb-ingress" {
metadata {
name = "alb-ingress-controller"
labels = {
"app.kubernetes.io/name" = "alb-ingress-controller"
}
}
rule {
api_groups = ["", "extensions"]
resources = ["configmaps", "endpoints", "events", "ingresses", "ingresses/status", "services"]
verbs = ["create", "get", "list", "update", "watch", "patch"]
}
rule {
api_groups = ["", "extensions"]
resources = ["nodes", "pods", "secrets", "services", "namespaces"]
verbs = ["get", "list", "watch"]
}
}
答案 0 :(得分:0)
在为kubernetes入口控制器运行单独的Terraman清单之前,需要将strings
在本地复制到kubeconfig
。还要在eks群集资源中设置~/.kube/config