A script to configure local Kubernetes cluster using Kubespray on Vagrant/Virtualbox
Clone kubespray repo:
git clone git@github.com:kubernetes-sigs/kubespray.git
cd kubespray
Optionally, set the kubespray version:
git checkout v2.10.3
Download and run setup-kubespray.sh
curl -LO https://raw.githubusercontent.com/TomaszKlosinski/setup-kubespray/master/setup-kubespray.sh
chmod +x setup-kubespray.sh
./setup-kubespray.sh
The script will produce an admin token to access the dashboard. Please copy it and paste into: https://10.0.20.101:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login
To access the cluster with Kubernetes client, ssh to the first master and use kubectl there:
vagrant ssh kub-1
kubectl version
Alternatively, use local kubectl fetched by the script:
inventory/lab/artifacts/kubectl.sh version
Or set system-wide kubectl to access this cluster pernamently:
cp inventory/lab/artifacts/kubectl-binary /usr/local/bin/kubectl (or brew install kubernetes-cli)
ln -s inventory/lab/artifacts/admin.conf ~/.kube/config
kubectl version
To kill the cluster:
vagrant destroy --force