Browse Source

Fix namespace

pull/57/head
ant31 8 years ago
parent
commit
5d61b5e813
4 changed files with 24 additions and 7 deletions
  1. 4
      apps.yml
  2. 2
      roles/apps/k8s-common
  3. 4
      roles/kubernetes/master/files/namespace.yml
  4. 21
      roles/kubernetes/master/tasks/main.yml

4
apps.yml

@ -9,6 +9,7 @@
- { role: apps/k8s-elasticsearch, tags: 'elasticsearch' }
- { role: apps/k8s-memcached, tags: 'memcached' }
- { role: apps/k8s-redis, tags: 'redis' }
- { role: apps/k8s-mongodb-simple, tags: 'mongodb-simple' }
# Msg Broker
- { role: apps/k8s-rabbitmq, tags: 'rabbitmq' }
@ -27,3 +28,6 @@
# ETCD
- { role: apps/k8s-etcd, tags: 'etcd'}
# Chat Apps
- { role: apps/k8s-rocketchat, tags: 'rocketchat'}

2
roles/apps/k8s-common

@ -1 +1 @@
Subproject commit c69c5f881fe414f6856f811b9bb40cd19bcf83f4
Subproject commit 8abd4ec3bcdc5f36d96c312f3a424724520a12b8

4
roles/kubernetes/master/files/namespace.yml

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kube-system

21
roles/kubernetes/master/tasks/main.yml

@ -56,15 +56,24 @@
delay: 10
timeout: 60
- name: Create 'kube-system' namespace
uri:
url: http://127.0.0.1:{{ kube_apiserver_insecure_port }}/api/v1/namespaces
method: POST
body: "{{namespace_kubesystem|to_json}}"
status_code: 201,409
- name: copy 'kube-system' namespace manifest
copy: src=namespace.yml dest=/etc/kubernetes/kube-system-ns.yml
run_once: yes
when: inventory_hostname == groups['kube-master'][0]
- name: Check if kube-system exists
command: kubectl get ns kube-system
register: 'kubesystem'
changed_when: False
ignore_errors: yes
run_once: yes
- name: Create 'kube-system' namespace
command: kubectl create -f /etc/kubernetes/kube-system-ns.yml
when: kubesystem|failed
changed_when: False
run_once: yes
- name: Write kube-controller-manager manifest
template:
src: manifests/kube-controller-manager.manifest.j2

Loading…
Cancel
Save