SSL certificates for etcd cluster.
Added generation of SSL certificates for etcd cluster internal communication. Turned on on gci & trusty.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
{% set etcd_protocol = 'http' -%}
|
||||
{% set etcd_creds = '' -%}
|
||||
{% if pillar.get('etcd_over_ssl', '').lower() == 'true' -%}
|
||||
{% set etcd_protocol = 'https' -%}
|
||||
{% set etcd_creds = '--peer-trusted-ca-file /srv/kubernetes/etcd-ca.crt --peer-cert-file /srv/kubernetes/etcd-peer.crt --peer-key-file /srv/kubernetes/etcd-peer.key -peer-client-cert-auth' -%}
|
||||
{% endif -%}
|
||||
{% set cluster_state = 'new' -%}
|
||||
{% set hostname = pillar.get('hostname', '') -%}
|
||||
{% set etcd_cluster_array = (pillar.get('initial_etcd_cluster') or hostname).split(',') -%}
|
||||
@@ -9,7 +15,7 @@
|
||||
{% set cluster_state = 'existing' -%}
|
||||
{% set etcd_cluster = etcd_cluster ~ ',' -%}
|
||||
{% endif -%}
|
||||
{% set etcd_cluster = etcd_cluster ~ 'etcd-' ~ host ~ '=http://' ~ host ~ ':' ~ server_port -%}
|
||||
{% set etcd_cluster = etcd_cluster ~ 'etcd-' ~ host ~ '=' ~ etcd_protocol ~'://' ~ host ~ ':' ~ server_port -%}
|
||||
{% do vars.update({'etcd_cluster': etcd_cluster, 'cluster_state': cluster_state}) -%}
|
||||
{% endfor -%}
|
||||
{% set etcd_cluster = vars.etcd_cluster -%}
|
||||
@@ -19,6 +25,7 @@
|
||||
{% if pillar.get('storage_backend', 'etcd2') == 'etcd3' -%}
|
||||
{% set quota_bytes = '--quota-backend-bytes=4294967296' -%}
|
||||
{% endif -%}
|
||||
{% set srv_kube_path = "/srv/kubernetes" -%}
|
||||
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
@@ -41,7 +48,7 @@
|
||||
"command": [
|
||||
"/bin/sh",
|
||||
"-c",
|
||||
"if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh 1>>/var/log/etcd{{ suffix }}.log 2>&1; fi; /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls http://{{ hostname }}:{{ server_port }} --initial-advertise-peer-urls http://{{ hostname }}:{{ server_port }} --advertise-client-urls http://127.0.0.1:{{ port }} --listen-client-urls http://127.0.0.1:{{ port }} {{ quota_bytes }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
|
||||
"if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh 1>>/var/log/etcd{{ suffix }}.log 2>&1; fi; /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls {{ etcd_protocol }}://{{ hostname }}:{{ server_port }} --initial-advertise-peer-urls {{ etcd_protocol }}://{{ hostname }}:{{ server_port }} --advertise-client-urls http://127.0.0.1:{{ port }} --listen-client-urls http://127.0.0.1:{{ port }} {{ quota_bytes }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} {{ etcd_creds }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
|
||||
],
|
||||
"env": [
|
||||
{ "name": "TARGET_STORAGE",
|
||||
@@ -81,8 +88,12 @@
|
||||
{ "name": "varlogetcd",
|
||||
"mountPath": "/var/log/etcd{{ suffix }}.log",
|
||||
"readOnly": false
|
||||
},
|
||||
{ "name": "etc",
|
||||
"mountPath": "{{ srv_kube_path }}",
|
||||
"readOnly": false
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"volumes":[
|
||||
@@ -93,6 +104,10 @@
|
||||
{ "name": "varlogetcd",
|
||||
"hostPath": {
|
||||
"path": "/var/log/etcd{{ suffix }}.log"}
|
||||
},
|
||||
{ "name": "etc",
|
||||
"hostPath": {
|
||||
"path": "{{ srv_kube_path }}"}
|
||||
}
|
||||
]
|
||||
}}
|
||||
|
Reference in New Issue
Block a user