- You need an AWS account. Visit http://aws.amazon.com to get started
- Install and configure AWS Command Line Interface
- You need an AWS instance profile and role with EC2 full access.
#Using wget
export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash
#Using cURL
export KUBERNETES_PROVIDER=aws; curl -sS https://get.k8s.io | bash
NOTE: This script calls cluster/kube-up.sh which in turn calls cluster/aws/util.sh using cluster/aws/config-default.sh.
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.
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.
You can override the variables defined in config-default.sh to change this behavior as follows:
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
...
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.
NOTE: If using an existing keypair named "kubernetes" then you must set the AWS_SSH_KEY
key to point to your private key.
A contributed example allows you to setup a Kubernetes cluster based on CoreOS, either using AWS CloudFormation or EC2 with user data (cloud-config).
Copy the appropriate kubectl
binary to any location defined in your PATH
environment variable, for example:
# OS X
sudo cp kubernetes/platforms/darwin/amd64/kubectl /usr/local/bin/kubectl
# Linux
sudo cp kubernetes/platforms/linux/amd64/kubectl /usr/local/bin/kubectl
An up-to-date documentation page for this tool is available here: kubectl manual
By default, kubectl
will use the kubeconfig
file generated during the cluster startup for authenticating against the API.
For more information, please read kubeconfig files
See a simple nginx example to try out your new cluster.
The "Guestbook" application is another popular example to get started with Kubernetes: guestbook example
For more complete applications, please look in the examples directory
Make sure the environment variables you used to provision your cluster are still exported, then call the following script inside the
kubernetes
directory:
cluster/kube-down.sh
Please see the Kubernetes docs for more details on administering and using a Kubernetes cluster.