Readme v2

pull/6/head
Smaine Kahlouch 2015-10-04 10:55:52 +02:00
parent 89a25fa3fa
commit e74ad80fe4
5 changed files with 69 additions and 32 deletions

View File

@ -4,17 +4,58 @@ kubernetes-ansible
Install and configure a kubernetes cluster including network overlay and optionnal addons. Install and configure a kubernetes cluster including network overlay and optionnal addons.
Based on [CiscoCloud](https://github.com/CiscoCloud/kubernetes-ansible) work. Based on [CiscoCloud](https://github.com/CiscoCloud/kubernetes-ansible) work.
Requirements ### Requirements
------------
Tested on debian Jessie and Ubuntu. Tested on debian Jessie and Ubuntu.
The target servers must have access to the Internet in order to pull docker imaqes 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 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).
## Run ansible playbook 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 }
- 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. It is possible to define variables for different environments.
For instance, in order to deploy the cluster on 'dev' environment run the following command. 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 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 Known issues
------------- -------------
## Node reboot and Calico ### Node reboot and Calico
## Monitoring addon ### Monitoring addon
## Etcd failover ### Etcd failover
Author Information Author Information
------------------ ------------------

View File

@ -31,11 +31,3 @@
# docker login --username={{ dockerhub_user }} # docker login --username={{ dockerhub_user }}
# --password={{ dockerhub_pass }} # --password={{ dockerhub_pass }}
# --email={{ dockerhub_email }} # --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

View File

@ -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 - name: Install prerequisites for https transport
apt: pkg={{ item }} state=present update_cache=yes apt: pkg={{ item }} state=present update_cache=yes
with_items: with_items:
@ -28,6 +25,8 @@
- name: Copy Docker garbage collection script - name: Copy Docker garbage collection script
copy: src=docker-gc dest={{ bin_dir }}/docker-gc mode=700 copy: src=docker-gc dest={{ bin_dir }}/docker-gc mode=700
when: enable_docker_gc
- name: Copy Cron for garbage collection script - name: Copy Cron for garbage collection script
template: src=cron_docker-gc.j2 dest=/etc/cron.hourly/cron_docker-gc template: src=cron_docker-gc.j2 dest=/etc/cron.hourly/cron_docker-gc
when: enable_docker_gc

View File

@ -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

View File

@ -1,4 +1,4 @@
--- ---
dockerhub_user: arkenadev #dockerhub_user:
dockerhub_pass: 4rk3n4d3v #dockerhub_pass:
dockerhub_email: smaine.kahlouch@gmail.com #dockerhub_email: