Service account create namespace aks cluster

Diana Marcela Cabal Herrera 0 Reputation points
2024-03-14T19:31:04.02+00:00
Good afternoon, I have a question, I currently need an AKS service account to create a namespace for me, would this be possible? What would be the YAML example?
Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,456 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anveshreddy Nimmala 3,550 Reputation points Microsoft External Staff Moderator
    2024-03-15T05:00:34.3366667+00:00

    Hello Diana Marcela Cabal Herrera,

    Welcome to microsoft Q&A, Thankyou for posting your query here.

    Yes you require a service account can be used to create a namespace, provided that the service account has the necessary permissions.

    Create a service account with permissions that include the ability to create namespaces.

    Use the following command to create a service account for default namespace

    kubectl create serviceaccount <service account name>

                           or 
    

    use this yaml file to create service account.

    apiVersion: v1
    kind: ServiceAccount
    metadata:
    # The name and namespace of the Service Account
      name: my-serviceaccount
      namespace: my-namespace
    

    Later apply this using

    kubectl apply -f <filename>

    You need to set up a Role or ClusterRole with the required permissions and then bind that to your service account using a RoleBinding or ClusterRoleBinding.

    Configure your tools to use the service account. For example, you would configure "kubectl" to use the context that includes your service account.

    please refer this documentations for creating and managing service account.

    https://kubernetes.io/docs/concepts/security/service-accounts/

    https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/

    https://kubernetes.io/docs/reference/access-authn-authz/rbac/

    Hope this is helps you,

    If an answer has been helpful, please consider accepting the answer to help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!5f934d13-ecfe-4fa5-88da-6442fe1a536d

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.