2015-07-12 04:04:52 +00:00
|
|
|
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
|
|
|
|
|
|
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
|
|
|
2015-07-15 00:28:47 +00:00
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
2015-07-13 22:15:35 +00:00
|
|
|
|
|
|
|
<h1>PLEASE NOTE: This document applies to the HEAD of the source
|
2015-07-12 04:04:52 +00:00
|
|
|
tree only. If you are using a released version of Kubernetes, you almost
|
|
|
|
certainly want the docs that go with that version.</h1>
|
|
|
|
|
|
|
|
<strong>Documentation for specific releases can be found at
|
|
|
|
[releases.k8s.io](http://releases.k8s.io).</strong>
|
|
|
|
|
2015-07-15 00:28:47 +00:00
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
|
|
|
![WARNING](http://kubernetes.io/img/warning.png)
|
2015-07-13 22:15:35 +00:00
|
|
|
|
2015-07-12 04:04:52 +00:00
|
|
|
<!-- END STRIP_FOR_RELEASE -->
|
|
|
|
|
|
|
|
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
2015-06-22 19:39:35 +00:00
|
|
|
Getting started on AWS EC2
|
|
|
|
--------------------------
|
2014-11-06 11:06:30 +00:00
|
|
|
|
2015-06-22 19:39:35 +00:00
|
|
|
**Table of Contents**
|
2015-06-22 18:56:19 +00:00
|
|
|
|
2015-06-23 15:20:31 +00:00
|
|
|
- [Prerequisites](#prerequisites)
|
|
|
|
- [Cluster turnup](#cluster-turnup)
|
|
|
|
- [Supported procedure: `get-kube`](#supported-procedure-get-kube)
|
|
|
|
- [Alternatives](#alternatives)
|
|
|
|
- [Getting started with your cluster](#getting-started-with-your-cluster)
|
|
|
|
- [Command line administration tool: `kubectl`](#command-line-administration-tool-kubectl)
|
|
|
|
- [Examples](#examples)
|
|
|
|
- [Tearing down the cluster](#tearing-down-the-cluster)
|
|
|
|
- [Further reading](#further-reading)
|
2015-06-22 18:56:19 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
## Prerequisites
|
2014-11-06 11:06:30 +00:00
|
|
|
|
2014-11-06 22:27:15 +00:00
|
|
|
1. You need an AWS account. Visit [http://aws.amazon.com](http://aws.amazon.com) to get started
|
|
|
|
2. Install and configure [AWS Command Line Interface](http://aws.amazon.com/cli)
|
2014-12-19 23:28:29 +00:00
|
|
|
3. You need an AWS [instance profile and role](http://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html) with EC2 full access.
|
2014-11-06 11:06:30 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
## Cluster turnup
|
|
|
|
```bash
|
|
|
|
#Using wget
|
2015-03-31 04:48:23 +00:00
|
|
|
export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash
|
2014-11-24 16:09:08 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
#Using cURL
|
2015-03-31 04:48:23 +00:00
|
|
|
export KUBERNETES_PROVIDER=aws; curl -sS https://get.k8s.io | bash
|
2014-11-06 11:06:30 +00:00
|
|
|
```
|
|
|
|
|
2015-07-16 21:54:28 +00:00
|
|
|
NOTE: This script calls [cluster/kube-up.sh](../../cluster/kube-up.sh)
|
|
|
|
which in turn calls [cluster/aws/util.sh](../../cluster/aws/util.sh)
|
|
|
|
using [cluster/aws/config-default.sh](../../cluster/aws/config-default.sh).
|
2015-02-06 04:21:38 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
This process takes about 5 to 10 minutes. Once the cluster is up, the IP addresses of your master and node(s) will be printed,
|
|
|
|
as well as information about the default services running in the cluster (monitoring, logging, dns). User credentials and security
|
|
|
|
tokens are written in `~/.kube/kubeconfig`, they will be necessary to use the CLI or the HTTP Basic Auth.
|
2014-11-18 05:41:13 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
By default, the script will provision a new VPC and a 4 node k8s cluster in us-west-2a (Oregon) with `t2.micro` instances running on Ubuntu.
|
2015-07-16 21:54:28 +00:00
|
|
|
You can override the variables defined in [config-default.sh](../../cluster/aws/config-default.sh) to change this behavior as follows:
|
2015-05-14 19:24:03 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
export KUBE_AWS_ZONE=eu-west-1c
|
|
|
|
export NUM_MINIONS=2
|
|
|
|
export MINION_SIZE=m3.medium
|
|
|
|
export AWS_S3_REGION=eu-west-1
|
|
|
|
export AWS_S3_BUCKET=mycompany-kubernetes-artifacts
|
|
|
|
export INSTANCE_PREFIX=k8s
|
|
|
|
...
|
2014-11-18 05:41:13 +00:00
|
|
|
```
|
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
It will also try to create or reuse a keypair called "kubernetes", and IAM profiles called "kubernetes-master" and "kubernetes-minion".
|
|
|
|
If these already exist, make sure you want them to be used here.
|
|
|
|
|
2015-06-01 13:19:17 +00:00
|
|
|
NOTE: If using an existing keypair named "kubernetes" then you must set the `AWS_SSH_KEY` key to point to your private key.
|
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
### Alternatives
|
|
|
|
A contributed [example](aws-coreos.md) allows you to setup a Kubernetes cluster based on [CoreOS](http://www.coreos.com), either using
|
|
|
|
AWS CloudFormation or EC2 with user data (cloud-config).
|
|
|
|
|
|
|
|
## Getting started with your cluster
|
|
|
|
### Command line administration tool: `kubectl`
|
2015-07-14 23:16:50 +00:00
|
|
|
The cluster startup script will leave you with a ```kubernetes``` directory on your workstation.
|
|
|
|
Alternately, you can download the latest Kubernetes release from [this page](https://github.com/GoogleCloudPlatform/kubernetes/releases).
|
|
|
|
|
|
|
|
Next, add the appropriate binary folder to your ```PATH``` to access kubectl:
|
2015-03-31 04:48:23 +00:00
|
|
|
|
|
|
|
```bash
|
2015-05-01 05:16:59 +00:00
|
|
|
# OS X
|
2015-07-14 23:16:50 +00:00
|
|
|
export PATH=<path/to/kubernetes-directory>/platforms/darwin/amd64:$PATH
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-05-01 05:16:59 +00:00
|
|
|
# Linux
|
2015-07-14 23:16:50 +00:00
|
|
|
export PATH=<path/to/kubernetes-directory>/platforms/linux/amd64:$PATH
|
2015-03-31 04:48:23 +00:00
|
|
|
```
|
|
|
|
|
2015-07-16 21:54:28 +00:00
|
|
|
An up-to-date documentation page for this tool is available here: [kubectl manual](../../docs/user-guide/kubectl/kubectl.md)
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
By default, `kubectl` will use the `kubeconfig` file generated during the cluster startup for authenticating against the API.
|
2015-07-16 21:54:28 +00:00
|
|
|
For more information, please read [kubeconfig files](../../docs/user-guide/kubeconfig-file.md)
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
### Examples
|
2015-07-14 16:37:37 +00:00
|
|
|
See [a simple nginx example](../../docs/user-guide/simple-nginx.md) to try out your new cluster.
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-07-10 01:02:10 +00:00
|
|
|
The "Guestbook" application is another popular example to get started with Kubernetes: [guestbook example](../../examples/guestbook/)
|
2014-11-06 22:27:15 +00:00
|
|
|
|
2015-07-10 01:02:10 +00:00
|
|
|
For more complete applications, please look in the [examples directory](../../examples/)
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
## Tearing down the cluster
|
|
|
|
Make sure the environment variables you used to provision your cluster are still exported, then call the following script inside the
|
|
|
|
`kubernetes` directory:
|
2015-03-31 04:48:23 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
```bash
|
|
|
|
cluster/kube-down.sh
|
|
|
|
```
|
2015-04-21 02:10:02 +00:00
|
|
|
|
2015-05-14 19:24:03 +00:00
|
|
|
## Further reading
|
2015-07-16 21:54:28 +00:00
|
|
|
Please see the [Kubernetes docs](../../docs/) for more details on administering
|
2015-05-14 19:24:03 +00:00
|
|
|
and using a Kubernetes cluster.
|
2015-05-14 22:12:45 +00:00
|
|
|
|
|
|
|
|
2015-07-14 00:13:09 +00:00
|
|
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
2015-05-14 22:12:45 +00:00
|
|
|
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/getting-started-guides/aws.md?pixel)]()
|
2015-07-14 00:13:09 +00:00
|
|
|
<!-- END MUNGE: GENERATED_ANALYTICS -->
|