/vagrant-k8s

k8s local cluster with Vagrant and CentOS 7

Primary LanguageMakefile

vagrant-k8s

Kubernetes local stack based on CentOS 7 build with Vagrant and Ansible on VirtualBox VMs

Motivation

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:

Prerequisites

One need to have:

Optional:

How to use

Run

To run kubernetes cluster:

vagrant up

There will be created 2 VMs: k8s-master-1, k8s-node-1

Access

Access to VMs:

vagrant ssh <VM-name>

Access using kubeclt

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

Stop

To stop cluster's VMs:

vagrant halt

Destroy

To destroy VMs:

vagrant destroy

or

make clean

it will additionaly remove .vagrant folder, ansible/join-command & ansible/.kube/config files