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!