Create k8s namespace using ansible

0 votes
I'm trying to write an Ansible task to create k8s namespace. can you help me out? Thanks
Jun 11 in Ansible by Travis

edited Jun 11 314 views

2 answers to this question.

0 votes

Hey @Travus, you can use the k8s module of Ansible which is used to manage k8s objects. Have a look at this example to write a task to create a namespace for k8s:

- name: Create a k8s namespace
    name: Kubernetes
    api_version: v1
    kind: Namespace
    state: present
answered Jun 11 by Faiza
0 votes

You can also create a kubernetes namespace using the Kubernetes module of Ansible.

- name: Create a kubernetes namespace
    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
answered Jun 11 by Nasser

edited Jun 11

Related Questions In Ansible

0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,810 points
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
0 votes
1 answer

Create a directory at a specific path using ansible

To create a directory using Ansible, you ...READ MORE

answered Jan 9 in Ansible by Jason
0 votes
1 answer

Create directories and download files in Ansible using Ansible playbook

Hey @Yash,  you could either use file module ...READ MORE

answered Jan 24 in Ansible by Cerdin
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
+3 votes
1 answer
0 votes
1 answer
0 votes
2 answers

How to create MySQL tables using Ansible?

--- - hosts: dbserver   tasks:    - name: create a table ...READ MORE

answered Mar 19 in Ansible by Ankit Tyagi