- Kubernetes Cookbook
- Hideto Saito Hui Chuan Chloe Lee Ke Jou Carol Hsu
- 124字
- 2025-04-04 17:06:46
Maintaining the Ansible inventory
In order to perform the Ansible playbook, you need to maintain your own inventory file, which contains target machine IP addresses:
- There is a sample inventory file under the inventory directory, so you can copy it by using the following:
//copy sample to mycluster
ansible_machine$ cp -rfp inventory/sample inventory/mycluster
//edit hosts.ini
ansible_machine$ vi inventory/mycluster/hosts.ini
- In this cookbook, we are using target machines that have the following IP addresses:
- Kubernetes master : 10.128.0.2
- Kubernetes node : 10.128.0.4
- In this case, hosts.ini should be in the following format:
- Please change the IP address to match your environment.
Note that hostname (my-master-1 and my-node-1) will be set by the kubespray playbook based on this hosts.ini, so feel free to assign a meaningful hostname.