diff --git a/.gitignore b/.gitignore index cb487eb..48ca90e 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ remora/scripts/images remora/scripts/userdata/*.yaml .DS_Store + +# vagrant +.vagrant/ diff --git a/README.md b/README.md index a4d5ee9..96771a8 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..10f0834 --- /dev/null +++ b/Vagrantfile @@ -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 diff --git a/configs/vagrant.yaml b/configs/vagrant.yaml new file mode 100644 index 0000000..4fcfe4b --- /dev/null +++ b/configs/vagrant.yaml @@ -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 diff --git a/doc/quickstart.md b/doc/quickstart.md new file mode 100644 index 0000000..4930784 --- /dev/null +++ b/doc/quickstart.md @@ -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 +``` diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100755 index a33b607..0000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import sys - -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', - 'oslosphinx' -] - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'remora' -copyright = u'2016, OpenStack Foundation' - -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# -- Options for HTML output -------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -# html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] - -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). -latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), -] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst deleted file mode 100644 index 1728a61..0000000 --- a/doc/source/contributing.rst +++ /dev/null @@ -1,4 +0,0 @@ -============ -Contributing -============ -.. include:: ../../CONTRIBUTING.rst diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index 15076f5..0000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. remora documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to remora's documentation! -======================================================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - readme - installation - usage - contributing - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/doc/source/installation.rst b/doc/source/installation.rst deleted file mode 100644 index 8c04d37..0000000 --- a/doc/source/installation.rst +++ /dev/null @@ -1,12 +0,0 @@ -============ -Installation -============ - -At the command line:: - - $ pip install remora - -Or, if you have virtualenvwrapper installed:: - - $ mkvirtualenv remora - $ pip install remora diff --git a/doc/source/readme.rst b/doc/source/readme.rst deleted file mode 100644 index a6210d3..0000000 --- a/doc/source/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../README.rst diff --git a/doc/source/usage.rst b/doc/source/usage.rst deleted file mode 100644 index 7295820..0000000 --- a/doc/source/usage.rst +++ /dev/null @@ -1,7 +0,0 @@ -======== -Usage -======== - -To use remora in a project:: - - import remora