Skip to content
Snippets Groups Projects
Unverified Commit 03bcfa7f authored by Matthew Mosesohn's avatar Matthew Mosesohn Committed by GitHub
Browse files

Stop templating kube-system namespace and creating it (#2545)

Kubernetes makes this namespace automatically, so there is
no need for kubespray to manage it.
parent f619eb08
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 54 deletions
...@@ -3,7 +3,7 @@ apiVersion: extensions/v1beta1 ...@@ -3,7 +3,7 @@ apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: kube-dns name: kube-dns
namespace: "{{system_namespace}}" namespace: kube-system
labels: labels:
k8s-app: kube-dns k8s-app: kube-dns
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -3,6 +3,6 @@ apiVersion: v1 ...@@ -3,6 +3,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: kube-dns name: kube-dns
namespace: {{ system_namespace }} namespace: kube-system
labels: labels:
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
...@@ -3,7 +3,7 @@ apiVersion: v1 ...@@ -3,7 +3,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: kube-dns name: kube-dns
namespace: {{ system_namespace }} namespace: kube-system
labels: labels:
k8s-app: kube-dns k8s-app: kube-dns
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -126,32 +126,3 @@ ...@@ -126,32 +126,3 @@
- kube_version | version_compare('v1.9.3', '<=') - kube_version | version_compare('v1.9.3', '<=')
- inventory_hostname == groups['kube-master'][0] - inventory_hostname == groups['kube-master'][0]
tags: vsphere tags: vsphere
# This is not a cluster role, but should be run after kubeconfig is set on master
- name: Write kube system namespace manifest
template:
src: namespace.j2
dest: "{{kube_config_dir}}/{{system_namespace}}-ns.yml"
when: inventory_hostname == groups['kube-master'][0]
tags:
- apps
- name: Check if kube system namespace exists
command: "{{ bin_dir }}/kubectl get ns {{system_namespace}}"
register: 'kubesystem'
changed_when: False
failed_when: False
when: inventory_hostname == groups['kube-master'][0]
tags:
- apps
- name: Create kube system namespace
command: "{{ bin_dir }}/kubectl create -f {{kube_config_dir}}/{{system_namespace}}-ns.yml"
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
register: create_system_ns
until: create_system_ns.rc == 0
changed_when: False
when: inventory_hostname == groups['kube-master'][0] and kubesystem.rc != 0
tags:
- apps
apiVersion: v1 apiVersion: v1
kind: Namespace kind: Namespace
metadata: metadata:
name: "{{system_namespace}}" name: "kube-system"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
when: rbac_enabled when: rbac_enabled
- name: "ElasticSearch | Create Serviceaccount and Clusterrolebinding (RBAC)" - name: "ElasticSearch | Create Serviceaccount and Clusterrolebinding (RBAC)"
command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/{{ item }} -n {{ system_namespace }}" command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/{{ item }} -n kube-system"
with_items: with_items:
- "efk-sa.yml" - "efk-sa.yml"
- "efk-clusterrolebinding.yml" - "efk-clusterrolebinding.yml"
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
register: es_deployment_manifest register: es_deployment_manifest
- name: "ElasticSearch | Create ES deployment" - name: "ElasticSearch | Create ES deployment"
command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/elasticsearch-deployment.yaml -n {{ system_namespace }}" command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/elasticsearch-deployment.yaml -n kube-system"
run_once: true run_once: true
when: es_deployment_manifest.changed when: es_deployment_manifest.changed
...@@ -35,6 +35,6 @@ ...@@ -35,6 +35,6 @@
register: es_service_manifest register: es_service_manifest
- name: "ElasticSearch | Create ES service" - name: "ElasticSearch | Create ES service"
command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/elasticsearch-service.yaml -n {{ system_namespace }}" command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/elasticsearch-service.yaml -n kube-system"
run_once: true run_once: true
when: es_service_manifest.changed when: es_service_manifest.changed
...@@ -3,11 +3,11 @@ kind: ClusterRoleBinding ...@@ -3,11 +3,11 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1beta1
metadata: metadata:
name: efk name: efk
namespace: {{ system_namespace }} namespace: kube-system
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: efk name: efk
namespace: {{ system_namespace }} namespace: kube-system
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: cluster-admin name: cluster-admin
......
...@@ -3,6 +3,6 @@ apiVersion: v1 ...@@ -3,6 +3,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: efk name: efk
namespace: {{ system_namespace }} namespace: kube-system
labels: labels:
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1 ...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: elasticsearch-logging-v1 name: elasticsearch-logging-v1
namespace: "{{ system_namespace }}" namespace: kube-system
labels: labels:
k8s-app: elasticsearch-logging k8s-app: elasticsearch-logging
version: "{{ elasticsearch_image_tag }}" version: "{{ elasticsearch_image_tag }}"
......
...@@ -3,7 +3,7 @@ apiVersion: v1 ...@@ -3,7 +3,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: elasticsearch-logging name: elasticsearch-logging
namespace: "{{ system_namespace }}" namespace: "kube-system"
labels: labels:
k8s-app: elasticsearch-logging k8s-app: elasticsearch-logging
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
register: fluentd_ds_manifest register: fluentd_ds_manifest
- name: "Fluentd | Create fluentd daemonset" - name: "Fluentd | Create fluentd daemonset"
command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/fluentd-ds.yaml -n {{ system_namespace }}" command: "{{ bin_dir }}/kubectl apply -f {{ kube_config_dir }}/fluentd-ds.yaml -n kube-system"
run_once: true run_once: true
when: fluentd_ds_manifest.changed when: fluentd_ds_manifest.changed
...@@ -2,7 +2,7 @@ apiVersion: v1 ...@@ -2,7 +2,7 @@ apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: fluentd-config name: fluentd-config
namespace: "{{ system_namespace }}" namespace: "kube-system"
data: data:
{{ fluentd_config_file }}: | {{ fluentd_config_file }}: |
# This configuration file for Fluentd / td-agent is used # This configuration file for Fluentd / td-agent is used
......
...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1 ...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: "fluentd-es-v{{ fluentd_version }}" name: "fluentd-es-v{{ fluentd_version }}"
namespace: "{{ system_namespace }}" namespace: "kube-system"
labels: labels:
k8s-app: fluentd-es k8s-app: fluentd-es
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
filename: "{{kube_config_dir}}/kibana-deployment.yaml" filename: "{{kube_config_dir}}/kibana-deployment.yaml"
kubectl: "{{bin_dir}}/kubectl" kubectl: "{{bin_dir}}/kubectl"
name: "kibana-logging" name: "kibana-logging"
namespace: "{{system_namespace}}" namespace: "kube-system"
resource: "deployment" resource: "deployment"
state: "latest" state: "latest"
with_items: "{{ kibana_deployment_manifest.changed }}" with_items: "{{ kibana_deployment_manifest.changed }}"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
filename: "{{kube_config_dir}}/kibana-service.yaml" filename: "{{kube_config_dir}}/kibana-service.yaml"
kubectl: "{{bin_dir}}/kubectl" kubectl: "{{bin_dir}}/kubectl"
name: "kibana-logging" name: "kibana-logging"
namespace: "{{system_namespace}}" namespace: "kube-system"
resource: "svc" resource: "svc"
state: "latest" state: "latest"
with_items: "{{ kibana_service_manifest.changed }}" with_items: "{{ kibana_service_manifest.changed }}"
......
...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1 ...@@ -4,7 +4,7 @@ apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: kibana-logging name: kibana-logging
namespace: "{{ system_namespace }}" namespace: "kube-system"
labels: labels:
k8s-app: kibana-logging k8s-app: kibana-logging
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -3,7 +3,7 @@ apiVersion: v1 ...@@ -3,7 +3,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: kibana-logging name: kibana-logging
namespace: "{{ system_namespace }}" namespace: "kube-system"
labels: labels:
k8s-app: kibana-logging k8s-app: kibana-logging
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
cephfs_provisioner_image_repo: quay.io/kubespray/cephfs-provisioner cephfs_provisioner_image_repo: quay.io/kubespray/cephfs-provisioner
cephfs_provisioner_image_tag: 92295a30 cephfs_provisioner_image_tag: 92295a30
cephfs_provisioner_namespace: "{{ system_namespace }}" cephfs_provisioner_namespace: "kube-system"
cephfs_provisioner_cluster: ceph cephfs_provisioner_cluster: ceph
cephfs_provisioner_monitors: [] cephfs_provisioner_monitors: []
cephfs_provisioner_admin_id: admin cephfs_provisioner_admin_id: admin
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
local_volume_provisioner_image_repo: quay.io/external_storage/local-volume-provisioner local_volume_provisioner_image_repo: quay.io/external_storage/local-volume-provisioner
local_volume_provisioner_image_tag: v2.0.0 local_volume_provisioner_image_tag: v2.0.0
local_volume_provisioner_namespace: "{{ system_namespace }}" local_volume_provisioner_namespace: "kube-system"
local_volume_provisioner_base_dir: /mnt/disks local_volume_provisioner_base_dir: /mnt/disks
local_volume_provisioner_mount_dir: /mnt/disks local_volume_provisioner_mount_dir: /mnt/disks
local_volume_provisioner_storage_class: local-storage local_volume_provisioner_storage_class: local-storage
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
- name: Helm | Apply Helm Manifests (RBAC) - name: Helm | Apply Helm Manifests (RBAC)
kube: kube:
name: "{{item.item.name}}" name: "{{item.item.name}}"
namespace: "{{ system_namespace }}" namespace: "kube-system"
kubectl: "{{bin_dir}}/kubectl" kubectl: "{{bin_dir}}/kubectl"
resource: "{{item.item.type}}" resource: "{{item.item.type}}"
filename: "{{kube_config_dir}}/{{item.item.file}}" filename: "{{kube_config_dir}}/{{item.item.file}}"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
- name: Helm | Install/upgrade helm - name: Helm | Install/upgrade helm
command: > command: >
{{ bin_dir }}/helm init --upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }} --tiller-namespace={{ system_namespace }} {{ bin_dir }}/helm init --upgrade --tiller-image={{ tiller_image_repo }}:{{ tiller_image_tag }} --tiller-namespace=kube-system
{% if helm_skip_refresh %} --skip-refresh{% endif %} {% if helm_skip_refresh %} --skip-refresh{% endif %}
{% if helm_stable_repo_url is defined %} --stable-repo-url {{ helm_stable_repo_url }}{% endif %} {% if helm_stable_repo_url is defined %} --stable-repo-url {{ helm_stable_repo_url }}{% endif %}
{% if rbac_enabled %} --service-account=tiller{% endif %} {% if rbac_enabled %} --service-account=tiller{% endif %}
......
...@@ -3,11 +3,11 @@ kind: ClusterRoleBinding ...@@ -3,11 +3,11 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1beta1
metadata: metadata:
name: tiller name: tiller
namespace: {{ system_namespace }} namespace: kube-system
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: tiller name: tiller
namespace: {{ system_namespace }} namespace: kube-system
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: cluster-admin name: cluster-admin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment