- A few tools are needed, make sure they are installed:
- Vagrant
- Ansible
- VirtualBox
- Make sure to add the following block to
/etc/vbox/networks.conf
, otherwise Vagrant will run into an error. We need this because our nodes are in the10.0.0.0/16
network and our pods are using the192.168.0.0/16
network.
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
- Install required collections from Ansible Galaxy:
ansible-galaxy collection install -r requirements.yaml
To bring up the cluster, run
vagrant up --provision
Cleanup after you're done:
vagrant destroy -f
Since kubectl
needs to be configured to connect to our cluster, we need the appropriate config file on our local machine.
During the setup of the master, this config is copied to the current working directory.
export KUBECONFIG=kubeconfig
kubectl config view
kubectl get nodes -o wide
Access to the dashboard is managed through a user called admin-user
. Run the following steps to generate a token and allow access to the dashboard:
kubectl -n kubernetes-dashboard create token admin-user
kubectl proxy
Then visit http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ and paste the token there.
Now we can finally deploy something. If you don't know what, then take a look at the socks-shop.
kubectl create namespace sock-shop
kubectl apply -f https://raw.githubusercontent.com/microservices-demo/microservices-demo/master/deploy/kubernetes/complete-demo.yaml
You can connect to a machine by running vagrant ssh master|worker-1|worker-2|worker-3
.
There is one master and N worker nodes, by default we create 3 workers.
You can change this variable in the Vagrantfile
.