/k8s-setup

Kuberentes setup files . Setting up k8s cluster made easy!

kubernetes setup using ansible and vagrant

This contains the working code to setup kubernetes using anisble and vagrant.

adheres to offical documentation : https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/

Prerequistes

  • Vagrant should be installed on your machine. Installation binaries can be found here.
  • Oracle VirtualBox can be used as a Vagrant provider or make use of similar providers as described in Vagrant's official documentation.
  • Ansible should be installed in your machine. Refer to the Ansible installation guide for platform specific installation.

How to use

  1. Clone repo
git clone https://github.com/naveenrajm7/k8s-setup.git
  1. Execute vagrant inside folder
cd k8s-setup
vagrant up
  1. Access master and use kubernetes
$ ## Accessing master
$ vagrant ssh k8s-master
vagrant@k8s-master:~$ kubectl get nodes
NAME         STATUS   ROLES                  AGE     VERSION
k8s-master   Ready    control-plane,master   14m     v1.23.3
node-1       Ready    <none>                 9m37s   v1.23.3
node-2       Ready    <none>                 5m19s   v1.23.3

vagrant@k8s-master:~$ kubectl create ns my-ns
namespace/my-ns created

To connect to kuberenetes cluster from outside the cluster.

Reference