Kubespray inventory.ini Examples
inventory.ini Overview
The Kubespray inventory.ini file is composed of several key groups:
- kube_control_plane: list of servers where Kubernetes control plane components (apiserver, scheduler, controller) will run
 - kube_node: list of Kubernetes nodes where the pods will run
 - etcd: list of servers to compose the etcd server.
 - etcd: typically includes kube_control_plane for stacked etcd topology
 
Please following these links for YAML examples and depending on your preferred topology:
- Kubespray inventory.ini Examples
 - All-In-One Node
 - One Control Plane Node with Multiple Worker Nodes
 - Multiple Control Plane Nodes with Multiple Worker Nodes
 
All-In-One Node
Topology
- node1 - is a single control plane + etcd node
 - node1 - is also running the pods
 
Pros
- Easy to manage
 
Cons
- Single point of failure for K8s/etcd/pods;
 - Thinner security barrier since pods are running on control plane / etcd nodes;
 
Example Inventory File
[kube_control_plane]node1 ansible_host=95.54.0.12  # ip=10.3.0.1 etcd_member_name=etcd1
[etcd:children]kube_control_plane
[kube_node]node1 ansible_host=95.54.0.12  # ip=10.3.0.1One Control Plane Node with Multiple Worker Nodes
Topology
- node1 - single control plane + etcd node
 - node2..N - kube nodes where the pods will run
 
Pros
- Better security barrier since pods aren’t running on control plane / etcd nodes
 - Can scale by adding either more control plane nodes or worker nodes
 
Cons
- Single point of failure only for K8s/etcd but not the pods
 
Example Inventory File
[kube_control_plane]node1 ansible_host=95.54.0.12  # ip=10.3.0.1 etcd_member_name=etcd1
[etcd:children]kube_control_plane
[kube_node]node2 ansible_host=95.54.0.13  # ip=10.3.0.2node3 ansible_host=95.54.0.14  # ip=10.3.0.3Multiple Control Plane Nodes with Multiple Worker Nodes
Topology
- Nodes 1-3 - the control plane + etcd nodes; (This makes K8s High Available)
 - Node 4-N - the kube nodes on which the Pods will run
 
Pros
- Highly available control plane / etcd
 - Better security barrier since pods aren’t running on control plane / etcd nodes
 - Can scale by adding either more control plane nodes or worker nodes
 
Cons
- More complex environment makes its configuration & management more difficult
 
Example Inventory File
[kube_control_plane]node1 ansible_host=95.54.0.12  # ip=10.3.0.1 etcd_member_name=etcd1node2 ansible_host=95.54.0.13  # ip=10.3.0.2 etcd_member_name=etcd2node3 ansible_host=95.54.0.14  # ip=10.3.0.3 etcd_member_name=etcd3
[etcd:children]kube_control_plane
[kube_node]node4 ansible_host=95.54.0.15  # ip=10.3.0.4node5 ansible_host=95.54.0.16  # ip=10.3.0.5node6 ansible_host=95.54.0.17  # ip=10.3.0.6