GithubHelp home page GithubHelp logo

clim / kubernetes-under-the-hood Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mvallim/kubernetes-under-the-hood

0.0 2.0 0.0 1.77 MB

Kubernetes under the hood - This tutorial is someone planning to install a Kubernetes cluster and wants to understand how everything fits together.

Home Page: https://mvallim.github.io/kubernetes-under-the-hood

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%

kubernetes-under-the-hood's Introduction

Kubernetes under the hood

Presentation: Kubernetes under the hood journey

Target Audience

The target audience for this tutorial is someone planning to install a Kubernetes cluster and wants to understand how everything fits together.

Getting Started

Prerequisites (GNU/Linux Debian/Ubuntu)

The premise is that you already have Virtualbox properly installed on your local machine.

Install shyaml with user root

# apt-get install python3-pip

# pip3 install shyaml

Install genisoimage with user root

# apt-get install genisoimage

Download base image

To continue with this demo you need to download the base image and register it in Virtualbox.

$ cd ~/VirtualBox\ VMs/

$ wget https://www.dropbox.com/s/v6h0sedqt3za9pl/image-base.tar.bz2?dl=0 -O image-base.tar.bz2

$ tar xvjf image-base.tar.bz2

$ vboxmanage registervm ~/VirtualBox\ VMs/image-base/image-base.vbox

$ rm image-base.tar.bz2

Configuring

Create a Host-Only adpter on Virtualbox

$ vboxmanage hostonlyif create

$ vboxmanage hostonlyif ipconfig vboxnet0 --ip 192.168.254.1 --netmask 255.255.0.0

You need to add the routes on your local machine to access the internal network of Virtualbox.

$ sudo ip route add 192.168.1.0/24 via 192.168.1.254

$ sudo ip route add 192.168.2.0/24 via 192.168.2.254

$ sudo ip route add 192.168.3.0/24 via 192.168.3.254

$ sudo ip route add 192.168.4.0/24 via 192.168.4.254

$ sudo ip route add 192.168.254.0/24 via 192.168.254.254

If you are a using dnsmasq on your local machine execute this to use private DNS of this DEMO to domain 'kube.local'

$ echo "server=/kube.local/192.168.254.254" | sudo tee -a /etc/dnsmasq.d/server

$ sudo service dnsmasq restart

Running

Now let's create the images using a tool (create-image.sh) that will help us clone the base image and add the user-data, meta-data and network-config scripts that cloud-init will use to make the installation of the necessary packages and configurations.

$ ./create-image.sh \
    -k or --ssh-pub-keyfile SSH_PUB_KEY_FILE \
    -u or --user-data USER_DATA_FILE \
    -m or --meta-data META_DATA_FILE \
    -n or --network-interfaces NETWORK_INTERFACES_FILE \
    -i or --post-config-interfaces POST_CONFIG_INTERFACES_FILE \
    -s or --post-config-storages POST_CONFIG_STORAGES_FILE \
    -r or --post-config-resources POST_CONFIG_RESOURCES_FILE \
    -o or --hostname HOSTNAME \
    -b or --base-image BASE_IMAGE \
    -a or --auto-start AUTO_START

Parameters:

  • SSH_PUB_KEY_FILE: Path to an SSH public key.
  • USER_DATA_FILE: Path to an user data file. Default is '/data/user-data'.
  • META_DATA_FILE: Path to an meta data file. Default is '/data/meta-data'.
  • NETWORK_INTERFACES_FILE: Path to an network interface data file.
  • POST_CONFIG_INTERFACES_FILE: Path to an post config interface data file.
  • POST_CONFIG_STORAGES_FILE: Path to an post config storage data file.
  • POST_CONFIG_RESOURCES_FILE: Path to an post config resources data file.
  • HOSTNAME: Hostname of new image.
  • BASE_IMAGE: Name of VirtualBox base image.
  • AUTO_START: Auto start vm. Default is true.

For more information:

$ ./create-image.sh -h or --help

Running Demo

$ ./create-image.sh \
    -k ~/.ssh/id_rsa.pub \
    -u data/gate/user-data \
    -n data/gate/network-config \
    -i data/gate/post-config-interfaces \
    -r data/gate/post-config-resources \
    -o gate-node01 \
    -b image-base

$ for instance in hapx-node01 hapx-node02; do
    ./create-image.sh \
        -k ~/.ssh/id_rsa.pub \
        -u data/hapx/user-data \
        -n data/hapx/network-config \
        -i data/hapx/post-config-interfaces \
        -r data/hapx/post-config-resources \
        -o ${instance} \
        -b image-base
done

$ for instance in kube-mast01 kube-mast02 kube-mast03; do
    ./create-image.sh \
        -k ~/.ssh/id_rsa.pub \
        -u data/kube/user-data \
        -n data/kube/network-config \
        -i data/kube-mast/post-config-interfaces \
        -r data/kube-mast/post-config-resources \
        -o ${instance} \
        -b image-base
done

$ for instance in kube-node01 kube-node02 kube-node03; do
    ./create-image.sh \
        -k ~/.ssh/id_rsa.pub \
        -u data/kube/user-data \
        -n data/kube/network-config \
        -i data/kube-node/post-config-interfaces \
        -r data/kube-node/post-config-resources \
        -o ${instance} \
        -b image-base
done

$ for instance in glus-node01 glus-node02 glus-node03; do
    ./create-image.sh \
        -k ~/.ssh/id_rsa.pub \
        -u data/glus/user-data \
        -n data/glus/network-config \
        -i data/glus/post-config-interfaces \
        -s data/glus/post-config-storages \
        -r data/glus/post-config-resources \
        -o ${instance} \
        -b image-base
done

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use GitHub for versioning. For the versions available, see the tags on this repository.

Authors

  • Marcos Vallim - Initial work, Development, Test, Documentation - mvallim
  • Fabio Franco Uechi - Validation demo - fabito
  • Dirceu Alves Silva - Validation demo - dirceusilva
  • Leandro Nunes Fantinatto - Validation demo - lnfnunes
  • Ivam dos Santos Luz - Validation demo, Articles - ivamluz
  • Marcos de Lima Goncalves - Validation demo, Presentation Organizer - marcoslimagon
  • Murilo Woigt Miranda - Validation demo, Presentation Organizer - woigt-ciandt

See also the list of contributors who participated in this project.

License

This project is licensed under the BSD License - see the LICENSE file for details

kubernetes-under-the-hood's People

Contributors

mvallim avatar

Watchers

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