You can also create a kubernetes namespace using the Kubernetes module of Ansible.
- name: Create a kubernetes namespace
kubernetes:
api_endpoint: specify-endpoint #specify the endpoint
url_username: admin #username
url_password: samplepass #password for your username
file_reference: /path-create-namespace.yaml #the location where you wish to create the namespace
state: present