Tag: docker

Running Kubernetes on Debian

I couldn’t find a very straight forward manual on how to get Kubernetes running on a Debian (Jessie) system therefore decided to write it down mainly for myself nevertheless it may be useful for other beginners like me.

First of all, get your system up to date

apt-get update
apt-get upgrade

Install dependencies

apt-get install gcc golang-go curl git

Get ETCD (get updated version here – https://github.com/coreos/etcd/releases/)

curl -L  https://github.com/coreos/etcd/releases/download/v2.0.3/etcd-v2.0.3-linux-amd64.tar.gz -o etcd-v2.0.3-linux-amd64.tar.gz
tar xzvf etcd-v2.0.3-linux-amd64.tar.gz
cd etcd-v2.0.3-linux-amd64

You may want to test if etcd is working

./etcd

stop etcd (Ctrl+C) and copy the binary to /usr/bin

cp etcd /usr/bin/etcd

Now get the latest Kubernetes release

git clone https://github.com/GoogleCloudPlatform/kubernetes.git
cd kubernetes
make release

You will be asked to download docker image (450MB)
In the end you should see something like this

...
+++ Integration test cleanup complete
+++ Integration test cleanup complete
+++ Running build command....
+++ Output directory is local. No need to copy results out.
+++ Building tarball: client darwin-386
+++ Building tarball: client darwin-amd64
+++ Building tarball: client linux-386
+++ Building tarball: client linux-amd64
+++ Building tarball: client linux-arm
+++ Building tarball: client windows-amd64
+++ Building tarball: server linux-amd64
+++ Building tarball: salt
+++ Building tarball: test
+++ Building tarball: full

Now the last step – to start the cluster

 hack/local-up-cluster.sh

You should see this in your terminal

+++ Building go targets for linux/amd64:
 cmd/kube-proxy
 cmd/kube-apiserver
 cmd/kube-controller-manager
 cmd/kubelet
 plugin/cmd/kube-scheduler
 cmd/kubectl
 cmd/kubernetes
 cmd/e2e
 cmd/integration
 cmd/gendocs
+++ Placing binaries
Starting etcd

etcd -data-dir /tmp/test-etcd.FoRYZH --bind-addr 127.0.0.1:4001 >/dev/null 2>/dev/null

Waiting for etcd to come up.
+++ etcd:
{"action":"set","node":{"key":"/_test","value":"","modifiedIndex":3,"createdIndex":3}}
Waiting for apiserver to come up
+++ apiserver:
 {
 "kind":
 "PodList",
 "creationTimestamp":
 null,
 "selfLink":
 "/api/v1beta1/pods",
 "resourceVersion":
 8,
 "apiVersion":
 "v1beta1",
 "items":
 []
 }
Local Kubernetes cluster is running. Press Ctrl-C to shut it down.

Logs:
 /tmp/kube-apiserver.log
 /tmp/kube-controller-manager.log
 /tmp/kubelet.log
 /tmp/kube-proxy.log
 /tmp/kube-scheduler.log

To start using your cluster, open up another terminal/tab and run:

 cluster/kubectl.sh config set-cluster local --server=http://127.0.0.1:8080 --insecure-skip-tls-verify=true --global
 cluster/kubectl.sh config set-context local --cluster=local --global
 cluster/kubectl.sh config use-context local
 cluster/kubectl.sh

Now you can use scripts from directory “cluster” to manage pods

I was successful with this example – https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/guestbook

Advertisements