Giter VIP home page Giter VIP logo

kubernetes_the_easy_way's Introduction

Kubernetes the easy way

This repository tries to automate the guide "Kubernetes The Hard Way" by Kelsey Hightower, using Vagrant and Virtualbox.

Prerequisites

  • Vagrant
  • VirtualBox 5.2
  • kubectl
  • cfssl
  • cfssljson

Documentation

Find my attempt at documenting this here Documentation

Installing cfssl and cfssljson

PKI and TLS Tools by Cloudflare (https://github.com/cloudflare/cfssl)

For Linux :
 curl -o /usr/local/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
 curl -o /usr/local/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
 chmod +x /usr/local/bin/cfssl*

For Mac :
 curl -o /usr/local/bin/cfssl https://pkg.cfssl.org/R1.2/cfssl_darwin-amd64
 curl -o /usr/local/bin/cfssljson https://pkg.cfssl.org/R1.2/cfssljson_darwin-amd64
 chmod +x /usr/local/bin/cfssl*

For Windows :
  Download https://pkg.cfssl.org/R1.2/cfssl_windows-amd64.exe
  Download https://pkg.cfssl.org/R1.2/cfssljson_windows-amd64.exe
  Do whatever Windows people do

Getting started

First off, edit the file config. Here you can specify how many of each type of nodes you want. Eg. 3 master nodes. Also you can specify the number of CPU and Memory for each type.

Once thats done, just run ./install.sh.

What just happend

The script set the number of nodes you want and the resources they get. It then generates a hosts file with ip's and hostnames. This is used to configure each node in the cluster. Then it generates certificates, based on the hostfile.

Now it calls Vagrant to provition the nodes. While provitioning the nodes, Vagrant will copy scripts and certifiates to each node and execute them. The script can be found under the scripts folder and the certificates under the folder ssl.

Connect local kubectl to the new cluster

Set the current context to kubernets-the-easy-way

kubectl config use-context kubernetes-the-easy-way

Test connection and see worker nodes connected

kubectl get nodes

SSH into machines

Because we trick Vagrant into being dynamic in regards to number of machines, we need to set our variables before we can use Vagrant commands. So in order to use Vagrant commands, after the install.sh script has finished, run this

source config
vagrant ssh k8s-worker-1

Destroy machines

If Kubernetes is not your thing after all, or that you for other reasons want to remove the cluster, simply run this script

./destroy.sh

Important

Remember to run the destroy.sh script before running the install.sh script again.

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.