From 471dad44b68a5cbf7acb00a721a35b5df59bf7c0 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 18 Nov 2015 15:56:13 +0100 Subject: [PATCH 1/7] Add kubedash and monitoring submodule --- .gitmodules | 9 +++++++++ roles/apps/k8s-heapster | 1 + roles/apps/k8s-influxdb | 1 + roles/apps/k8s-kubedash | 1 + 4 files changed, 12 insertions(+) create mode 160000 roles/apps/k8s-heapster create mode 160000 roles/apps/k8s-influxdb create mode 160000 roles/apps/k8s-kubedash diff --git a/.gitmodules b/.gitmodules index 9f2a1cb03..5380c0eb3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,3 +29,12 @@ path = roles/apps/k8s-postgres url = https://github.com/ansibl8s/k8s-postgres.git branch = v1.0 +[submodule "roles/apps/k8s-kubedash"] + path = roles/apps/k8s-kubedash + url = https://github.com/ansibl8s/k8s-kubedash.git +[submodule "roles/apps/k8s-heapster"] + path = roles/apps/k8s-heapster + url = https://github.com/ansibl8s/k8s-heapster.git +[submodule "roles/apps/k8s-influxdb"] + path = roles/apps/k8s-influxdb + url = https://github.com/ansibl8s/k8s-influxdb.git diff --git a/roles/apps/k8s-heapster b/roles/apps/k8s-heapster new file mode 160000 index 000000000..dc088e25e --- /dev/null +++ b/roles/apps/k8s-heapster @@ -0,0 +1 @@ +Subproject commit dc088e25efcd040e127543b861448aa0d219eac9 diff --git a/roles/apps/k8s-influxdb b/roles/apps/k8s-influxdb new file mode 160000 index 000000000..38d54c48e --- /dev/null +++ b/roles/apps/k8s-influxdb @@ -0,0 +1 @@ +Subproject commit 38d54c48e76df2951d60a6e17a40d5a3d69a1e81 diff --git a/roles/apps/k8s-kubedash b/roles/apps/k8s-kubedash new file mode 160000 index 000000000..64385696a --- /dev/null +++ b/roles/apps/k8s-kubedash @@ -0,0 +1 @@ +Subproject commit 64385696a907f8052cd455b85302fbd2d0bab129 From 10ade2cbdcafbffc8006d2beaca1685c991261bc Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 18 Nov 2015 16:00:47 +0100 Subject: [PATCH 2/7] Update requirements.yml file --- requirements.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/requirements.yml b/requirements.yml index bcbaea847..b3406fd88 100644 --- a/requirements.yml +++ b/requirements.yml @@ -30,3 +30,12 @@ #- src: https://github.com/ansibl8s/k8s-postgres.git # path: roles/apps # version: v1.0 +# +#- src: https://github.com/ansibl8s/k8s-heapster.git +# path: roles/apps +# +#- src: https://github.com/ansibl8s/k8s-influxdb.git +# path: roles/apps +# +#- src: https://github.com/ansibl8s/k8s-kubedash.git +# path: roles/apps From b45261b7630548e8ecdda817a5eee9d3571144d2 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 18 Nov 2015 21:38:27 +0100 Subject: [PATCH 3/7] remove duplicate task --- roles/docker/tasks/configure.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/roles/docker/tasks/configure.yml b/roles/docker/tasks/configure.yml index 07506dec1..10d5b6e75 100644 --- a/roles/docker/tasks/configure.yml +++ b/roles/docker/tasks/configure.yml @@ -7,15 +7,6 @@ command: /etc/network/if-up.d/create_cbr when: kube_network_plugin is defined and kube_network_plugin == "calico" -- name: Configure docker to use cbr0 bridge - lineinfile: - dest=/etc/default/docker - regexp='.*DOCKER_OPTS=.*' - line='DOCKER_OPTS="--bridge=cbr0 --iptables=false --ip-masq=false"' - notify: - - restart docker - when: kube_network_plugin is defined and kube_network_plugin == "calico" - - name: enable docker service: name: docker From 5319f23e73c1e9abf5dca4d6a4f2977a03ac2768 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Wed, 18 Nov 2015 22:36:56 +0100 Subject: [PATCH 4/7] include kubernetes config --- .../master/templates/systemd-init/kube-proxy.service.j2 | 1 + .../node/templates/systemd-init/kube-proxy.service.j2 | 1 + roles/kubernetes/node/templates/systemd-init/kubelet.service.j2 | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes/master/templates/systemd-init/kube-proxy.service.j2 b/roles/kubernetes/master/templates/systemd-init/kube-proxy.service.j2 index cc3fdc77c..b1170c5d8 100644 --- a/roles/kubernetes/master/templates/systemd-init/kube-proxy.service.j2 +++ b/roles/kubernetes/master/templates/systemd-init/kube-proxy.service.j2 @@ -8,6 +8,7 @@ After=docker.service {% endif %} [Service] +EnvironmentFile=/etc/kubernetes/config EnvironmentFile=/etc/network-environment ExecStart={{ bin_dir }}/kube-proxy \ $KUBE_LOGTOSTDERR \ diff --git a/roles/kubernetes/node/templates/systemd-init/kube-proxy.service.j2 b/roles/kubernetes/node/templates/systemd-init/kube-proxy.service.j2 index cc3fdc77c..b1170c5d8 100644 --- a/roles/kubernetes/node/templates/systemd-init/kube-proxy.service.j2 +++ b/roles/kubernetes/node/templates/systemd-init/kube-proxy.service.j2 @@ -8,6 +8,7 @@ After=docker.service {% endif %} [Service] +EnvironmentFile=/etc/kubernetes/config EnvironmentFile=/etc/network-environment ExecStart={{ bin_dir }}/kube-proxy \ $KUBE_LOGTOSTDERR \ diff --git a/roles/kubernetes/node/templates/systemd-init/kubelet.service.j2 b/roles/kubernetes/node/templates/systemd-init/kubelet.service.j2 index 5b309c793..338b4b23c 100644 --- a/roles/kubernetes/node/templates/systemd-init/kubelet.service.j2 +++ b/roles/kubernetes/node/templates/systemd-init/kubelet.service.j2 @@ -8,7 +8,7 @@ After=docker.service {% endif %} [Service] -#WorkingDirectory=/var/lib/kubelet +EnvironmentFile=/etc/kubernetes/config EnvironmentFile=/etc/network-environment ExecStart={{ bin_dir }}/kubelet \ $KUBE_LOGTOSTDERR \ From 1a0208f44884c9d14ee3695e7f14cf9c9a296e50 Mon Sep 17 00:00:00 2001 From: ant31 <2t.antoine@gmail.com> Date: Thu, 19 Nov 2015 22:49:02 +0100 Subject: [PATCH 5/7] Separate apps deploy from cluster deploy --- apps.yml | 18 ++++++++++++++++++ cluster.yml | 6 ------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 apps.yml diff --git a/apps.yml b/apps.yml new file mode 100644 index 000000000..b0c4be06e --- /dev/null +++ b/apps.yml @@ -0,0 +1,18 @@ +--- +- hosts: kube-master + roles: + # System + - { role: apps/k8s-kubedns, tags: ['kubedns', 'apps'] } + + # Databases + - { role: apps/k8s-postgres, tags: ['postgres', 'apps'] } + - { role: apps/k8s-elasticsearch, tags: ['es', 'apps'] } + + # Monitoring + - { role: apps/k8s-influxdb, tags: ['influxdb', 'apps']} + - { role: apps/k8s-heapster, tags: ['heapster', 'apps']} + - { role: apps/k8s-kubedash, tags: ['kubedash', 'apps']} + + # Console + - { role: apps/k8s-fabric8, tags: ['fabric8', 'apps'] } + - { role: apps/k8s-kube-ui, tags: ['kube-ui', 'apps'] } \ No newline at end of file diff --git a/cluster.yml b/cluster.yml index 421f642de..63ad7de5d 100644 --- a/cluster.yml +++ b/cluster.yml @@ -18,9 +18,3 @@ - hosts: kube-node roles: - { role: kubernetes/node, tags: node } - -#- hosts: kube-master -# roles: - # Apps to be installed - # - { role: apps/k8s-kubedns, tags: ['kubedns', 'apps'] } - # - { role: apps/k8s-fabric8, tags: ['fabric8', 'apps'] } From 34419d6bae522895d48fc496b02012adafdcd699 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Fri, 20 Nov 2015 11:01:50 +0100 Subject: [PATCH 6/7] README update, 1 distinct playbook for apps --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d5f16d930..616c83363 100644 --- a/README.md +++ b/README.md @@ -203,13 +203,15 @@ grep path .gitmodules | sed 's/.*= //' ``` For instance if you will probably want to install a [dns server](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns) as it is **strongly recommanded**. +Please refer to the [k8s-kubdns readme](https://github.com/ansibl8s/k8s-kubedns) for additionnal info. + In order to use this role you'll need to follow these steps ``` git submodule init roles/apps/k8s-common roles/apps/k8s-kubedns git submodule update ``` -Finally update your playbook with the chosen role, and run it +Finally update the playbook ```apps.yml``` with the chosen roles, and run it ``` ... - hosts: kube-master @@ -217,7 +219,11 @@ Finally update your playbook with the chosen role, and run it - { role: apps/k8s-kubedns, tags: ['kubedns', 'apps'] } ... ``` -Please refer to the [k8s-kubdns readme](https://github.com/ansibl8s/k8s-kubedns) for additionnal info. + +``` +ansible-playbook -i environments/dev/inventory apps.yml -u root +``` + #### Calico networking Check if the calico-node container is running From 4dd85b5078112d68c8773a922c6e09aa0cb06075 Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Sat, 21 Nov 2015 17:00:41 +0100 Subject: [PATCH 7/7] move task service kube-api to the end of role master --- roles/kubernetes/master/tasks/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/kubernetes/master/tasks/config.yml b/roles/kubernetes/master/tasks/config.yml index 70c0f2d3f..ed24a762c 100644 --- a/roles/kubernetes/master/tasks/config.yml +++ b/roles/kubernetes/master/tasks/config.yml @@ -62,12 +62,6 @@ notify: - restart apiserver -- name: Enable apiserver - service: - name: kube-apiserver - enabled: yes - state: started - - name: Enable controller-manager service: name: kube-controller-manager @@ -85,3 +79,9 @@ name: kube-proxy enabled: yes state: started + +- name: Enable apiserver + service: + name: kube-apiserver + enabled: yes + state: started