{"_id":"57acceed71d2991900b9a62d","category":{"_id":"57acceed71d2991900b9a62c","version":"57acceed71d2991900b9a62b","project":"570086efa565e20e001573b3","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-04-03T02:58:55.770Z","from_sync":false,"order":0,"slug":"documentation","title":"Documentation"},"project":"570086efa565e20e001573b3","parentDoc":null,"user":"569d7767ec29360d00f667c7","version":{"_id":"57acceed71d2991900b9a62b","project":"570086efa565e20e001573b3","__v":1,"createdAt":"2016-08-11T19:15:57.383Z","releaseDate":"2016-08-11T19:15:57.383Z","categories":["57acceed71d2991900b9a62c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-03T02:58:55.812Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Introduction\"\n}\n[/block]\n[Spread](http://github.com/redspread/spread) is an open source command line tool that makes it easy to version Kubernetes objects, set up a local Kubernetes cluster (see: [localkube](http://github.com/redspread/localkube)), and deploy to Kubernetes clusters in one command. \n\nIn this guide, you'll learn how to install Spread, set up your project directory, and deploy an example application.\n\nYou'll also find detailed documentation on Spread commands.\n\nLet's get started! This guide assumes you've installed the following:\n* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n* [Go](https://golang.org/doc/install) (v 1.6)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Install Spread\"\n}\n[/block]\n**Install with go get (-d is for download only):**\n\n<pre><code>$ go get -d rsprd.com/spread/cmd/spread</code></pre>\n\nGo into the correct directory:\n\n<pre><code>cd $GOPATH/src/rsprd.com/spread</code></pre>\n\nIf libgit2 is not installed:\n\n<pre><code>make install-libgit2</code></pre>\n\nThen:\n\n<pre><code>make build/spread</code></pre>\n\nIf an error about libraries missing comes up, set up your library path like:\n\n<pre><code>export LD_LIBRARY_PATH=/usr/local/lib:$ LD_LIBRARY_PATH</code></pre>\n\n**Or, if you prefer using Homebrew (OS X only):**\n\n<pre><code>$ brew tap redspread/spread\n$ brew install spread-versioning</code></pre>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set Up Your Directory\"\n}\n[/block]\n_Note: If you'd like to use our [example repo](http://github.com/redspread/kube-mattermost), skip this step! If you'd like to set up your own repo, carry on._\n\nIn order to take advantage of Spread's one-command deploy feature, `spread deploy`, you'll need to set up your directory with a few specific naming conventions:\n\n* All `ReplicationController` and `Pod` files should go in the root directory\n* Any `ReplicationController` files should end in `.rc.yaml` or `.rc.json`, depending on the respective file extension\n* Any `Pod` files should end in `.pod.yaml` or `.pod.json`, depending on the respective file extension\n* All other Kubernetes object files should go in a directory named `rs`\n\nThere is no limit to the number of `ReplicationController`s or `Pod`s in the root directory.\n\nHere is an example directory with Spread's naming conventions:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Dockerfile\\napp.rc.yaml\\ndatabase.rc.yaml\\nrs\\n |_\\n \\t  service.yaml\\n    secret.yaml\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Spin Up a Kubernetes Cluster\"\n}\n[/block]\nIn order to deploy your application, you'll need to have a running Kubernetes cluster (local or remote). \n\n**To spin up a local cluster:**\n\nThis assumes you have the following installed:\n* [Docker](https://docs.docker.com/engine/installation/)\n* [docker-machine](https://docs.docker.com/machine/install-machine/)\n* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n* kubectl*\n\n(Note: For Mac and Windows users, the fastest way to install everything is [Docker Toolbox](https://www.docker.com/products/docker-toolbox).)\n\nGet started:\n\n1. Create a machine called dev: `docker-machine create --driver virtualbox dev`\n2. Start your docker-machine: `docker-machine start dev`\n3. Connect to the docker daemon: `eval \"$(docker-machine env dev)\"`\n4. Spin up a local cluster using [localkube](http://github.com/redspread/localkube): `spread cluster start`\n5. To stop the cluster: `spread cluster stop`\n\n**To spin up a remote cluster:**\n\n* Follow all the steps in [this quickstart guide](https://blog.redspread.com/2016/02/04/google-container-engine-quickstart/) for spinning up a cluster on Google Cloud Platform.\n\n*For local development, it's useful to also install `kubectl`, the command line tool for interacting with the Kubernetes API. You can download `kubectl` from the Kubernetes release artifact site with the `curl` tool.\n\nLinux:\n<pre><code>$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.3/bin/linux/amd64/kubectl</code></pre>\n\nDarwin:\n<pre><code>$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.3/bin/darwin/amd64/kubectl</code></pre>\n\nAfter downloading the binary, ensure it is executable and move it into your PATH:\n\n<pre><code>$ chmod +x kubectl  \n$ mv kubectl /usr/local/bin/kubectl</code></pre>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Deploy Example Application\"\n}\n[/block]\nYou're ready to deploy your first application! We've got one set up for you already to deploy:\n\n1. Clone [Mattermost](http://about.mattermost.com), the open source Slack: `$ git clone http://github.com/redspread/kube-mattermost`\n2. Deploy Mattermost to your cluster: `$ spread deploy .`\n3. For remote clusters, the IP address is returned to you to put into your browser. For local clusters, the `NodePort` is returned to you, and you can find the IP address with `docker-machine env <MACHINE_NAME>`, then put the `IP:NodePort` into your browser to see your self-hosted app!\n\nFor a more detailed walkthrough of setting up this Mattermost application, see the full [guide](https://github.com/redspread/kube-mattermost).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Next Steps\"\n}\n[/block]\nExplore [Spread's commands](https://redspread.readme.io/docs/spread-commands) in more detail.","excerpt":"This page will help you get started with Spread. You'll be up and running in a jiffy!","slug":"getting-started","type":"basic","title":"Getting Started with Spread"}

Getting Started with Spread

This page will help you get started with Spread. You'll be up and running in a jiffy!

[block:api-header] { "type": "basic", "title": "Introduction" } [/block] [Spread](http://github.com/redspread/spread) is an open source command line tool that makes it easy to version Kubernetes objects, set up a local Kubernetes cluster (see: [localkube](http://github.com/redspread/localkube)), and deploy to Kubernetes clusters in one command. In this guide, you'll learn how to install Spread, set up your project directory, and deploy an example application. You'll also find detailed documentation on Spread commands. Let's get started! This guide assumes you've installed the following: * [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) * [Go](https://golang.org/doc/install) (v 1.6) [block:api-header] { "type": "basic", "title": "Install Spread" } [/block] **Install with go get (-d is for download only):** <pre><code>$ go get -d rsprd.com/spread/cmd/spread</code></pre> Go into the correct directory: <pre><code>cd $GOPATH/src/rsprd.com/spread</code></pre> If libgit2 is not installed: <pre><code>make install-libgit2</code></pre> Then: <pre><code>make build/spread</code></pre> If an error about libraries missing comes up, set up your library path like: <pre><code>export LD_LIBRARY_PATH=/usr/local/lib:$ LD_LIBRARY_PATH</code></pre> **Or, if you prefer using Homebrew (OS X only):** <pre><code>$ brew tap redspread/spread $ brew install spread-versioning</code></pre> [block:api-header] { "type": "basic", "title": "Set Up Your Directory" } [/block] _Note: If you'd like to use our [example repo](http://github.com/redspread/kube-mattermost), skip this step! If you'd like to set up your own repo, carry on._ In order to take advantage of Spread's one-command deploy feature, `spread deploy`, you'll need to set up your directory with a few specific naming conventions: * All `ReplicationController` and `Pod` files should go in the root directory * Any `ReplicationController` files should end in `.rc.yaml` or `.rc.json`, depending on the respective file extension * Any `Pod` files should end in `.pod.yaml` or `.pod.json`, depending on the respective file extension * All other Kubernetes object files should go in a directory named `rs` There is no limit to the number of `ReplicationController`s or `Pod`s in the root directory. Here is an example directory with Spread's naming conventions: [block:code] { "codes": [ { "code": "Dockerfile\napp.rc.yaml\ndatabase.rc.yaml\nrs\n |_\n \t service.yaml\n secret.yaml", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Spin Up a Kubernetes Cluster" } [/block] In order to deploy your application, you'll need to have a running Kubernetes cluster (local or remote). **To spin up a local cluster:** This assumes you have the following installed: * [Docker](https://docs.docker.com/engine/installation/) * [docker-machine](https://docs.docker.com/machine/install-machine/) * [VirtualBox](https://www.virtualbox.org/wiki/Downloads) * kubectl* (Note: For Mac and Windows users, the fastest way to install everything is [Docker Toolbox](https://www.docker.com/products/docker-toolbox).) Get started: 1. Create a machine called dev: `docker-machine create --driver virtualbox dev` 2. Start your docker-machine: `docker-machine start dev` 3. Connect to the docker daemon: `eval "$(docker-machine env dev)"` 4. Spin up a local cluster using [localkube](http://github.com/redspread/localkube): `spread cluster start` 5. To stop the cluster: `spread cluster stop` **To spin up a remote cluster:** * Follow all the steps in [this quickstart guide](https://blog.redspread.com/2016/02/04/google-container-engine-quickstart/) for spinning up a cluster on Google Cloud Platform. *For local development, it's useful to also install `kubectl`, the command line tool for interacting with the Kubernetes API. You can download `kubectl` from the Kubernetes release artifact site with the `curl` tool. Linux: <pre><code>$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.3/bin/linux/amd64/kubectl</code></pre> Darwin: <pre><code>$ curl -O https://storage.googleapis.com/kubernetes-release/release/v1.2.3/bin/darwin/amd64/kubectl</code></pre> After downloading the binary, ensure it is executable and move it into your PATH: <pre><code>$ chmod +x kubectl $ mv kubectl /usr/local/bin/kubectl</code></pre> [block:api-header] { "type": "basic", "title": "Deploy Example Application" } [/block] You're ready to deploy your first application! We've got one set up for you already to deploy: 1. Clone [Mattermost](http://about.mattermost.com), the open source Slack: `$ git clone http://github.com/redspread/kube-mattermost` 2. Deploy Mattermost to your cluster: `$ spread deploy .` 3. For remote clusters, the IP address is returned to you to put into your browser. For local clusters, the `NodePort` is returned to you, and you can find the IP address with `docker-machine env <MACHINE_NAME>`, then put the `IP:NodePort` into your browser to see your self-hosted app! For a more detailed walkthrough of setting up this Mattermost application, see the full [guide](https://github.com/redspread/kube-mattermost). [block:api-header] { "type": "basic", "title": "Next Steps" } [/block] Explore [Spread's commands](https://redspread.readme.io/docs/spread-commands) in more detail.