github.com/enmand/kubernetes@v1.2.0-alpha.0/docs/getting-started-guides/cloudstack.md (about)

     1  <!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
     2  
     3  <!-- BEGIN STRIP_FOR_RELEASE -->
     4  
     5  <img src="http://kubernetes.io/img/warning.png" alt="WARNING"
     6       width="25" height="25">
     7  <img src="http://kubernetes.io/img/warning.png" alt="WARNING"
     8       width="25" height="25">
     9  <img src="http://kubernetes.io/img/warning.png" alt="WARNING"
    10       width="25" height="25">
    11  <img src="http://kubernetes.io/img/warning.png" alt="WARNING"
    12       width="25" height="25">
    13  <img src="http://kubernetes.io/img/warning.png" alt="WARNING"
    14       width="25" height="25">
    15  
    16  <h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
    17  
    18  If you are using a released version of Kubernetes, you should
    19  refer to the docs that go with that version.
    20  
    21  <strong>
    22  The latest 1.0.x release of this document can be found
    23  [here](http://releases.k8s.io/release-1.0/docs/getting-started-guides/cloudstack.md).
    24  
    25  Documentation for other releases can be found at
    26  [releases.k8s.io](http://releases.k8s.io).
    27  </strong>
    28  --
    29  
    30  <!-- END STRIP_FOR_RELEASE -->
    31  
    32  <!-- END MUNGE: UNVERSIONED_WARNING -->
    33  Getting started on [CloudStack](http://cloudstack.apache.org)
    34  ------------------------------------------------------------
    35  
    36  **Table of Contents**
    37  
    38  - [Introduction](#introduction)
    39  - [Prerequisites](#prerequisites)
    40  - [Clone the playbook](#clone-the-playbook)
    41  - [Create a Kubernetes cluster](#create-a-kubernetes-cluster)
    42  
    43  ### Introduction
    44  
    45  CloudStack is a software to build public and private clouds based on hardware virtualization principles (traditional IaaS). To deploy Kubernetes on CloudStack there are several possibilities depending on the Cloud being used and what images are made available. [Exoscale](http://exoscale.ch) for instance makes a [CoreOS](http://coreos.com) template available, therefore instructions to deploy Kubernetes on coreOS can be used. CloudStack also has a vagrant plugin available, hence Vagrant could be used to deploy Kubernetes either using the existing shell provisioner or using new Salt based recipes.
    46  
    47  [CoreOS](http://coreos.com) templates for CloudStack are built [nightly](http://stable.release.core-os.net/amd64-usr/current/). CloudStack operators need to [register](http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/templates.html) this template in their cloud before proceeding with these Kubernetes deployment instructions.
    48  
    49  This guide uses an [Ansible playbook](https://github.com/runseb/ansible-kubernetes).
    50  This is a completely automated, a single playbook deploys Kubernetes based on the coreOS [instructions](coreos/coreos_multinode_cluster.md).
    51  
    52  
    53  This [Ansible](http://ansibleworks.com) playbook deploys Kubernetes on a CloudStack based Cloud using CoreOS images. The playbook, creates an ssh key pair, creates a security group and associated rules and finally starts coreOS instances configured via cloud-init.
    54  
    55  ### Prerequisites
    56  
    57      $ sudo apt-get install -y python-pip
    58      $ sudo pip install ansible
    59      $ sudo pip install cs
    60  
    61  [_cs_](https://github.com/exoscale/cs) is a python module for the CloudStack API.
    62  
    63  Set your CloudStack endpoint, API keys and HTTP method used.
    64  
    65  You can define them as environment variables: `CLOUDSTACK_ENDPOINT`, `CLOUDSTACK_KEY`, `CLOUDSTACK_SECRET` and `CLOUDSTACK_METHOD`.
    66  
    67  Or create a `~/.cloudstack.ini` file:
    68  
    69      [cloudstack]
    70      endpoint = <your cloudstack api endpoint>
    71      key = <your api access key>
    72      secret = <your api secret key>
    73      method = post
    74  
    75  We need to use the http POST method to pass the _large_ userdata to the coreOS instances.
    76  
    77  ### Clone the playbook
    78  
    79      $ git clone --recursive https://github.com/runseb/ansible-kubernetes.git
    80      $ cd ansible-kubernetes
    81  
    82  The [ansible-cloudstack](https://github.com/resmo/ansible-cloudstack) module is setup in this repository as a submodule, hence the `--recursive`.
    83  
    84  ### Create a Kubernetes cluster
    85  
    86  You simply need to run the playbook.
    87  
    88      $ ansible-playbook k8s.yml
    89  
    90  Some variables can be edited in the `k8s.yml` file.
    91  
    92      vars:
    93        ssh_key: k8s
    94        k8s_num_nodes: 2
    95        k8s_security_group_name: k8s
    96        k8s_node_prefix: k8s2
    97        k8s_template: Linux CoreOS alpha 435 64-bit 10GB Disk
    98        k8s_instance_type: Tiny
    99  
   100  This will start a Kubernetes master node and a number of compute nodes (by default 2).
   101  The `instance_type` and `template` by default are specific to [exoscale](http://exoscale.ch), edit them to specify your CloudStack cloud specific template and instance type (i.e service offering).
   102  
   103  Check the tasks and templates in `roles/k8s` if you want to modify anything.
   104  
   105  Once the playbook as finished, it will print out the IP of the Kubernetes master:
   106  
   107      TASK: [k8s | debug msg='k8s master IP is {{ k8s_master.default_ip }}'] ********
   108  
   109  SSH to it using the key that was created and using the _core_ user and you can list the machines in your cluster:
   110  
   111      $ ssh -i ~/.ssh/id_rsa_k8s core@<master IP>
   112      $ fleetctl list-machines
   113      MACHINE		IP		       METADATA
   114      a017c422...	<node #1 IP>   role=node
   115      ad13bf84...	<master IP>	   role=master
   116      e9af8293...	<node #2 IP>   role=node
   117  
   118  
   119  <!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
   120  [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/cloudstack.md?pixel)]()
   121  <!-- END MUNGE: GENERATED_ANALYTICS -->