This directory contains an Ansible inventory file for setting up a Kubernetes cluster using the kubespray project.
- Clone the Kubespray repository and checkout a specific release:
git clone https://github.com/kubernetes-sigs/kubespray --branch <version>
- Install Ansible:
VENVDIR=kubespray-venv KUBESPRAYDIR=kubespray python3 -m venv $VENVDIR source $VENVDIR/bin/activate cd $KUBESPRAYDIR pip install -U -r requirements.txt
- Navigate to the cloned
kubespray
directory in this project:# Copy ``inventory/sample`` as ``inventory/mycluster`` cp -rfp inventory/sample inventory/mycluster # Update Ansible inventory file with inventory builder declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5) CONFIG_FILE=inventory/mycluster/hosts.yaml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
NOTE:
- the IPs should match the configuration from Ansible config and Terrafrom config
- kubespray inventory will rename the hostnames of your machines so match it from generated "node"
- Modify the cluster variables according to your cluster requirements.
- Run the following command from the root directory of this project:
ansible-playbook -i ../proxmox cluster.yaml
For more detailed information, please refer to the Kubespray documentation and Ansible documentation for additional customization options.