VTWO-14496 : start machines configuration

pull/468/head
mbenabda 2019-06-20 16:44:59 +02:00
parent ce236f216f
commit e577b6e5ac
6 changed files with 68 additions and 2 deletions

View File

@ -1,4 +1,25 @@
# Introduction
This repository is intended for demo-ing the manual install of kubernetes's components on both master and worker nodes.
It should be able to get you to a working single master kubernetes setup
It should be able to get you to a working single master kubernetes setup on a set of vagrant boxes
# prerequisites
- vagrant
- the scp vagrant plugin : `vagrant plugin install vagrant-scp`
- [the GNU parallel CLI](https://www.gnu.org/software/parallel/)
# setup
- start the vms
```sh
vagrant up
```
- setup a container runtime
```sh
./scripts/run_script_on_all_nodes install_container_runtime
```
- download kubernetes
```sh
./scripts/run_script_on_all_nodes download_node_binaries
```

4
Vagrantfile vendored
View File

@ -1,5 +1,6 @@
# Doc at https://docs.vagrantup.com
# Boxes at https://vagrantcloud.com/search
require 'open-uri'
Vagrant.require_version ">= 2.2.4"
@ -7,8 +8,9 @@ Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.box_version = "= 9.9.1"
# greet from every configured VM, revealing its hostname
config.vm.provision "shell", inline: "echo Hello from \$HOSTNAME"
config.vm.define "master-node" do |node|
node.vm.hostname = "master-node"

2
scripts/download_node_binaries Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
curl -sL https://github.com/kubernetes/kubernetes/releases/download/v1.15.0/kubernetes.tar.gz | tar zxvf -

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
sudo apt-get update -y
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
sudo apt-get install -y --allow-unauthenticated docker-ce docker-ce-cli containerd.io

3
scripts/node_names Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
vagrant status --machine-readable | grep ,state, | cut -d, -f2 | sort | uniq

22
scripts/run_script_on_all_nodes Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
SCRIPTS_DIR=$(dirname $0)
SCRIPT_NAME=$1
NODE_NAMES=$($SCRIPTS_DIR/node_names)
cat $SCRIPTS_DIR/$SCRIPT_NAME
echo ""
echo ""
echo ""
echo ""
read -n 1 -s -r -p "Press any key to continue..."
echo ""
echo ""
# copy script over
chmod u+x "$SCRIPTS_DIR/$SCRIPT_NAME"
parallel vagrant scp "$SCRIPTS_DIR/$SCRIPT_NAME" "{}:~/" ::: $NODE_NAMES
# remotely run the script
parallel vagrant ssh {} -c "\~/$SCRIPT_NAME" ::: $NODE_NAMES