AKS - Error from server (Forbidden): User cannot create resource "namespaces" in API group "" at the cluster scope

3/13/2020

I am trying to use the K8S through Azure AKS.

But when doing a simple command like: kubectl create namespace airflow

I get the following error message:

Error from server (Forbidden): namespaces is forbidden: User "xxx" cannot create resource "namespaces" in API group "" at the cluster scope

I have already commanded az aks get-credentials to connect to the cluster and then I try to create the namespace but without success.

-- Felipe FB
azure
azure-aks
azure-kubernetes
kubernetes

2 Answers

3/16/2020

In my case, this works when I use this command:

az aks get-credentials --resource-group <RESOURCE GROUP NAME> --name <AKS Cluster Name> --admin
-- Felipe FB
Source: StackOverflow

3/13/2020

You dont have sufficient privileges to create namespace in the k8s cluster though you have access to the cluster

Check the below command to know if you have permission to create namespace

# kubectl auth can-i create namespace
yes
-- P Ekambaram
Source: StackOverflow