Kubernetes local stack based on CentOS 7 build with Vagrant and Ansible on VirtualBox VMs
Run local stack of kubernetes for testing multi node network policies. Kubernetes nodes are hardened using ansible role based on RedHatOfficial.rhel7_ospp Ansible Galaxy Role. Ansible role to prepare system for kubernetes is based on:
- Kubernetes Setup Using Ansible and Vagrant,
- Kubernetes Documentation - Container runtimes,
- Kubernetes on CentOS 7 with Firewalld,
One need to have:
- Hashicorp Vagrant - https://www.vagrantup.com/downloads.html
- Oracle VirtualBox - https://www.virtualbox.org/wiki/Downloads
- RedHat Ansible - https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
Optional:
- GNU Make - https://www.gnu.org/software/make/
To run kubernetes cluster:
vagrant up
There will be created 2 VMs: k8s-master-1, k8s-node-1
Access to VMs:
vagrant ssh <VM-name>
There will be fetched kube config file in path ansible/.kube/config
export KUBECONFIG=$(pwd)/ansible/.kube/config
kubectl get nodes
kubectl get pods -n kube-system
To stop cluster's VMs:
vagrant halt
To destroy VMs:
vagrant destroy
or
make clean
it will additionaly remove .vagrant
folder, ansible/join-command
& ansible/.kube/config
files