2018-08-30 17:41:20 +08:00
|
|
|
apiVersion: kubeadm.k8s.io/v1alpha1
|
2017-09-14 02:00:51 +08:00
|
|
|
kind: MasterConfiguration
|
|
|
|
api:
|
2018-12-25 16:03:32 +08:00
|
|
|
{% if kubeadm_config_api_fqdn is defined %}
|
2018-11-14 16:23:30 +08:00
|
|
|
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}
|
|
|
|
bindPort: {{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
|
2018-08-29 18:29:24 +08:00
|
|
|
{% else %}
|
2018-09-02 00:02:52 +08:00
|
|
|
advertiseAddress: {{ ip | default(ansible_default_ipv4.address) }}
|
|
|
|
bindPort: {{ kube_apiserver_port }}
|
2018-08-18 22:05:35 +08:00
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
etcd:
|
2018-08-30 17:41:20 +08:00
|
|
|
endpoints:
|
2017-10-04 20:27:55 +08:00
|
|
|
{% for endpoint in etcd_access_addresses.split(',') %}
|
2018-08-30 17:41:20 +08:00
|
|
|
- {{ endpoint }}
|
2017-09-14 02:00:51 +08:00
|
|
|
{% endfor %}
|
2018-12-07 04:11:48 +08:00
|
|
|
caFile: {{ etcd_cert_dir }}/ca.pem
|
|
|
|
certFile: {{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem
|
|
|
|
keyFile: {{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem
|
2017-09-14 02:00:51 +08:00
|
|
|
networking:
|
|
|
|
dnsDomain: {{ dns_domain }}
|
|
|
|
serviceSubnet: {{ kube_service_addresses }}
|
|
|
|
podSubnet: {{ kube_pods_subnet }}
|
|
|
|
kubernetesVersion: {{ kube_version }}
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
|
|
|
|
cloudProvider: {{cloud_provider}}
|
|
|
|
cloudConfig: {{ kube_config_dir }}/cloud_config
|
|
|
|
{% elif cloud_provider is defined and cloud_provider in ["external"] %}
|
|
|
|
cloudConfig: {{ kube_config_dir }}/cloud_config
|
2017-12-25 16:57:45 +08:00
|
|
|
{% endif %}
|
2018-08-30 23:04:57 +08:00
|
|
|
{% if kube_proxy_mode == 'ipvs' %}
|
2018-01-29 13:15:32 +08:00
|
|
|
kubeProxy:
|
|
|
|
config:
|
2018-10-17 06:33:30 +08:00
|
|
|
{% if kube_version is version('v1.10', '<') %}
|
2018-01-29 13:15:32 +08:00
|
|
|
featureGates: SupportIPVSProxyMode=true
|
2018-08-30 23:04:57 +08:00
|
|
|
{% endif %}
|
2018-10-17 06:33:30 +08:00
|
|
|
{% if kube_version is version('v1.10', '>=') %}
|
2018-08-30 23:04:57 +08:00
|
|
|
featureGates:
|
|
|
|
SupportIPVSProxyMode: true
|
|
|
|
{% endif %}
|
2018-01-29 13:15:32 +08:00
|
|
|
mode: ipvs
|
|
|
|
{% endif %}
|
2018-08-24 16:59:06 +08:00
|
|
|
{% if kube_proxy_nodeport_addresses %}
|
2019-01-03 16:04:26 +08:00
|
|
|
nodePortAddresses: {{ kube_proxy_nodeport_addresses }}
|
2018-08-24 16:59:06 +08:00
|
|
|
{% endif %}
|
2018-11-27 21:03:03 +08:00
|
|
|
resourceContainer: ""
|
2017-09-16 05:28:15 +08:00
|
|
|
authorizationModes:
|
2017-09-14 02:00:51 +08:00
|
|
|
{% for mode in authorization_modes %}
|
|
|
|
- {{ mode }}
|
|
|
|
{% endfor %}
|
|
|
|
selfHosted: false
|
|
|
|
apiServerExtraArgs:
|
2017-11-29 23:24:02 +08:00
|
|
|
bind-address: {{ kube_apiserver_bind_address }}
|
2018-09-12 14:22:11 +08:00
|
|
|
{% if kube_apiserver_insecure_port|string != "0" %}
|
2017-09-14 02:00:51 +08:00
|
|
|
insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
|
2018-09-12 14:22:11 +08:00
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
insecure-port: "{{ kube_apiserver_insecure_port }}"
|
2018-10-17 06:33:30 +08:00
|
|
|
{% if kube_version is version('v1.10', '<') %}
|
2017-09-14 02:00:51 +08:00
|
|
|
admission-control: {{ kube_apiserver_admission_control | join(',') }}
|
2018-08-03 02:10:40 +08:00
|
|
|
{% else %}
|
2018-08-07 02:50:48 +08:00
|
|
|
{% if kube_apiserver_enable_admission_plugins|length > 0 %}
|
2018-09-02 00:02:52 +08:00
|
|
|
enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }}
|
2018-08-07 02:50:48 +08:00
|
|
|
{% endif %}
|
|
|
|
{% if kube_apiserver_disable_admission_plugins|length > 0 %}
|
2018-09-02 00:02:52 +08:00
|
|
|
disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }}
|
2018-08-07 02:50:48 +08:00
|
|
|
{% endif %}
|
2018-08-03 02:10:40 +08:00
|
|
|
{% endif %}
|
2017-09-16 05:28:15 +08:00
|
|
|
apiserver-count: "{{ kube_apiserver_count }}"
|
2018-10-17 06:33:30 +08:00
|
|
|
{% if kube_version is version('v1.9', '>=') %}
|
2018-03-20 21:33:36 +08:00
|
|
|
endpoint-reconciler-type: lease
|
2018-04-02 00:58:08 +08:00
|
|
|
{% endif %}
|
2018-06-18 21:19:12 +08:00
|
|
|
{% if etcd_events_cluster_enabled %}
|
2018-04-02 00:58:08 +08:00
|
|
|
etcd-servers-overrides: "/events#{{ etcd_events_access_addresses }}"
|
2018-03-30 17:38:06 +08:00
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
service-node-port-range: {{ kube_apiserver_node_port_range }}
|
2018-03-13 17:31:15 +08:00
|
|
|
kubelet-preferred-address-types: "{{ kubelet_preferred_address_types }}"
|
2018-09-19 16:01:45 +08:00
|
|
|
profiling: "{{ kube_profiling }}"
|
2018-09-24 17:17:18 +08:00
|
|
|
request-timeout: "{{ kube_apiserver_request_timeout }}"
|
2018-09-19 16:01:45 +08:00
|
|
|
repair-malformed-updates: "false"
|
2018-09-19 16:58:46 +08:00
|
|
|
enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
|
2018-10-17 06:33:30 +08:00
|
|
|
{% if kube_api_anonymous_auth is defined and kube_version is version('v1.5', '>=') %}
|
2018-09-19 16:01:45 +08:00
|
|
|
anonymous-auth: "{{ kube_api_anonymous_auth }}"
|
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
{% if kube_basic_auth|default(true) %}
|
|
|
|
basic-auth-file: {{ kube_users_dir }}/known_users.csv
|
|
|
|
{% endif %}
|
2018-09-19 16:01:45 +08:00
|
|
|
{% if kube_token_auth|default(true) %}
|
|
|
|
token-auth-file: {{ kube_token_dir }}/known_tokens.csv
|
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
{% if kube_oidc_auth|default(false) and kube_oidc_url is defined and kube_oidc_client_id is defined %}
|
|
|
|
oidc-issuer-url: {{ kube_oidc_url }}
|
|
|
|
oidc-client-id: {{ kube_oidc_client_id }}
|
|
|
|
{% if kube_oidc_ca_file is defined %}
|
|
|
|
oidc-ca-file: {{ kube_oidc_ca_file }}
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_oidc_username_claim is defined %}
|
|
|
|
oidc-username-claim: {{ kube_oidc_username_claim }}
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_oidc_groups_claim is defined %}
|
|
|
|
oidc-groups-claim: {{ kube_oidc_groups_claim }}
|
|
|
|
{% endif %}
|
2019-02-01 07:31:43 +08:00
|
|
|
{% if kube_oidc_username_prefix is defined %}
|
|
|
|
oidc-username-prefix: {{ kube_oidc_username_prefix }}
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_oidc_groups_prefix is defined %}
|
|
|
|
oidc-groups-prefix: {{ kube_oidc_groups_prefix }}
|
|
|
|
{% endif %}
|
2018-03-16 03:20:05 +08:00
|
|
|
{% endif %}
|
2018-12-26 17:52:53 +08:00
|
|
|
{% if kube_webhook_token_auth|default(false) %}
|
|
|
|
authentication-token-webhook-config-file: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
|
|
|
{% endif %}
|
2018-03-16 03:20:05 +08:00
|
|
|
{% if kube_encrypt_secret_data %}
|
2018-12-07 15:11:53 +08:00
|
|
|
experimental-encryption-provider-config: {{ kube_cert_dir }}/secrets_encryption.yaml
|
2017-09-14 02:00:51 +08:00
|
|
|
{% endif %}
|
|
|
|
storage-backend: {{ kube_apiserver_storage_backend }}
|
|
|
|
{% if kube_api_runtime_config is defined %}
|
2017-10-16 03:41:17 +08:00
|
|
|
runtime-config: {{ kube_api_runtime_config | join(',') }}
|
2017-09-14 02:00:51 +08:00
|
|
|
{% endif %}
|
|
|
|
allow-privileged: "true"
|
2018-02-12 15:29:46 +08:00
|
|
|
{% for key in kube_kubeadm_apiserver_extra_args %}
|
2018-03-16 03:27:19 +08:00
|
|
|
{{ key }}: "{{ kube_kubeadm_apiserver_extra_args[key] }}"
|
2018-02-12 15:29:46 +08:00
|
|
|
{% endfor %}
|
2018-09-03 02:27:33 +08:00
|
|
|
{% if kube_feature_gates %}
|
|
|
|
feature-gates: {{ kube_feature_gates|join(',') }}
|
|
|
|
{% endif %}
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if kube_network_plugin is defined and kube_network_plugin == 'cloud' %}
|
|
|
|
configure-cloud-routes: "true"
|
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
controllerManagerExtraArgs:
|
|
|
|
node-monitor-grace-period: {{ kube_controller_node_monitor_grace_period }}
|
|
|
|
node-monitor-period: {{ kube_controller_node_monitor_period }}
|
|
|
|
pod-eviction-timeout: {{ kube_controller_pod_eviction_timeout }}
|
2018-12-07 20:23:17 +08:00
|
|
|
node-cidr-mask-size: "{{ kube_network_node_prefix }}"
|
2018-09-19 16:01:45 +08:00
|
|
|
profiling: "{{ kube_profiling }}"
|
2018-09-24 17:17:18 +08:00
|
|
|
terminated-pod-gc-threshold: "{{ kube_controller_terminated_pod_gc_threshold }}"
|
2018-09-03 02:27:33 +08:00
|
|
|
{% if kube_feature_gates %}
|
|
|
|
feature-gates: {{ kube_feature_gates|join(',') }}
|
|
|
|
{% endif %}
|
2018-09-19 17:24:19 +08:00
|
|
|
{% for key in kube_kubeadm_controller_extra_args %}
|
|
|
|
{{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}"
|
|
|
|
{% endfor %}
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %}
|
2018-02-15 00:15:25 +08:00
|
|
|
controllerManagerExtraVolumes:
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined and openstack_cacert != "" %}
|
2018-02-15 00:15:25 +08:00
|
|
|
- name: openstackcacert
|
|
|
|
hostPath: "{{ kube_config_dir }}/openstack-cacert.pem"
|
|
|
|
mountPath: "{{ kube_config_dir }}/openstack-cacert.pem"
|
|
|
|
{% endif %}
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %}
|
|
|
|
- name: cloud-config
|
|
|
|
hostPath: {{ kube_config_dir }}/cloud_config
|
|
|
|
mountPath: {{ kube_config_dir }}/cloud_config
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2018-02-05 21:49:13 +08:00
|
|
|
schedulerExtraArgs:
|
2018-09-19 16:01:45 +08:00
|
|
|
profiling: "{{ kube_profiling }}"
|
2018-09-03 02:27:33 +08:00
|
|
|
{% if kube_feature_gates %}
|
|
|
|
feature-gates: {{ kube_feature_gates|join(',') }}
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_kubeadm_scheduler_extra_args|length > 0 %}
|
2018-02-05 21:49:13 +08:00
|
|
|
{% for key in kube_kubeadm_scheduler_extra_args %}
|
2018-03-16 03:27:19 +08:00
|
|
|
{{ key }}: "{{ kube_kubeadm_scheduler_extra_args[key] }}"
|
2018-02-05 21:49:13 +08:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-12-28 01:15:37 +08:00
|
|
|
{% if kube_basic_auth|default(true) or kube_token_auth|default(true) or kube_webhook_token_auth|default(false) or ssl_ca_dirs|length %}
|
2018-09-19 19:21:58 +08:00
|
|
|
apiServerExtraVolumes:
|
2018-11-27 21:03:03 +08:00
|
|
|
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws", "external"] %}
|
|
|
|
- name: cloud-config
|
|
|
|
hostPath: {{ kube_config_dir }}/cloud_config
|
|
|
|
mountPath: {{ kube_config_dir }}/cloud_config
|
|
|
|
{% endif %}
|
2018-09-19 19:21:58 +08:00
|
|
|
{% if kube_basic_auth|default(true) %}
|
|
|
|
- name: basic-auth-config
|
|
|
|
hostPath: {{ kube_users_dir }}
|
|
|
|
mountPath: {{ kube_users_dir }}
|
|
|
|
{% endif %}
|
|
|
|
{% if kube_token_auth|default(true) %}
|
|
|
|
- name: token-auth-config
|
|
|
|
hostPath: {{ kube_token_dir }}
|
|
|
|
mountPath: {{ kube_token_dir }}
|
|
|
|
{% endif %}
|
2018-12-26 17:52:53 +08:00
|
|
|
{% if kube_webhook_token_auth|default(false) %}
|
|
|
|
- name: webhook-token-auth-config
|
|
|
|
hostPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
|
|
|
mountPath: {{ kube_config_dir }}/webhook-token-auth-config.yaml
|
|
|
|
{% endif %}
|
2018-12-28 01:15:37 +08:00
|
|
|
{% if ssl_ca_dirs|length %}
|
|
|
|
{% for dir in ssl_ca_dirs %}
|
|
|
|
- name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
|
|
|
|
hostPath: {{ dir }}
|
|
|
|
mountPath: {{ dir }}
|
|
|
|
writable: false
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
2018-09-19 19:21:58 +08:00
|
|
|
{% endif %}
|
2017-09-14 02:00:51 +08:00
|
|
|
apiServerCertSANs:
|
2018-12-19 18:47:31 +08:00
|
|
|
{% for san in apiserver_sans.split() | unique %}
|
2017-09-14 02:00:51 +08:00
|
|
|
- {{ san }}
|
|
|
|
{% endfor %}
|
2018-12-06 18:33:38 +08:00
|
|
|
certificatesDir: {{ kube_cert_dir }}
|
2018-10-16 22:26:04 +08:00
|
|
|
imageRepository: {{ kube_image_repo }}
|
|
|
|
unifiedControlPlaneImage: ""
|
2018-03-23 20:33:25 +08:00
|
|
|
{% if kube_override_hostname|default('') %}
|
2018-03-25 01:29:07 +08:00
|
|
|
nodeName: {{ kube_override_hostname }}
|
2018-03-23 20:33:25 +08:00
|
|
|
{% endif %}
|