Kubernetes in 5 Minutes
So you want to run Kubernetes, but you don't want to read all of the complicated documentation that Google has provided? You're definitely not alone. In fact, all of us have felt this frustration at one point or another. Just give us a simple, easy-to-use example already!
Well, here it is for OS X users. (I'll provide information for other platforms later, so stay tuned.)
Prerequisites
Install the following software:
Bring Up Kubernetes
Now, create a file on your OS X or Linux workstation:
OSXHOST:~ user$ mkdir -p ~/Documents/microservices-lab/kubernetes/
OSXHOST:~ user$ cd ~/Documents/microservices-lab/kubernetes/
OSXHOST:~ user$ vi kube.env
export NUM_MINIONS=3
export KUBERNETES_PROVIDER=vagrant
export export KUBERNETES_MINION_MEMORY=2048
OSXHOST:~ user$ chmod u+x kube.env
You can modify the number of minions or memory as you choose. Use the getting started guide provided by the Kubernetes team for additional options.
Enter the following command to build your Kubernetes local Vagrant demo:
OSXHOST:~ user$ cd ~/Documents/microservices-lab/kubernetes/
OSXHOST:~ user$ . kube.env
OSXHOST:~ user$ curl -sS https://get.k8s.io | bash
And that will build the environment automatically for you. Once that is done, you will get instructions on your lab.
Guestbook Example
Next, you will want to show something. Guestbook is perfect for this with a working environment, but it's in a bunch of ugly YAML files, so let's take a shortcut.
OSXHOST:~ user$ vi ~/Documents/microservices-lab/kubernetes/kubernetes/examples/guestbookguest_up.sh
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/redis-master-controller.yaml
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/redis-master-service.yaml
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/redis-slave-controller.yaml
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/redis-slave-service.yaml
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/frontend-controller.yaml
kubectl create -f ~/Documents/microservices-lab/kubernetes/kubernetes/examples/frontend-service.yaml
OSXHOST:~ user$
OSXHOST:~ user$ chmod u+x ~/Documents/microservices-lab/kubernetes/kubernetes/examples/guestbookguest_up.sh
And then run it.
OSXHOST:~ user$ ~/Documents/microservices-lab/kubernetes/kubernetes/examples/guestbookguest_up.sh
Now you should be able to access access Guestbook! Read more at Guestbook Example