Giter Site home page Giter Site logo

k8s-cluster's Introduction

K8S Cluster

This repository creates (currently) a 3-node Kubernetes on-premise cluster, 1 control plane and 2 data planes.

Motivation

Instead of using learning tools such as Kind and Minikube, we can use a on-premise K8S cluster using virtual machines on your own host machine.

Why? Doing this way is more fun and more similar to how it is done in on-premises environments.

Of course this way it's more complicated, but it will be worth it.

Also, it is used Kubespray to configure the production-ready K8S cluster.

Before we start

Pre requisites

Ansible

python3 -m pip install --user ansible

Vagrant

Ubuntu based

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant -y

Fedora

sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo
sudo dnf -y install vagrant

CentOS/RHEL

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install vagrant

Managing your cluster

First of all, clone this repository:

git clone [email protected]:jonatas-lima/k8s-cluster.git --recurse-submodules

The created cluster will use *GB of RAM, so it's very likely that your machine will slow down a little.

Creating

Add your private SSH key path in SSH_KEY_PATH variable on Vagrantfile

make cluster

Interacting

Just log into the control plane and start playing with Kubernetes.

vagrant ssh control-plane-1
kubectl get node
k get pods -A # it will be created an alias 'k' to kubectl
# ...

Destroying

make destroy

Other use case

You can just run the playbook that creates a K8S cluster, just populate correctly on hosts.ini

cd ansible && ansible-playbook -i hosts.ini cluster.yml

k8s-cluster's People

Contributors

jonatas-lima avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.