clusterrolebindings.rbac.authorization.k8s.io is forbidden: User "system:anonymous" cannot create resource "clusterrolebindings"

164 views Asked by At

I am getting the below error where i creating the kubernetes cluster on AWS below are the files and code I am using.

"clusterrolebindings.rbac.authorization.k8s.io is forbidden: User "system:anonymous" cannot create resource "clusterrolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope"

I checked the solution, mostly it like a permission issue for the user but I checked my user has Administrator Access on AWS.

provider "aws" {
  region = var.region
}

provider "kubernetes" {
  host = module.eks.cluster_endpoint
  cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
}

data "aws_availability_zones" "available" {}

locals {
  cluster_name = "demo-eks-${random_string.suffix.result}"
}

resource "random_string" "suffix" {
  length = 8
  special = false
}
 
resource "kubernetes_cluster_role_binding" "example" {
  metadata {
    name = "fabric8-rbac"
  }
  role_ref {
    api_group = "rbac.authorization.k8s.io"
    kind      = "ClusterRole"
    name      = "cluster-admin"
  }
  subject {
    kind      = "ServiceAccount"
    name      = "default"
    namespace = "default"
  }
} 

I checked the solution, mostly it like a permission issue for the user but I checked my user has Administrator Access on AWS.

0

There are 0 answers