neil1145 / k42s

Multinode Kubernetes Vagrant cluster with a real load balancer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

k42s

k42s is a full multinode Kubernetes Vagrant cluster with a real load balancer.

Kubernetes


Why “k42s”?

This project is the result of getting my hands dirty with Kubernetes trying to fulfil my innate curiosity to understand how things work in the nitty-gritty details. In the beginning I have started poking around with Minikube, which at that time was quite convenient to run my experiments and demos. However, moving forward I have realised that to have a holistic understanding of Kubernetes ecosystem I had to play with something near running it in a real multinode production cluster where would possible to experiment with network policies, load balancers, ingress controllers, storage and more. Hence, I decided to build my own portable Kubernetes lab and share it with the world.

Kubernetes This is by no means a Kubernetes production grade setup, do not expose ports, services, endpoints to the internet. Kubernetes

What is Kubernetes?

According to the official website:

Kubernetes is a portable, extensible open-source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available.

Features

Overlay network: WeaveNet

K8 Package management: Helm

Load LoadBalancer: MetalLB

Service mesh: Istio

Monitoring: Prometheus - Alert Manager - Grafana

DNS Resolution: Nip.io

Vagrant base images and templates.

https://app.vagrantup.com/p0bailey/boxes/k8-stable

https://github.com/p0bailey/packer-templates/tree/master/k8

Installation

Requirements

OS X & Linux:

OSX: brew install ansible virtualbox vagrant helm derailed/k9s/k9s direnv kubectl

Other useful tools and plugins

OSX: brew install stern kubectx derailed/popeye/popeye

Setup

Usage example

Quickstart:

Make sure you add these StrictHostKeyChecking to your ~/.ssh/config otherwise Ansible likely to fail.

Host 192.168.56.*
   StrictHostKeyChecking no
   UserKnownHostsFile=/dev/null

Clone the repo.

git clone git@github.com:p0bailey/k42s.git

Go into k42s directory and run.

direnv allow

make bootstrap

Those commands would set first a convenient KUBECONFIG env variable and second would bootstrap a full cluster with basic components as Istio, Prometheus, Weave-Scope.

At the end of the cluster bootstrap you must get this output showing 1 master and 2 worker nodes along with several pods.

Kubernetes

Cluster services

https://weave.192-168-56-240.nip.io

https://prometheus.192-168-56-240.nip.io

https://alertmanager.192-168-56-240.nip.io

https://grafana.192-168-56-240.nip.io

Grafana login admin/prom-operator

https://kiali.192-168-56-240.nip.io

Kiali login admin/admin

Demo service

This deployment would provide a basic NGINX webserver.

Type: make demo_1_install

Expected output.

namespace/demo1 created
Release "demo1" does not exist. Installing it now.
NAME: demo1
LAST DEPLOYED: Tue Jun  2 11:24:43 2020
NAMESPACE: demo1
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL going to:
 https://demo1.192-168-56-240.nip.io/

Kubernetes

To delete demo 1 service type:

make demo_1_delete

Expected output.

release "demo1" uninstalled
namespace "demo1" deleted

Useful commands:

List all pods in all namespaces:

kubectl get pods --all-namespaces

List cluster events in all namespace sorted by creationTimestamp.

kubectl get events --all-namespaces --sort-by=.metadata.creationTimestamp

Advanced Usage

K42s advanced usage

Workshops

Loads of self paced workshops to follow along

Release History

See CHANGELOG.md

Meta

Phillip Bailey– @p0baileyphillip@bailey.st

Distributed under the MIT license. See LICENSE for more information.

https://github.com/p0bailey/k42s

Contributing

  1. Fork it (https://github.com/p0bailey/k42s)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

About

Multinode Kubernetes Vagrant cluster with a real load balancer.

License:MIT License


Languages

Language:Shell 68.2%Language:Smarty 24.3%Language:Makefile 7.5%