From e74ad80fe4c33219b54894902d491352835d50e8 Mon Sep 17 00:00:00 2001
From: Smaine Kahlouch <smaine.kahlouch@arkena.com>
Date: Sun, 4 Oct 2015 10:55:52 +0200
Subject: [PATCH] Readme v2

---
 README.md                             | 72 ++++++++++++++++++++++++---
 roles/docker/tasks/configure.yml      |  8 ---
 roles/docker/tasks/install.yml        |  5 +-
 roles/docker/templates/debian.list.j2 | 10 ----
 roles/docker/vars/main.yml            |  6 +--
 5 files changed, 69 insertions(+), 32 deletions(-)
 delete mode 100644 roles/docker/templates/debian.list.j2

diff --git a/README.md b/README.md
index 7082b9d83..f4d5e88e9 100644
--- a/README.md
+++ b/README.md
@@ -4,17 +4,58 @@ kubernetes-ansible
 Install and configure a kubernetes cluster including network overlay and optionnal addons.
 Based on [CiscoCloud](https://github.com/CiscoCloud/kubernetes-ansible) work.
 
-Requirements
-------------
+### Requirements
 Tested on debian Jessie and Ubuntu.
 The target servers must have access to the Internet in order to pull docker imaqes
 
+Ansible v1.9.x
+
+### Components
+* [kubernetes]('https://github.com/kubernetes/kubernetes/releases') v1.0.6
+* [etcd]('https://github.com/coreos/etcd/releases') v2.2.0
+* [calicoctl]('https://github.com/projectcalico/calico-docker/releases') v0.5.1
+* [flanneld]('https://github.com/coreos/flannel/releases') v0.5.3
+* [docker-gc]('https://github.com/spotify/docker-gc')
+
 
 Ansible
 -------------------------
-## Variables
+### Download binaries
+A role allows to download required binaries which will be stored in a directory defined by the variable
+'local_release_dir' (by default /tmp).
+Please ensure that you have enough disk space there (about 1G).
+
+Note: Whenever you'll need to change the version of a software, you'll have to erase the content of this directory.
+
+
+### Variables
+
+### Playbook
+```
+---
+- hosts: downloader
+  sudo: no
+  roles:
+    - { role: download, tags: download }
+
+- hosts: k8s-cluster
+  roles:
+    - { role: etcd, tags: etcd }
+    - { role: docker, tags: docker }
+    - { role: overlay_network, tags: ['calico', 'flannel', 'network'] }
+    - { role: dnsmasq, tags: dnsmasq }
 
-## Run ansible playbook
+- hosts: kube-master
+  roles:
+    - { role: kubernetes/master, tags: master }
+    - { role: addons, tags: addons }
+
+- hosts: kube-node
+  roles:
+    - { role: kubernetes/node, tags: node }
+```
+
+### Run
 It is possible to define variables for different environments.
 For instance, in order to deploy the cluster on 'dev' environment run the following command.
 ```
@@ -23,16 +64,31 @@ ansible-playbook -i environments/dev/inventory cluster.yml
 
 Kubernetes
 -------------------------
-## Check cluster status
+### Check cluster status
+
+### Network Overlay
+You can choose between 2 network overlays. Only one must be chosen.
+flannel: gre/vxlan (layer 2) networking
+calico: bgp (layer 3) networking.
+
+### Expose a service
+There are several loadbalancing solution.
+The main ones i found suitable for kubernetes are [Vulcand]('http://vulcand.io/') and [Haproxy]('http://www.haproxy.org/')
+
+My cluster is working with haproxy and kubernetes services are configured with the loadbalancing type 'nodePort'.
+eg: each node opens the same tcp port and forwards the traffic to the target pod wherever it is located.
+
+Then Haproxy can be configured to request kubernetes's api in order to loadbalance on the proper tcp port on the nodes.
 
+Please refer to the proper kubernetes documentation on [Services]('https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/services.md')
 
 Known issues
 -------------
-## Node reboot and Calico
+### Node reboot and Calico
 
-## Monitoring addon
+### Monitoring addon
 
-## Etcd failover
+### Etcd failover
 
 Author Information
 ------------------
diff --git a/roles/docker/tasks/configure.yml b/roles/docker/tasks/configure.yml
index 0cf255522..c095d5572 100644
--- a/roles/docker/tasks/configure.yml
+++ b/roles/docker/tasks/configure.yml
@@ -31,11 +31,3 @@
 #    docker login --username={{ dockerhub_user }}
 #    --password={{ dockerhub_pass }}
 #    --email={{ dockerhub_email }}
-
-#- pause: prompt='WARNING The next task will remove all exited containers, enter to continue'
-#
-#- name: Purge all exited containers
-#  shell: >
-#    if [ ! -z "$(docker ps -aq -f status=exited)" ]; then
-#    docker rm $(docker ps -aq -f status=exited);
-#    fi
diff --git a/roles/docker/tasks/install.yml b/roles/docker/tasks/install.yml
index 2bb29c249..5acb9b89c 100644
--- a/roles/docker/tasks/install.yml
+++ b/roles/docker/tasks/install.yml
@@ -1,7 +1,4 @@
 ---
-- name: Configure debian distribution apt repository
-  template: src=debian.list.j2 dest=/etc/apt/sources.list.d/{{ ansible_distribution_release }}.list
-
 - name: Install prerequisites for https transport
   apt: pkg={{ item }} state=present update_cache=yes
   with_items:
@@ -28,6 +25,8 @@
 
 - name: Copy Docker garbage collection script
   copy: src=docker-gc dest={{ bin_dir }}/docker-gc mode=700
+  when: enable_docker_gc
 
 - name: Copy Cron for garbage collection script 
   template: src=cron_docker-gc.j2 dest=/etc/cron.hourly/cron_docker-gc
+  when: enable_docker_gc
diff --git a/roles/docker/templates/debian.list.j2 b/roles/docker/templates/debian.list.j2
deleted file mode 100644
index b831e18d0..000000000
--- a/roles/docker/templates/debian.list.j2
+++ /dev/null
@@ -1,10 +0,0 @@
-deb http://debian.arkena.net/debian/ {{ ansible_distribution_release }} main contrib non-free
-deb-src http://debian.arkena.net/debian/ {{ ansible_distribution_release }} main contrib non-free
-deb http://debian.arkena.net/debian/ {{ ansible_distribution_release }}-updates main contrib non-free
-deb-src http://debian.arkena.net/debian/ {{ ansible_distribution_release }}-updates main contrib non-free
-deb http://debian.arkena.net/debian-security/ {{ ansible_distribution_release }}/updates main contrib non-free
-deb-src http://debian.arkena.net/debian-security {{ ansible_distribution_release }}/updates main contrib non-free
-deb http://debian.arkena.net/debian/ {{ ansible_distribution_release }}-backports main contrib
-deb-src http://debian.arkena.net/debian/ {{ ansible_distribution_release }}-backports main contrib
-deb http://debian.arkena.net/debian-smartjog/ {{ ansible_distribution_release }} smartjog
-deb-src http://debian.arkena.net/debian-smartjog/ {{ ansible_distribution_release }} smartjog
diff --git a/roles/docker/vars/main.yml b/roles/docker/vars/main.yml
index a47ed8dda..cc5ecdb5d 100644
--- a/roles/docker/vars/main.yml
+++ b/roles/docker/vars/main.yml
@@ -1,4 +1,4 @@
 ---
-dockerhub_user: arkenadev
-dockerhub_pass: 4rk3n4d3v
-dockerhub_email: smaine.kahlouch@gmail.com 
+#dockerhub_user:
+#dockerhub_pass:
+#dockerhub_email:
-- 
GitLab