2018-12-06 20:11:48 +00:00
apiVersion: kubeadm.k8s.io/v1beta1
kind: InitConfiguration
2019-08-15 09:26:33 +00:00
{% if kubeadm_token is defined %}
bootstrapTokens:
- token: "{{ kubeadm_token }}"
description: "kubespray kubeadm bootstrap token"
ttl: "24h"
{% endif %}
2018-12-06 20:11:48 +00:00
localAPIEndpoint:
2019-03-05 11:04:39 +00:00
advertiseAddress: {{ ip | default(fallback_ips[inventory_hostname]) }}
2018-12-06 20:11:48 +00:00
bindPort: {{ kube_apiserver_port }}
nodeRegistration:
{% if kube_override_hostname|default('') %}
name: {{ kube_override_hostname }}
{% endif %}
2019-04-11 19:52:43 +00:00
{% if inventory_hostname in groups['kube-master'] and inventory_hostname not in groups['kube-node'] %}
2018-12-06 20:11:48 +00:00
taints:
2019-01-03 11:42:23 +00:00
- effect: NoSchedule
2019-04-17 14:58:06 +00:00
key: node-role.kubernetes.io/master
2019-04-19 13:01:54 +00:00
{% else %}
taints: []
2018-12-06 20:11:48 +00:00
{% endif %}
2019-06-29 21:09:20 +00:00
criSocket: {{ cri_socket }}
2020-02-18 12:47:28 +00:00
{% if cloud_provider is defined and cloud_provider in ["external"] %}
kubeletExtraArgs:
cloud-provider: external
{% endif %}
2018-12-06 20:11:48 +00:00
---
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
clusterName: {{ cluster_name }}
etcd:
2019-06-20 18:12:51 +00:00
{% if not etcd_kubeadm_enabled %}
2018-12-06 20:11:48 +00:00
external:
endpoints:
{% for endpoint in etcd_access_addresses.split(',') %}
- {{ endpoint }}
{% endfor %}
2019-04-19 13:01:54 +00:00
caFile: {{ etcd_cert_dir }}/{{ kube_etcd_cacert_file }}
certFile: {{ etcd_cert_dir }}/{{ kube_etcd_cert_file }}
keyFile: {{ etcd_cert_dir }}/{{ kube_etcd_key_file }}
2019-06-20 18:12:51 +00:00
{% elif etcd_kubeadm_enabled %}
local:
imageRepository: "{{ etcd_image_repo | regex_replace("/etcd$","") }}"
imageTag: "{{ etcd_image_tag }}"
2019-10-17 02:50:39 +00:00
dataDir: "{{ etcd_data_dir }}"
2019-06-20 18:12:51 +00:00
extraArgs:
metrics: {{ etcd_metrics }}
election-timeout: "{{ etcd_election_timeout }}"
heartbeat-interval: "{{ etcd_heartbeat_interval }}"
auto-compaction-retention: "{{ etcd_compaction_retention }}"
{% if etcd_snapshot_count is defined %}
snapshot-count: "{{ etcd_snapshot_count }}"
{% endif %}
{% if etcd_quota_backend_bytes is defined %}
quota-backend-bytes: "{{ etcd_quota_backend_bytes }}"
{% endif %}
{% if etcd_log_package_levels is defined %}
log-package_levels: "{{ etcd_log_package_levels }}"
{% endif %}
{% for key, value in etcd_extra_vars.items() %}
{{ key }}: "{{ value }}"
{% endfor %}
{% if host_architecture != "amd64" -%}
etcd-unsupported-arch: {{host_architecture}}
{% endif %}
serverCertSANs:
{% for san in etcd_cert_alt_names %}
- {{ san }}
{% endfor %}
{% for san in etcd_cert_alt_ips %}
- {{ san }}
{% endfor %}
peerCertSANs:
{% for san in etcd_cert_alt_names %}
- {{ san }}
{% endfor %}
{% for san in etcd_cert_alt_ips %}
- {{ san }}
{% endfor %}
{% endif %}
2019-07-09 12:41:59 +00:00
dns:
type: CoreDNS
imageRepository: {{ coredns_image_repo | regex_replace('/coredns$','') }}
imageTag: {{ coredns_image_tag }}
2018-12-06 20:11:48 +00:00
networking:
dnsDomain: {{ dns_domain }}
serviceSubnet: {{ kube_service_addresses }}
podSubnet: {{ kube_pods_subnet }}
kubernetesVersion: {{ kube_version }}
2018-12-25 08:03:32 +00:00
{% if kubeadm_config_api_fqdn is defined %}
2018-12-06 20:11:48 +00:00
controlPlaneEndpoint: {{ kubeadm_config_api_fqdn }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
{% else %}
2019-03-05 11:04:39 +00:00
controlPlaneEndpoint: {{ ip | default(fallback_ips[inventory_hostname]) }}:{{ kube_apiserver_port }}
2018-12-06 20:11:48 +00:00
{% endif %}
certificatesDir: {{ kube_cert_dir }}
imageRepository: {{ kube_image_repo }}
apiServer:
extraArgs:
2019-07-16 08:39:24 +00:00
{% if kube_api_anonymous_auth is defined %}
2019-05-07 19:52:34 +00:00
anonymous-auth: "{{ kube_api_anonymous_auth }}"
{% endif %}
2018-12-06 20:11:48 +00:00
authorization-mode: {{ authorization_modes | join(',') }}
bind-address: {{ kube_apiserver_bind_address }}
{% if kube_apiserver_insecure_port|string != "0" %}
insecure-bind-address: {{ kube_apiserver_insecure_bind_address }}
{% endif %}
insecure-port: "{{ kube_apiserver_insecure_port }}"
{% if kube_apiserver_enable_admission_plugins|length > 0 %}
enable-admission-plugins: {{ kube_apiserver_enable_admission_plugins | join(',') }}
{% endif %}
{% if kube_apiserver_disable_admission_plugins|length > 0 %}
disable-admission-plugins: {{ kube_apiserver_disable_admission_plugins | join(',') }}
{% endif %}
apiserver-count: "{{ kube_apiserver_count }}"
endpoint-reconciler-type: lease
{% if etcd_events_cluster_enabled %}
2019-04-29 06:02:21 +00:00
etcd-servers-overrides: "/events#{{ etcd_events_access_addresses_semicolon }}"
2018-12-06 20:11:48 +00:00
{% endif %}
service-node-port-range: {{ kube_apiserver_node_port_range }}
kubelet-preferred-address-types: "{{ kubelet_preferred_address_types }}"
2019-05-28 10:57:52 +00:00
profiling: "{{ kube_profiling }}"
request-timeout: "{{ kube_apiserver_request_timeout }}"
enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
2018-12-06 20:11:48 +00:00
{% if kube_basic_auth|default(true) %}
basic-auth-file: {{ kube_users_dir }}/known_users.csv
{% endif %}
{% if kube_token_auth|default(true) %}
token-auth-file: {{ kube_token_dir }}/known_tokens.csv
{% endif %}
{% 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-01-31 23:31:43 +00:00
{% if kube_oidc_username_prefix is defined %}
2019-04-09 12:23:06 +00:00
oidc-username-prefix: "{{ kube_oidc_username_prefix }}"
2019-01-31 23:31:43 +00:00
{% endif %}
{% if kube_oidc_groups_prefix is defined %}
2019-04-09 12:23:06 +00:00
oidc-groups-prefix: "{{ kube_oidc_groups_prefix }}"
2019-01-31 23:31:43 +00:00
{% endif %}
2018-12-06 20:11:48 +00:00
{% endif %}
2018-12-26 09:52:53 +00:00
{% if kube_webhook_token_auth|default(false) %}
authentication-token-webhook-config-file: {{ kube_config_dir }}/webhook-token-auth-config.yaml
{% endif %}
2018-12-06 20:11:48 +00:00
{% if kube_encrypt_secret_data %}
2018-12-07 07:11:53 +00:00
encryption-provider-config: {{ kube_cert_dir }}/secrets_encryption.yaml
2018-12-06 20:11:48 +00:00
{% endif %}
storage-backend: {{ kube_apiserver_storage_backend }}
{% if kube_api_runtime_config is defined %}
runtime-config: {{ kube_api_runtime_config | join(',') }}
{% endif %}
allow-privileged: "true"
{% if kubernetes_audit %}
audit-log-path: "{{ audit_log_path }}"
audit-log-maxage: "{{ audit_log_maxage }}"
audit-log-maxbackup: "{{ audit_log_maxbackups }}"
audit-log-maxsize: "{{ audit_log_maxsize }}"
audit-policy-file: {{ audit_policy_file }}
{% endif %}
{% for key in kube_kubeadm_apiserver_extra_args %}
{{ key }}: "{{ kube_kubeadm_apiserver_extra_args[key] }}"
{% endfor %}
{% if kube_feature_gates %}
feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
cloud-provider: {{cloud_provider}}
cloud-config: {{ kube_config_dir }}/cloud_config
{% endif %}
2018-12-27 17:15:37 +00:00
{% if kubernetes_audit or kube_basic_auth|default(true) or kube_token_auth|default(true) or kube_webhook_token_auth|default(false) or ( cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] ) or apiserver_extra_volumes or ssl_ca_dirs|length %}
2018-12-06 20:11:48 +00:00
extraVolumes:
2020-02-18 12:47:28 +00:00
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
2018-12-06 20:11:48 +00:00
- name: cloud-config
hostPath: {{ kube_config_dir }}/cloud_config
mountPath: {{ kube_config_dir }}/cloud_config
{% endif %}
{% 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 09:52:53 +00: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-06 20:11:48 +00:00
{% if kubernetes_audit %}
- name: {{ audit_policy_name }}
hostPath: {{ audit_policy_hostpath }}
mountPath: {{ audit_policy_mountpath }}
{% if audit_log_path != "-" %}
- name: {{ audit_log_name }}
hostPath: {{ audit_log_hostpath }}
mountPath: {{ audit_log_mountpath }}
2019-01-10 02:43:35 +00:00
readOnly: false
2018-12-06 20:11:48 +00:00
{% endif %}
{% endif %}
{% for volume in apiserver_extra_volumes %}
- name: {{ volume.name }}
hostPath: {{ volume.hostPath }}
mountPath: {{ volume.mountPath }}
2019-01-15 18:26:33 +00:00
readOnly: {{ volume.readOnly | d(not (volume.writable | d(false))) }}
2018-12-06 20:11:48 +00:00
{% endfor %}
2018-12-27 17:15:37 +00:00
{% if ssl_ca_dirs|length %}
{% for dir in ssl_ca_dirs %}
- name: {{ dir | regex_replace('^/(.*)$', '\\1' ) | regex_replace('/', '-') }}
hostPath: {{ dir }}
mountPath: {{ dir }}
readOnly: true
{% endfor %}
{% endif %}
2018-12-06 20:11:48 +00:00
{% endif %}
certSANs:
2019-04-08 15:10:35 +00:00
{% for san in apiserver_sans %}
2018-12-06 20:11:48 +00:00
- {{ san }}
{% endfor %}
timeoutForControlPlane: 5m0s
controllerManager:
extraArgs:
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 12:23:17 +00:00
node-cidr-mask-size: "{{ kube_network_node_prefix }}"
2019-05-28 10:57:52 +00:00
profiling: "{{ kube_profiling }}"
terminated-pod-gc-threshold: "{{ kube_controller_terminated_pod_gc_threshold }}"
2019-01-11 04:22:47 +00:00
bind-address: {{ kube_controller_manager_bind_address }}
2018-12-06 20:11:48 +00:00
{% if kube_feature_gates %}
feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
{% for key in kube_kubeadm_controller_extra_args %}
{{ key }}: "{{ kube_kubeadm_controller_extra_args[key] }}"
{% endfor %}
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
cloud-provider: {{cloud_provider}}
cloud-config: {{ kube_config_dir }}/cloud_config
{% endif %}
2019-04-11 06:50:09 +00:00
{% if kube_network_plugin is defined and kube_network_plugin not in ["cloud"] %}
configure-cloud-routes: "false"
{% endif %}
2020-02-18 12:47:28 +00:00
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] or controller_manager_extra_volumes %}
2018-12-06 20:11:48 +00:00
extraVolumes:
{% if cloud_provider is defined and cloud_provider in ["openstack"] and openstack_cacert is defined %}
- name: openstackcacert
hostPath: "{{ kube_config_dir }}/openstack-cacert.pem"
mountPath: "{{ kube_config_dir }}/openstack-cacert.pem"
{% endif %}
2020-02-18 12:47:28 +00:00
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
2018-12-06 20:11:48 +00:00
- name: cloud-config
hostPath: {{ kube_config_dir }}/cloud_config
mountPath: {{ kube_config_dir }}/cloud_config
{% endif %}
{% for volume in controller_manager_extra_volumes %}
- name: {{ volume.name }}
hostPath: {{ volume.hostPath }}
mountPath: {{ volume.mountPath }}
2019-01-15 18:26:33 +00:00
readOnly: {{ volume.readOnly | d(not (volume.writable | d(false))) }}
2018-12-06 20:11:48 +00:00
{% endfor %}
{% endif %}
scheduler:
extraArgs:
2019-01-11 04:22:47 +00:00
bind-address: {{ kube_scheduler_bind_address }}
2018-12-06 20:11:48 +00:00
{% if kube_feature_gates %}
feature-gates: {{ kube_feature_gates|join(',') }}
{% endif %}
{% if kube_kubeadm_scheduler_extra_args|length > 0 %}
{% for key in kube_kubeadm_scheduler_extra_args %}
{{ key }}: "{{ kube_kubeadm_scheduler_extra_args[key] }}"
{% endfor %}
{% endif %}
{% if scheduler_extra_volumes %}
extraVolumes:
{% for volume in scheduler_extra_volumes %}
- name: {{ volume.name }}
hostPath: {{ volume.hostPath }}
mountPath: {{ volume.mountPath }}
2019-01-15 18:26:33 +00:00
readOnly: {{ volume.readOnly | d(not (volume.writable | d(false))) }}
2018-12-06 20:11:48 +00:00
{% endfor %}
{% endif %}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
2019-01-03 08:04:26 +00:00
bindAddress: {{ kube_proxy_bind_address }}
2018-12-06 20:11:48 +00:00
clientConnection:
2019-01-03 08:04:26 +00:00
acceptContentTypes: {{ kube_proxy_client_accept_content_types }}
burst: {{ kube_proxy_client_burst }}
contentType: {{ kube_proxy_client_content_type }}
kubeconfig: {{ kube_proxy_client_kubeconfig }}
2019-04-23 21:37:59 +00:00
qps: {{ kube_proxy_client_qps }}
2019-01-03 08:04:26 +00:00
clusterCIDR: {{ kube_pods_subnet }}
configSyncPeriod: {{ kube_proxy_config_sync_period }}
2018-12-06 20:11:48 +00:00
conntrack:
2019-01-03 08:04:26 +00:00
max: {{ kube_proxy_conntrack_max }}
maxPerCore: {{ kube_proxy_conntrack_max_per_core }}
min: {{ kube_proxy_conntrack_min }}
tcpCloseWaitTimeout: {{ kube_proxy_conntrack_tcp_close_wait_timeout }}
tcpEstablishedTimeout: {{ kube_proxy_conntrack_tcp_established_timeout }}
enableProfiling: {{ kube_proxy_enable_profiling }}
healthzBindAddress: {{ kube_proxy_healthz_bind_address }}
2019-02-07 06:20:11 +00:00
hostnameOverride: {{ kube_override_hostname }}
2018-12-06 20:11:48 +00:00
iptables:
2019-01-03 08:04:26 +00:00
masqueradeAll: {{ kube_proxy_masquerade_all }}
masqueradeBit: {{ kube_proxy_masquerade_bit }}
minSyncPeriod: {{ kube_proxy_min_sync_period }}
syncPeriod: {{ kube_proxy_sync_period }}
2018-12-06 20:11:48 +00:00
ipvs:
2019-06-28 07:39:37 +00:00
excludeCIDRs: {{ "[]" if kube_proxy_exclude_cidrs is not defined or kube_proxy_exclude_cidrs == "null" or kube_proxy_exclude_cidrs | length == 0 else (kube_proxy_exclude_cidrs if kube_proxy_exclude_cidrs[0] == '[' else ("[" + kube_proxy_exclude_cidrs + "]" if (kube_proxy_exclude_cidrs[0] | length) == 1 else "[" + kube_proxy_exclude_cidrs | join(",") + "]")) }}
2019-01-03 08:04:26 +00:00
minSyncPeriod: {{ kube_proxy_min_sync_period }}
scheduler: {{ kube_proxy_scheduler }}
syncPeriod: {{ kube_proxy_sync_period }}
2019-08-21 01:21:17 +00:00
strictARP: {{ kube_proxy_strict_arp }}
2019-01-03 08:04:26 +00:00
metricsBindAddress: {{ kube_proxy_metrics_bind_address }}
2018-12-06 20:11:48 +00:00
mode: {{ kube_proxy_mode }}
2019-01-03 08:04:26 +00:00
nodePortAddresses: {{ kube_proxy_nodeport_addresses }}
oomScoreAdj: {{ kube_proxy_oom_score_adj }}
portRange: {{ kube_proxy_port_range }}
udpIdleTimeout: {{ kube_proxy_udp_idle_timeout }}