refresh aws getting-started pages and templates
This commit is contained in:
@@ -1,56 +1,60 @@
|
||||
__Note (11/21/2014): This mostly works, but doesn't currently register minions correctly.__
|
||||
# Getting started on Amazon EC2 with CoreOS
|
||||
|
||||
The example below creates an elastic Kubernetes cluster with a custom number of worker nodes and a master.
|
||||
|
||||
# Getting started on Amazon EC2
|
||||
|
||||
The example below creates an elastic Kubernetes cluster with 3 worker nodes and a master.
|
||||
**Warning:** contrary to the [supported procedure](aws.md), the examples below provision Kubernetes with an insecure API server (plain HTTP,
|
||||
no security tokens, no basic auth). For demonstration purposes only.
|
||||
|
||||
## Highlights
|
||||
|
||||
* Cluster bootstrapping using [cloud-config](https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config)
|
||||
* Cluster bootstrapping using [cloud-config](https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/)
|
||||
* Cross container networking with [flannel](https://github.com/coreos/flannel#flannel)
|
||||
* Auto worker registration with [kube-register](https://github.com/kelseyhightower/kube-register#kube-register)
|
||||
* Kubernetes v0.10.1 [official binaries](https://github.com/GoogleCloudPlatform/kubernetes/releases/tag/v0.10.1)
|
||||
* Kubernetes v0.17.0 [official binaries](https://github.com/GoogleCloudPlatform/kubernetes/releases/tag/v0.17.0)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* [kubectl CLI](aws/kubectl.md)
|
||||
* [aws CLI](http://aws.amazon.com/cli)
|
||||
* [CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel)
|
||||
* [CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/)
|
||||
* [kubectl CLI](aws/kubectl.md)
|
||||
|
||||
## Starting a Cluster
|
||||
|
||||
### Cloud Formation
|
||||
### CloudFormation
|
||||
|
||||
The [cloudformation-template.json](aws/cloudformation-template.json) can be used to bootstrap a Kubernetes cluster with a single command.
|
||||
The [cloudformation-template.json](aws/cloudformation-template.json) can be used to bootstrap a Kubernetes cluster with a single command:
|
||||
|
||||
```
|
||||
```bash
|
||||
aws cloudformation create-stack --stack-name kubernetes --region us-west-2 \
|
||||
--template-body file://aws/cloudformation-template.json \
|
||||
--parameters ParameterKey=KeyPair,ParameterValue=<keypair>
|
||||
--parameters ParameterKey=KeyPair,ParameterValue=<keypair> \
|
||||
--parameters ParameterKey=ClusterSize,ParameterValue=<cluster_size> \
|
||||
--parameters ParameterKey=VpcId,ParameterValue=<vpc_id> \
|
||||
--parameters ParameterKey=SubnetId,ParameterValue=<subnet_id> \
|
||||
--parameters ParameterKey=SubnetAZ,ParameterValue=<subnet_az> \
|
||||
```
|
||||
|
||||
It will take a few minutes for the entire stack to come up. You can monitor the stack progress with the following command:
|
||||
|
||||
```
|
||||
```bash
|
||||
aws cloudformation describe-stack-events --stack-name kubernetes
|
||||
```
|
||||
|
||||
> Record the Kubernetes Master IP address
|
||||
Record the Kubernetes Master IP address:
|
||||
|
||||
```
|
||||
```bash
|
||||
aws cloudformation describe-stacks --stack-name kubernetes
|
||||
```
|
||||
|
||||
[Skip to kubectl client configuration](#configure-the-kubectl-ssh-tunnel)
|
||||
|
||||
### Manually
|
||||
### AWS CLI
|
||||
|
||||
The following commands shall use the latest CoreOS alpha AMI for the `us-west-2` region. For a list of different regions and corresponding AMI IDs see the [CoreOS EC2 cloud provider documentation](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
|
||||
#### Create the Kubernetes Security Group
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 create-security-group --group-name kubernetes --description "Kubernetes Security Group"
|
||||
aws ec2 authorize-security-group-ingress --group-name kubernetes --protocol tcp --port 22 --cidr 0.0.0.0/0
|
||||
aws ec2 authorize-security-group-ingress --group-name kubernetes --protocol tcp --port 80 --cidr 0.0.0.0/0
|
||||
@@ -64,19 +68,19 @@ aws ec2 authorize-security-group-ingress --group-name kubernetes --source-securi
|
||||
|
||||
#### Launch the master
|
||||
|
||||
*Attention:* Replace ```<ami_image_id>``` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
*Attention:* replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/).
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 run-instances --image-id <ami_image_id> --key-name <keypair> \
|
||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
||||
--user-data file://master.yaml
|
||||
```
|
||||
|
||||
> Record the `InstanceId` for the master.
|
||||
Record the `InstanceId` for the master.
|
||||
|
||||
Gather the public and private IPs for the master node:
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 describe-instances --instance-id <instance-id>
|
||||
```
|
||||
|
||||
@@ -103,9 +107,9 @@ Edit `node.yaml` and replace all instances of `<master-private-ip>` with the **p
|
||||
|
||||
### Launch 3 worker nodes
|
||||
|
||||
*Attention:* Replace ```<ami_image_id>``` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
*Attention:* Replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 run-instances --count 3 --image-id <ami_image_id> --key-name <keypair> \
|
||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
||||
--user-data file://node.yaml
|
||||
@@ -113,9 +117,9 @@ aws ec2 run-instances --count 3 --image-id <ami_image_id> --key-name <keypair> \
|
||||
|
||||
### Add additional worker nodes
|
||||
|
||||
*Attention:* Replace ```<ami_image_id>``` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
*Attention:* replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 run-instances --count 1 --image-id <ami_image_id> --key-name <keypair> \
|
||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
||||
--user-data file://node.yaml
|
||||
@@ -125,7 +129,7 @@ aws ec2 run-instances --count 1 --image-id <ami_image_id> --key-name <keypair> \
|
||||
|
||||
This command enables secure communication between the kubectl client and the Kubernetes API.
|
||||
|
||||
```
|
||||
```bash
|
||||
ssh -f -nNT -L 8080:127.0.0.1:8080 core@<master-public-ip>
|
||||
```
|
||||
|
||||
@@ -133,7 +137,7 @@ ssh -f -nNT -L 8080:127.0.0.1:8080 core@<master-public-ip>
|
||||
|
||||
Once the worker instances have fully booted, they will be automatically registered with the Kubernetes API server by the kube-register service running on the master node. It may take a few mins.
|
||||
|
||||
```
|
||||
```bash
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
@@ -141,49 +145,47 @@ kubectl get nodes
|
||||
|
||||
Create a pod manifest: `pod.json`
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"id": "hello",
|
||||
"apiVersion": "v1beta3",
|
||||
"kind": "Pod",
|
||||
"apiVersion": "v1beta1",
|
||||
"desiredState": {
|
||||
"manifest": {
|
||||
"version": "v1beta1",
|
||||
"id": "hello",
|
||||
"containers": [{
|
||||
"name": "hello",
|
||||
"image": "quay.io/kelseyhightower/hello",
|
||||
"ports": [{
|
||||
"containerPort": 80,
|
||||
"hostPort": 80
|
||||
}]
|
||||
}]
|
||||
"metadata": {
|
||||
"name": "hello",
|
||||
"labels": {
|
||||
"name": "hello",
|
||||
"environment": "testing"
|
||||
}
|
||||
},
|
||||
"labels": {
|
||||
"name": "hello",
|
||||
"environment": "testing"
|
||||
"spec": {
|
||||
"containers": [{
|
||||
"name": "hello",
|
||||
"image": "quay.io/kelseyhightower/hello",
|
||||
"ports": [{
|
||||
"containerPort": 80,
|
||||
"hostPort": 80
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Create the pod using the kubectl command line tool
|
||||
|
||||
```
|
||||
```bash
|
||||
kubectl create -f pod.json
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```
|
||||
```bash
|
||||
kubectl get pods
|
||||
```
|
||||
|
||||
> Record the **Host** of the pod, which should be the private IP address.
|
||||
Record the **Host** of the pod, which should be the private IP address.
|
||||
|
||||
Gather the public IP address for the worker node.
|
||||
|
||||
```
|
||||
```bash
|
||||
aws ec2 describe-instances --filters 'Name=private-ip-address,Values=<host>'
|
||||
```
|
||||
|
||||
@@ -207,6 +209,6 @@ Visit the public IP address in your browser to view the running pod.
|
||||
|
||||
### Delete the pod
|
||||
|
||||
```
|
||||
```bash
|
||||
kubectl delete pods hello
|
||||
```
|
||||
|
Reference in New Issue
Block a user