Kubespray Hosts.Yaml Examples
Hosts.Yaml Overview
The Kubespray hosts.yaml inventory file is composed of 3 groups:
- kube_node: list of Kubernetes nodes where the pods will run.
- kube_control_plane: list of servers where Kubernetes control plane components (apiserver, scheduler, controller) will run.
- etcd: list of servers to compose the etcd server. You should have at least 3 servers for failover purpose.
Please following these links for YAML examples and depending on your preferred topology:
- Kubespray Hosts.Yaml Examples
- All-In-One Node
- One Control Plane Node with Multiple Worker Nodes
- Multiple Control Plane Nodes with Multiple Work 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 Hosts.yaml File
One 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 Hosts.yaml File
Multiple Control Plane Nodes with Multiple Work 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