Giter Site home page Giter Site logo

vagrant-kubernetes-lab's Introduction

vagrant-kubernetes-lab

This project is to provide a simple local Kubernetes cluster with a master and a worker node for testing purpose.

Vagrant was chosen for being able to create the cluster either on linux, windows and mac hosts.

Prequirements

Default provisioning

Vagrant up will provide 2 Ubuntu Xenial VMs for a kubernetes cluster with these features by default :

  • Kubernetes control plane (latest)
  • Weave network cni (latest)
  • Kubernetes Dashboard (latest)
  • Heapster v1.5.1
  • Helm (latest)

Options

network

By default, we will use the Weave-Net driver but you can override it with flannel like this:

 vagrant --network=flannel up

mount

It is possible to mount a directory from the host to the /data directory on each node. This option could be used, for example, to make git repositories local to the host available to be used in the cluster.

The --mount=<pathOnHost> option allows to choose the directory on the host that will be mounted to /data. If that option is not specified, nothing will be mounted.
For example, run the command:

 vagrant --mount=/home/user/git up

dockerhub login

You can provide your username and password in order to do a "docker login" on each node of the cluster. This will allow you to pull private images from the Docker registry.

 vagrant --docker-username=myUser --docker-password=myPassword up

Kubeconfig

After installation, a copy of the admin.conf generated by kubeadm is available on the host in the /vagrant/kubeconfig directory, which is a shared folder inside the Git repo ./kubeconfig

Even if kubectl can be used within the guests, it is suggested that you copy the admin.conf as config in your ~/.kube/ directory on the host to able to do kubectl proxy and kubectl port-forward per example.

Or you can simply execute:

export KUBECONFIG=`pwd`/kubeconfig/admin.conf
kubectl get nodes

And you should see:

NAME        STATUS    ROLES     AGE       VERSION
k8smaster   Ready     master    10m       v1.9.0
k8sworker   Ready     <none>    5m        v1.9.0

Extra features

Multiple optionnal extra softwares has been tested with this cluster and are available if needed.

Here is the current list by category :

Ingress

  • Nginx ingress controller v0.9.0-beta.15 + Default backend v1.4

Monitoring

  • InfluxDB v1.3.3 + Grafana v4.4.3
  • Weavescope v1.6.7

Networking

  • Weave net (latest)
  • Flannel v0.9.1

Storage

  • Nfs-provisioner v1.0.9

Helm

Have a look at the README.md in related subdirectories for specific instructions.

Install everything (Quick start)

Note that if you want to install everything, you can simply run the following script (providing you have kubectl installed):

vagrant up
bash scripts/install-all-features.sh
kubectl get pods --all-namespaces -o wide

And repeat the get "kubectl get pods" command as long as the pods are not up and running.

Open dashboards

Kubernetes

Follow the instructions printed in the console:

bash scripts/open-dashboard.sh

Grafana

Note that you might have to reload the page in your browser.

bash scripts/open-grafana.sh

Weave Scope

Note that you might have to reload the page in your browser.

bash scripts/open-weavescope.sh

vagrant-kubernetes-lab's People

Contributors

marckhouzam 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.