# Need help creating a namespace on an existing AKS cluster on Ansible Automation Portal

**URL:** <https://forum.ansible.com/t/need-help-creating-a-namespace-on-an-existing-aks-cluster-on-ansible-automation-portal/43588>\
**Category:** Get Help\
**Tags:** windows, aap\
**Created:** [June 26, 2025, 7:09pm UTC](https://forum.ansible.com/t/need-help-creating-a-namespace-on-an-existing-aks-cluster-on-ansible-automation-portal/43588 "2025-06-26T19:09:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ab28](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@ab28](https://forum.ansible.com/u/ab28)\
**Post date:** [June 26, 2025, 7:09pm UTC](https://forum.ansible.com/t/need-help-creating-a-namespace-on-an-existing-aks-cluster-on-ansible-automation-portal/43588/1 "2025-06-26T19:09:55Z")

</div>

Hi, first-time ansible user here. I’m trying to create a playbook that creates a namespace in an existing AKS cluster. I see tutorials about locally creating a namespace using ansible, but for those, your AKS cluster/kubeconfig file is already in path. I’m wondering how I can do this on AAP, I’m not exactly sure what my playbook should look like. I’d really appreciate if anyone could point me in the right direction!

---

<div class="post-metadata">

**Author:** ![anon81884396](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon81884396](https://forum.ansible.com/u/anon81884396)\
**Post date:** [June 26, 2025, 10:54pm UTC](https://forum.ansible.com/t/need-help-creating-a-namespace-on-an-existing-aks-cluster-on-ansible-automation-portal/43588/2 "2025-06-26T22:54:18Z")

</div>

There are several options you can approach this with. You could encrypt the kube config file using Ansible vault and have a pre-step in your playbook to decrypt. You could also create a new Credential Type in AAP (I assume it has this since it’s based on AWX) that is just your kubeconfig file. [11. Custom Credential Types — Ansible Tower User Guide v3.8.6](https://docs.ansible.com/ansible-tower/latest/html/userguide/credential_types.html) You’d then create a credential of this type containing your kubeconfig file and you can have your playbook copy it from the credential variable to a file that you’d then reference for your k8s commands in your play. [kubernetes.core.k8s module – Manage Kubernetes (K8s) objects — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html#parameter-kubeconfig) you may be able to reference the variable directly in some way, not sure, maybe someone else has.
