Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Add support for vagrant
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanying committed Oct 27, 2017
1 parent 4f4aef8 commit bd31bc1
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 132 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ remora/scripts/images
remora/scripts/userdata/*.yaml

.DS_Store

# vagrant
.vagrant/
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
Remora is command-line tool and library to manage kubernetes cluster on
any cloud and baremetal.

Please fill here a long description which must be at least 3 lines wrapped on
80 cols, so that distribution package maintainers can use it in their packages.
Note that this is a hard requirement.

* Free software: Apache license
* Documentation: http://docs.openstack.org/developer/remora
* Source: http://git.openstack.org/cgit/openstack/remora
* Bugs: http://bugs.launchpad.net/remora
You can see [Quick Start Guide](doc/quickstart.md) which uses Vagrant to
install and run Kubernetes cluster.

## Prerequisite

Expand Down
54 changes: 54 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"

public_key = nil
[ENV['REMORA_PUBLIC_KEY'], "~/.ssh/id_rsa.pub", "~/.ssh/id_dsa.pub"].each do |p_key|
if p_key
p_key = File.expand_path(p_key)
if File.file?(p_key)
public_key = open(p_key).read
break
end
end
end

unless public_key
raise "Please specify ssh public key using following env: REMORA_PUBLIC_KEY"
end

SCRIPT = <<-EOF
echo "#{public_key}" >> ~vagrant/.ssh/authorized_keys
swapoff /dev/sda2
sed -i -e "/swap/d" /etc/fstab
EOF

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "envimation/ubuntu-xenial-docker"
config.vm.box_url = "https://atlas.hashicorp.com/envimation/boxes/ubuntu-xenial-docker"

config.vm.define :master do |master|
master.vm.hostname = "master"
master.vm.provider "virtualbox" do |v, override|
v.customize ["modifyvm", :id, "--memory", "2048"]
end

master.vm.network :private_network, ip: "192.168.43.101"

master.vm.provision :shell, inline: SCRIPT
end

[[:worker01, 102], [:worker02, 103]].each do |worker|
config.vm.define worker[0] do |w|
w.vm.hostname = worker[0].to_s
w.vm.provider "virtualbox" do |v, override|
v.customize ["modifyvm", :id, "--memory", "2048"]
end

w.vm.network :private_network, ip: "192.168.43.#{worker[1]}"

w.vm.provision :shell, inline: SCRIPT
end
end

end
23 changes: 23 additions & 0 deletions configs/vagrant.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
user: vagrant

local:
assets_dir: "~/.kube/vagrant"


masters: &masters
- 192.168.43.101
workers: &workers
- 192.168.43.102
- 192.168.43.103

roledefs:
bootstrap:
- 192.168.43.101
etcd: *masters
master: *masters
worker: *workers

kubernetes:
version: v1.8.1
public_service_ip: 192.168.43.100
59 changes: 59 additions & 0 deletions doc/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Play with Vagrant

You can also test `Remora` with Vagrant.

## Prerequisite

You will need following softwares.

- Python 3.5 or later and pip
- kubectl 1.7.x or later

### Install Python and pip

```bash
$ sudo apt install curl llvm sqlite3 libssl-dev libbz2-dev libreadline-dev libsqlite3-dev libncurses5-dev libncursesw5-dev python-tk python3-tk tk-dev
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ cat <<-'EOF' >> ~/.bash_profile
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
EOF
$ source ~/.bash_profile
$ pyenv install 3.5.3
$ pyenv global 3.5.3
$ curl -kL https://bootstrap.pypa.io/get-pip.py | python
```

### Install kubectl

```bash
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
```

## Install Kubernetes Cluster using Remora

### Install Remora

```bash
$ git clone https://github.com/nec-openstack/remora.git
$ cd remora
$ pip install -r requirements.txt
```

### Install Kubernetes Cluster

```bash
$ vagrant up
$ fab vagrant render
$ fab vagrant install
```

### Access your Kubernetes Cluster

```bash
$ fab vagrant config
$ kubectl version
```
75 changes: 0 additions & 75 deletions doc/source/conf.py

This file was deleted.

4 changes: 0 additions & 4 deletions doc/source/contributing.rst

This file was deleted.

25 changes: 0 additions & 25 deletions doc/source/index.rst

This file was deleted.

12 changes: 0 additions & 12 deletions doc/source/installation.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/source/readme.rst

This file was deleted.

7 changes: 0 additions & 7 deletions doc/source/usage.rst

This file was deleted.

0 comments on commit bd31bc1

Please sign in to comment.