User "client" cannot create replicationcontrollers in the namespace "default"

12/20/2018

On trying to create a replication controller on a cluster in GKE using terraform, I get this error:

kubernetes_replication_controller.k8_pod: Failed to create replication controller: replicationcontrollers is forbidden: User "client" cannot create replicationcontrollers in the namespace "default"

I have kubectl configured and have tested it by creating pods/replication controllers on google kubernetes engine. I have also tried to use gcloud config unset container/use_client_certificate as some resources suggest: Resource 1 Resource 2

The resource provisioning code sample is as follows:

resource "kubernetes_replication_controller" "k8_pod" {
    metadata {
        name = "testing-deployment"
        labels {
            App = "wassup"
        }
    }

    spec {
        selector {
            App = "wassup"
        }

        template {
            container {
                image = "image/name/here"
                name  = "testing-deployment"

                port {
                    container_port = 8080
                }
            }
        }
    }
}
-- Arko Chakraborti
google-cloud-platform
google-kubernetes-engine
kubernetes
terraform

0 Answers