Here, I am going to transcribe my notes about how we deployed and tested Kubernetes basics in less than an hour.
First of all you need a DigitalOcean account and you have to deploy the Docker APP VM. I like DigitalOcean because it is fast, cheap and clean, but you can use Docker installation wherever you want, for example in Kubernetes doc they use OS X.
In this test you need a GCE (Google Computing engine) account too, because we are going to deploy VMs (minions) on this platform.
I have mentioned minions, let's clarify this point, because Kubernetes has its own naming system.
- Container: A portable, lightweight runtime that enables apps to be quickly assembled.
- Master: This term is used to identify the machine which manages the application as a whole. A master manages one or more minions.
- Minion: A virtual machine that runs Docker containers and thus the end-user workloads. A minion will run one or more Pods.
- Pod: An individual application, or part of an application, that runs on a single minion (VM). Pods are balanced across the minions by the master to support scalability.
- Label: An arbitrary set of key-value pairs attached to pods that are used to help organize your clusters.
- Replication controller: Manage failures and scalability by ensuring that an appropriate number of Pod deployments are available in the data center at any given time.
When we have our DigitalOcean VM and our GCE accounts created, it is time to execute the following commands in order to deploy Kubernetes.
Install and configure GCE tools on DigitalOcean VM
#Download and install the tools
curl https://sdk.cloud.google.com | bash
#Log into GCE
gcloud auth login
#Set the project, project identifier is in the main overview dashboard
gcloud config set project PROJECT
Install Kubernetes on DigitalOcean VM
The doc provided in https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/gce.md is enough, but you have to read it carefully, as I wrote at the begining of this post these are my notes, I hope it can be useful to you:
#Clone repository on your prefered directory it is going to be /opt/ for us.
git clone https://github.com/GoogleCloudPlatform/kubernetes.git
#Install tools in order to build Kubernetes Images
apt-get install make
apt-get install build-essential
#On directory /opt/kubernetes/ execute
In the building process, it is going to tell you where the master node and Grafana (cluster monitor) is running:
Kubernetes cluster is running. The master is running at:
Grafana dashboard will be available at http://184.108.40.206. Wait for the monitoring dashboard to be online.
The password needed to access to the cluster is located in your home directory
The username and password to use is located in ~/.kubernetes_auth.
root@docker-kubernetes:~/kubernetes/kubernetes# cat ~/.kubernetes_auth
This password is valid for Grafana dashboard too.
It is time to start the Docker/Kubernetes cluster, with the following command:
You can modify the default parameters in this file:
In order to deploy the containers (PODs), run the following:
cluster/kubecfg.sh -p 8080:80 run dockerfile/nginx 2 myNginx
This command creates two nginx pods listening on 8080 TCP port, be careful because by default GCE doesn't allow this port in their firewall, to open it, execute this command:
gcloud compute firewall-rules create test --allow tcp:8080
To list pods and their state, use the following command:
cluster/kubecfg.sh list pods
Finally let me say that Kubernetes is a very new software and it isn't yet mature and it can change in the next months, but it looks very promising for large and very large scale containers deployments.