mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-10 20:29:18 +03:00
Create certificates for each node too (#3698)
This commit is contained in:
committed by
k8s-ci-robot
parent
e8901a2422
commit
afc3f7dce4
42
roles/kubernetes/secrets/templates/openssl-master.conf.j2
Normal file
42
roles/kubernetes/secrets/templates/openssl-master.conf.j2
Normal file
@@ -0,0 +1,42 @@
|
||||
{% set counter = {'dns': 6,'ip': 1,} %}{% macro increment(dct, key, inc=1)%}{% if dct.update({key: dct[key] + inc}) %} {% endif %}{% endmacro %}[req]
|
||||
req_extensions = v3_req
|
||||
distinguished_name = req_distinguished_name
|
||||
[req_distinguished_name]
|
||||
[ v3_req ]
|
||||
basicConstraints = CA:FALSE
|
||||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
|
||||
subjectAltName = @alt_names
|
||||
[alt_names]
|
||||
DNS.1 = kubernetes
|
||||
DNS.2 = kubernetes.default
|
||||
DNS.3 = kubernetes.default.svc
|
||||
DNS.4 = kubernetes.default.svc.{{ dns_domain }}
|
||||
DNS.5 = localhost
|
||||
{% for host in groups['kube-master'] %}
|
||||
DNS.{{ counter["dns"] }} = {{ host }}{{ increment(counter, 'dns') }}
|
||||
{% endfor %}
|
||||
{% if apiserver_loadbalancer_domain_name is defined %}
|
||||
DNS.{{ counter["dns"] }} = {{ apiserver_loadbalancer_domain_name }}{{ increment(counter, 'dns') }}
|
||||
{% endif %}
|
||||
{% for host in groups['kube-master'] %}
|
||||
{% if hostvars[host]['access_ip'] is defined %}
|
||||
IP.{{ counter["ip"] }} = {{ hostvars[host]['access_ip'] }}{{ increment(counter, 'ip') }}
|
||||
{% endif %}
|
||||
IP.{{ counter["ip"] }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
|
||||
{% endfor %}
|
||||
{% if kube_apiserver_ip is defined %}
|
||||
IP.{{ counter["ip"] }} = {{ kube_apiserver_ip }}{{ increment(counter, 'ip') }}
|
||||
{% endif %}
|
||||
{% if loadbalancer_apiserver is defined and loadbalancer_apiserver.address is defined %}
|
||||
IP.{{ counter["ip"] }} = {{ loadbalancer_apiserver.address }}{{ increment(counter, 'ip') }}
|
||||
{% endif %}
|
||||
{% if supplementary_addresses_in_ssl_keys is defined %}
|
||||
{% for addr in supplementary_addresses_in_ssl_keys %}
|
||||
{% if addr | ipaddr %}
|
||||
IP.{{ counter["ip"] }} = {{ addr }}{{ increment(counter, 'ip') }}
|
||||
{% else %}
|
||||
DNS.{{ counter["dns"] }} = {{ addr }}{{ increment(counter, 'dns') }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
IP.{{ counter["ip"] }} = 127.0.0.1
|
||||
Reference in New Issue
Block a user