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 27 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
  k8s:
    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
  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
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,710 points
81 views
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
68 views
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
44 views
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
289 views
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
792 views
+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
398 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.