diff --git a/cluster.yml b/cluster.yml index 9bfd2ff42..c77e9e1b5 100644 --- a/cluster.yml +++ b/cluster.yml @@ -51,7 +51,7 @@ any_errors_fatal: "{{ any_errors_fatal | default(true) }}" roles: - { role: kubespray-defaults} - - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: true } + - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" } - hosts: k8s-cluster:calico-rr any_errors_fatal: "{{ any_errors_fatal | default(true) }}" diff --git a/roles/etcd/defaults/main.yml b/roles/etcd/defaults/main.yml index 041214903..750b710f2 100644 --- a/roles/etcd/defaults/main.yml +++ b/roles/etcd/defaults/main.yml @@ -3,6 +3,9 @@ etcd_cluster_setup: true etcd_events_cluster_setup: false +# Set to true to separate k8s events to a different etcd cluster +etcd_events_cluster_enabled: false + etcd_backup_prefix: "/var/backups" etcd_data_dir: "/var/lib/etcd" etcd_events_data_dir: "/var/lib/etcd-events" diff --git a/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 b/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 index 475d2d0ae..32e6071b6 100644 --- a/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 +++ b/roles/kubernetes/master/templates/kubeadm-config.yaml.j2 @@ -39,7 +39,7 @@ apiServerExtraArgs: {% if kube_version | version_compare('v1.9', '>=') %} endpoint-reconciler-type: lease {% endif %} -{% if etcd_events_cluster_setup %} +{% if etcd_events_cluster_enabled %} etcd-servers-overrides: "/events#{{ etcd_events_access_addresses }}" {% endif %} service-node-port-range: {{ kube_apiserver_node_port_range }} diff --git a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 index b638ff457..c688e1285 100644 --- a/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 +++ b/roles/kubernetes/master/templates/manifests/kube-apiserver.manifest.j2 @@ -30,7 +30,7 @@ spec: - apiserver - --advertise-address={{ ip | default(ansible_default_ipv4.address) }} - --etcd-servers={{ etcd_access_addresses }} -{% if etcd_events_cluster_setup %} +{% if etcd_events_cluster_enabled %} - --etcd-servers-overrides=/events#{{ etcd_events_access_addresses }} {% endif %} {% if kube_version | version_compare('v1.9', '<') %} diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 61fb62a09..fa97002dd 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -314,7 +314,7 @@ kube_apiserver_client_key: |- {%- endif %} # Set to true to deploy etcd-events cluster -etcd_events_cluster_setup: false +etcd_events_cluster_enabled: false # Vars for pointing to etcd endpoints is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"