Run it
docker build -t kubespray .
docker run -v $(pwd)/inventory:/kubespray/inventory/local/ kubespray ansible-playbook -i inventory/local/hosts.ini --become --become-user=root cluster.yml
If you require sudo pass
docker run -v $(pwd)/inventory:/kubespray/inventory/local/ --mount type=bind,source=$(echo ~)/.ssh/id_rsa,target=/root/.ssh/id_rsa kubespray ansible-playbook -i inventory/local/hosts.ini --become --become-user=root --ask-become-pass cluster.yml
Interaktiv
docker run -it -v $(pwd)/inventory:/kubespray/inventory/local/ --mount type=bind,source=$(echo ~)/.ssh/id_rsa,target=/root/.ssh/id_rsa kubespray bash
eval "$(ssh-agent -s)"
ssh-add
ansible -i inventory/local/hosts.ini all -m ping
ansible-playbook -i inventory/local/hosts.ini --become --become-user=root --ask-become-pass cluster.yml
Documentation
https://kubespray.io/#/
Source git repo
https://github.com/kubernetes-sigs/kubespray
if ansible fails with {"attempts": 4, "changed": false, "msg": "No package matching 'aufs-tools' is available"}
you need to run "sudo add-apt-repository universe"
Alt: ansible -i inventory/local/hosts.ini -m command -a "add-apt-repository universe" k8s-cluster --become --become-user root --ask-sudo-pass --user superuser