Creating a Kubernetes Cluster¶
Kubernetes’ documentation describes the many ways to set up a cluster. Here, we shall provide quick instructions for the most painless and popular ways of getting setup in various cloud providers:
Amazon EC2
Red Hat OpenShift
Others
Setting up Kubernetes on Google Cloud¶
Google Container Engine (confusingly abbreviated to GKE) is the simplest and most common way of setting up a Kubernetes Cluster. You may be able to receive free credits for trying it out. You will need to connect your credit card or other payment method to your google cloud account.
Go to
https://console.cloud.google.com
.Click the hamburger icon in the top left (the icon has three horizontal lines in one button). Go to “Billing” then “Payment Methods”, and make sure you have a credit card linked to the account. (You may also receive $300 in trial credits.)
Install and initialize the gcloud command-line tools. These tools send commands to Google Cloud and lets you do things like create and delete clusters.
Go to the gcloud downloads page to download and install the gcloud SDK.
See the gcloud documentation for more information on the gcloud SDK.
Install
kubectl
, which is a tool for controlling kubernetes. From the terminal, enter:gcloud components install kubectl
Create a Kubernetes cluster on Google Cloud, by typing in the following command:
gcloud container clusters create <YOUR_CLUSTER> \ --num-nodes=3 \ --machine-type=n1-standard-2 \ --zone=us-central1-b
where:
--num-nodes
specifies how many computers to spin up. The higher the number, the greater the cost.--machine-type
specifies the amount of CPU and RAM in each node. There is a variety of types to choose from. Picking something appropriate here will have a large effect on how much you pay - smaller machines restrict the max amount of RAM each user can have access to but allow more fine-grained scaling, reducing cost. The default (n1-standard-2) has 2CPUs and 7.5G of RAM each, and might not be a good fit for all use cases!--zone
specifies which data center to use. Pick something that is not too far away from your users. You can find a list of them here.
To test if your cluster is initialized, run:
kubectl get node
The response should list three running nodes.
Setting up Kubernetes on Microsoft Azure Container Service (ACS)¶
Note
This is an alpha work-in-progress - please do not use in production! Help from people with more Azure experience would be highly welcome :)
Install and initialize the Azure command-line tools, which send commands to Azure and let you do things like create and delete clusters.
Go to the azure-cli github repo to download and install the azure-cli tools.
See the az documentation for more information on using the
az
tool with the Azure Container Service.
Authenticate the
az
tool so it may access your Azure account:az login
Specify a Azure resource group, and create one if it doesn’t already exist:
export RESOURCE_GROUP=<YOUR_RESOURCE_GROUP> export LOCATION=<YOUR_LOCATION> az group create --name=${RESOURCE_GROUP} --location=${LOCATION}
where:
--name
specifies your Azure resource group. If a group doesn’t exist, az will create it for you.
--location
specifies which computer center to use. To reduce latency, choose a zone closest to whoever is sending the commands. View available zones viaaz account list-locations
.
Install
kubectl
, a tool for controlling Kubernetes:az acs kubernetes install-cli
Create a Kubernetes cluster on Azure, by typing in the following commands:
export CLUSTER_NAME=<YOUR_CLUSTER_NAME> export DNS_PREFIX=<YOUR_PREFIX> az acs create --orchestrator-type=kubernetes \ --resource-group=${RESOURCE_GROUP} \ --name=${CLUSTER_NAME} \ --dns-prefix=${DNS_PREFIX}
Authenticate kubectl:
az acs kubernetes get-credentials \ --resource-group=${RESOURCE_GROUP} \ --name=${CLUSTER_NAME}
where:
--resource-group
specifies your Azure resource group.
--name
is your ACS cluster name.
--dns-prefix
is the domain name prefix for the cluster.
To test if your cluster is initialized, run:
kubectl get node
The response should list three running nodes.
Next Step¶
Now that you have a Kubernetes cluster running, it is time to set up helm.