From c26d2e17cde7769bbbbe83bc4bbfbfbe2016a0de Mon Sep 17 00:00:00 2001 From: Smaine Kahlouch Date: Mon, 5 Oct 2015 11:27:13 +0200 Subject: [PATCH] Addon Fabric8 --- README.md | 13 +++- environments/dev/group_vars/k8s-cluster.yml | 3 + .../production/group_vars/k8s-cluster.yml | 3 + roles/addons/files/fabric8-rc.yaml | 69 ++++++++++++++++++ roles/addons/files/fabric8-svc-accounts.yaml | 9 +++ roles/addons/files/fabric8-svc.yaml | 19 +++++ roles/addons/files/fabric8-templates-rc.yaml | 57 +++++++++++++++ roles/addons/files/fabric8-templates-svc.yaml | 19 +++++ roles/addons/tasks/fabric8.yml | 72 +++++++++++++++++++ roles/addons/tasks/main.yml | 3 + 10 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 roles/addons/files/fabric8-rc.yaml create mode 100644 roles/addons/files/fabric8-svc-accounts.yaml create mode 100644 roles/addons/files/fabric8-svc.yaml create mode 100644 roles/addons/files/fabric8-templates-rc.yaml create mode 100644 roles/addons/files/fabric8-templates-svc.yaml create mode 100644 roles/addons/tasks/fabric8.yml diff --git a/README.md b/README.md index c92c1bb39..668749a4f 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ Install and configure a kubernetes cluster including network overlay and optionn Based on [CiscoCloud](https://github.com/CiscoCloud/kubernetes-ansible) work. ### Requirements -Tested on debian Jessie and Ubuntu. +Tested on **Debian Jessie** and **Ubuntu** (14.10, 15.04, 15.10). The target servers must have access to the Internet in order to pull docker imaqes +The firewalls are not managed, you'll need to implement your own rules the way you used to. Ansible v1.9.x @@ -108,6 +109,14 @@ iptables -nLv -t nat ``` +#### Available addons +By default 2 addons are enabled +* [Kube-ui](https://github.com/kubernetes/kube-ui) which is a simple dashboard which shows kubernete's components, url : ``` http://[master_ip]:8080/ui``` +* [Fabric8](http://fabric8.io/), console management for kubernetes : ```http://[master_ip]:8080/api/v1/proxy/namespaces/kube-system/services/fabric8``` + +Other addons : logging, monitoring + + #### Calico networking Check if the calico-node container is running ``` @@ -161,7 +170,7 @@ kubectl exec busybox -- nslookup kubernetes.default ``` You should get an answer from the configured dns server -Congrats ! now you can go through [kubernetes basics](http://kubernetes.io/v1.0/basicstutorials.html) +Congrats ! now you can walk through [kubernetes basics](http://kubernetes.io/v1.0/basicstutorials.html) Known issues ------------- diff --git a/environments/dev/group_vars/k8s-cluster.yml b/environments/dev/group_vars/k8s-cluster.yml index f32ef5fe6..65a46a6f7 100644 --- a/environments/dev/group_vars/k8s-cluster.yml +++ b/environments/dev/group_vars/k8s-cluster.yml @@ -57,6 +57,9 @@ dns_replicas: 2 # Set to 'false' to disable default Kubernetes UI setup enable_ui: true +# Set to 'false' to disable Fabric8 console setup +enable_fabric8: true + # Set to 'false' to disable default Elasticsearch + Kibana logging setup enable_logging: false diff --git a/environments/production/group_vars/k8s-cluster.yml b/environments/production/group_vars/k8s-cluster.yml index f1da759a9..087cb99fa 100644 --- a/environments/production/group_vars/k8s-cluster.yml +++ b/environments/production/group_vars/k8s-cluster.yml @@ -57,6 +57,9 @@ # Set to 'false' to disable default Kubernetes UI setup # enable_ui: true +# Set to 'false' to disable Fabric8 console setup +# enable_fabric8: true + # Set to 'false' to disable default Elasticsearch + Kibana logging setup # enable_logging: false diff --git a/roles/addons/files/fabric8-rc.yaml b/roles/addons/files/fabric8-rc.yaml new file mode 100644 index 000000000..d9ef2b9d9 --- /dev/null +++ b/roles/addons/files/fabric8-rc.yaml @@ -0,0 +1,69 @@ +apiVersion: "v1" +kind: "ReplicationController" +metadata: + annotations: {} + labels: + component: "console" + provider: "fabric8" + name: "fabric8" + namespace: "kube-system" +spec: + replicas: 1 + selector: + component: "console" + provider: "fabric8" + template: + metadata: + annotations: {} + labels: + component: "console" + provider: "fabric8" + spec: + containers: + - + args: [] + command: [] + env: + - + name: "OAUTH_PROVIDER" + value: "basic" + - + name: "OAUTH_AUTHORIZE_URI" + value: "https://vagrant.f8:8443/oauth/authorize" + - + name: "GOOGLE_OAUTH_CLIENT_SECRET" + value: "" + - + name: "GOOGLE_OAUTH_REDIRECT_URI" + value: "https://fabric8.vagrant.f8" + - + name: "OAUTH_CLIENT_ID" + value: "fabric8" + - + name: "GOOGLE_OAUTH_AUTHENTICATION_URI" + value: "https://accounts.google.com/o/oauth2/auth" + - + name: "GOOGLE_OAUTH_TOKEN_URL" + value: "https://www.googleapis.com/oauth2/v3/token" + - + name: "GOOGLE_OAUTH_CLIENT_ID" + value: "" + - + name: "GOOGLE_OAUTH_SCOPE" + value: "profile" + - + name: "KUBERNETES_NAMESPACE" + valueFrom: + fieldRef: + fieldPath: "metadata.namespace" + image: "docker.io/fabric8/fabric8-console:v1.0.26" + name: "fabric8-container" + ports: + - + containerPort: 9090 + name: "http" + securityContext: {} + volumeMounts: [] + imagePullSecrets: [] + nodeSelector: {} + volumes: [] diff --git a/roles/addons/files/fabric8-svc-accounts.yaml b/roles/addons/files/fabric8-svc-accounts.yaml new file mode 100644 index 000000000..2e3944898 --- /dev/null +++ b/roles/addons/files/fabric8-svc-accounts.yaml @@ -0,0 +1,9 @@ +apiVersion: "v1" +imagePullSecrets: [] +kind: "ServiceAccount" +metadata: + annotations: {} + labels: {} + name: "fabric8" + namespace: "kube-system" +secrets: [] diff --git a/roles/addons/files/fabric8-svc.yaml b/roles/addons/files/fabric8-svc.yaml new file mode 100644 index 000000000..37acbd292 --- /dev/null +++ b/roles/addons/files/fabric8-svc.yaml @@ -0,0 +1,19 @@ +apiVersion: "v1" +kind: "Service" +metadata: + annotations: {} + labels: + component: "console" + provider: "fabric8" + name: "fabric8" + namespace: "kube-system" +spec: + deprecatedPublicIPs: [] + ports: + - + port: 80 + protocol: "TCP" + targetPort: 9090 + selector: + component: "console" + provider: "fabric8" diff --git a/roles/addons/files/fabric8-templates-rc.yaml b/roles/addons/files/fabric8-templates-rc.yaml new file mode 100644 index 000000000..17ff46609 --- /dev/null +++ b/roles/addons/files/fabric8-templates-rc.yaml @@ -0,0 +1,57 @@ +apiVersion: "v1" +kind: "ReplicationController" +metadata: + annotations: {} + labels: + component: "templates" + provider: "fabric8" + name: "templates" + namespace: "kube-system" +spec: + replicas: 1 + selector: + component: "templates" + provider: "fabric8" + template: + metadata: + annotations: {} + labels: + component: "templates" + provider: "fabric8" + spec: + containers: + - + args: [] + command: [] + env: + - + name: "DATA_DIR" + value: "/data/templates" + - + name: "KUBERNETES_NAMESPACE" + valueFrom: + fieldRef: + fieldPath: "metadata.namespace" + image: "docker.io/fabric8/templates:2.2.19" + name: "templates" + ports: + - + containerPort: 8080 + name: "http" + - + containerPort: 8778 + name: "jolokia" + securityContext: {} + volumeMounts: + - + mountPath: "/data" + name: "template-data" + readOnly: false + imagePullSecrets: [] + nodeSelector: {} + volumes: + - + gitRepo: + repository: "https://github.com/fabric8io/templates.git" + revision: "master" + name: "template-data" diff --git a/roles/addons/files/fabric8-templates-svc.yaml b/roles/addons/files/fabric8-templates-svc.yaml new file mode 100644 index 000000000..d5f528040 --- /dev/null +++ b/roles/addons/files/fabric8-templates-svc.yaml @@ -0,0 +1,19 @@ +apiVersion: "v1" +kind: "Service" +metadata: + annotations: {} + labels: + component: "templates" + provider: "fabric8" + name: "templates" + namespace: "kube-system" +spec: + deprecatedPublicIPs: [] + ports: + - + port: 80 + protocol: "TCP" + targetPort: 8080 + selector: + component: "templates" + provider: "fabric8" diff --git a/roles/addons/tasks/fabric8.yml b/roles/addons/tasks/fabric8.yml new file mode 100644 index 000000000..4213fece3 --- /dev/null +++ b/roles/addons/tasks/fabric8.yml @@ -0,0 +1,72 @@ +--- +- name: Fabric8 | Write service accounts file + copy: + src: fabric8-svc-accounts.yaml + dest: "{{ kube_manifest_dir }}/fabric8-svc-accounts.yaml" + register: fabric8_svcaccts_def + +- name: Fabric8 | Write service file + copy: + src: fabric8-svc.yaml + dest: "{{ kube_manifest_dir }}/fabric8-svc.yaml" + register: fabric8_svc_def + +- name: Fabric8 | templates | Write service file + copy: + src: fabric8-templates-svc.yaml + dest: "{{ kube_manifest_dir }}/fabric8-templates-svc.yaml" + register: fabric8_tmpl_svc_def + +- name: Fabric8 | Write controller file + copy: + src: fabric8-rc.yaml + dest: "{{ kube_manifest_dir }}/fabric8-rc.yaml" + register: fabric8_rc_def + +- name: Fabric8 | templates | Write controller file + copy: + src: fabric8-templates-rc.yaml + dest: "{{ kube_manifest_dir }}/fabric8-templates-rc.yaml" + register: fabric8_tmpl_rc_def + + +- name: Fabric8 | Create/update service account + kube: + namespace: kube-system + resource: serviceaccounts + name: fabric8 + filename: "{{ kube_manifest_dir }}/fabric8-svc-accounts.yaml" + state: "{{ fabric8_svcaccts_def.changed | ternary('latest','present') }}" + ignore_errors: yes + +- name: Fabric8 | Create/update service + kube: + namespace: kube-system + resource: svc + name: fabric8 + filename: "{{ kube_manifest_dir }}/fabric8-svc.yaml" + state: "{{ fabric8_svc_def.changed | ternary('latest','present') }}" + +- name: Fabric8 | templates | Create/update service + kube: + namespace: kube-system + resource: svc + name: templates + filename: "{{ kube_manifest_dir }}/fabric8-templates-svc.yaml" + state: "{{ fabric8_tmpl_svc_def.changed | ternary('latest','present') }}" + +- name: Fabric8 | Create/update replication controller + kube: + namespace: kube-system + resource: rc + name: fabric8 + filename: "{{ kube_manifest_dir }}/fabric8-rc.yaml" + state: "{{ fabric8_rc_def.changed | ternary('latest','present') }}" + +- name: Fabric8 | templates | Create/update replication controller + kube: + namespace: kube-system + resource: rc + name: templates + filename: "{{ kube_manifest_dir }}/fabric8-templates-rc.yaml" + state: "{{ fabric8_tmpl_rc_def.changed | ternary('latest','present') }}" diff --git a/roles/addons/tasks/main.yml b/roles/addons/tasks/main.yml index 0e2095243..307599994 100644 --- a/roles/addons/tasks/main.yml +++ b/roles/addons/tasks/main.yml @@ -43,3 +43,6 @@ - include: monitoring.yml when: enable_monitoring + +- include: fabric8.yml + when: enable_fabric8