You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

691 lines
27 KiB

  1. ---
  2. # Use proxycommand if bastion host is in group all
  3. # This change obseletes editing ansible.cfg file depending on bastion existence
  4. ansible_ssh_common_args: "{% if 'bastion' in groups['all'] %} -o ProxyCommand='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -W %h:%p -p {{ hostvars['bastion']['ansible_port'] | default(22) }} {{ hostvars['bastion']['ansible_user'] }}@{{ hostvars['bastion']['ansible_host'] }} {% if ansible_ssh_private_key_file is defined %}-i {{ ansible_ssh_private_key_file }}{% endif %} ' {% endif %}"
  5. # selinux state
  6. preinstall_selinux_state: permissive
  7. # Setting this value to false will fail
  8. # For details, read this comment https://github.com/kubernetes-sigs/kubespray/pull/11016#issuecomment-2004985001
  9. kube_api_anonymous_auth: true
  10. # Default value, but will be set to true automatically if detected
  11. is_fedora_coreos: false
  12. # Swap settings
  13. kubelet_fail_swap_on: true
  14. kubelet_swap_behavior: LimitedSwap
  15. ## Change this to use another Kubernetes version, e.g. a current beta release
  16. kube_version: v1.29.5
  17. ## The minimum version working
  18. kube_version_min_required: v1.28.0
  19. ## Kube Proxy mode One of ['iptables', 'ipvs']
  20. kube_proxy_mode: ipvs
  21. ## The timeout for init first control-plane
  22. kubeadm_init_timeout: 300s
  23. ## List of kubeadm init phases that should be skipped during control plane setup
  24. ## By default 'addon/coredns' is skipped
  25. ## 'addon/kube-proxy' gets skipped for some network plugins
  26. kubeadm_init_phases_skip_default: [ "addon/coredns" ]
  27. kubeadm_init_phases_skip: >-
  28. {%- if kube_network_plugin == 'kube-router' and (kube_router_run_service_proxy is defined and kube_router_run_service_proxy) -%}
  29. {{ kubeadm_init_phases_skip_default + ["addon/kube-proxy"] }}
  30. {%- elif kube_network_plugin == 'cilium' and (cilium_kube_proxy_replacement is defined and cilium_kube_proxy_replacement == 'strict') -%}
  31. {{ kubeadm_init_phases_skip_default + ["addon/kube-proxy"] }}
  32. {%- elif kube_network_plugin == 'calico' and (calico_bpf_enabled is defined and calico_bpf_enabled) -%}
  33. {{ kubeadm_init_phases_skip_default + ["addon/kube-proxy"] }}
  34. {%- elif kube_proxy_remove is defined and kube_proxy_remove -%}
  35. {{ kubeadm_init_phases_skip_default + ["addon/kube-proxy"] }}
  36. {%- else -%}
  37. {{ kubeadm_init_phases_skip_default }}
  38. {%- endif -%}
  39. # List of kubeadm phases that should be skipped when joining a new node
  40. # You may need to set this to ['preflight'] for air-gaped deployments to avoid failing connectivity tests.
  41. kubeadm_join_phases_skip_default: []
  42. kubeadm_join_phases_skip: >-
  43. {{ kubeadm_join_phases_skip_default }}
  44. # Set to true to remove the role binding to anonymous users created by kubeadm
  45. remove_anonymous_access: false
  46. # A string slice of values which specify the addresses to use for NodePorts.
  47. # Values may be valid IP blocks (e.g. 1.2.3.0/24, 1.2.3.4/32).
  48. # The default empty string slice ([]) means to use all local addresses.
  49. # kube_proxy_nodeport_addresses_cidr is retained for legacy config
  50. kube_proxy_nodeport_addresses: >-
  51. {%- if kube_proxy_nodeport_addresses_cidr is defined -%}
  52. [{{ kube_proxy_nodeport_addresses_cidr }}]
  53. {%- else -%}
  54. []
  55. {%- endif -%}
  56. # Set to true to allow pre-checks to fail and continue deployment
  57. ignore_assert_errors: false
  58. kube_vip_enabled: false
  59. # nginx-proxy configure
  60. nginx_config_dir: "/etc/nginx"
  61. # haproxy configure
  62. haproxy_config_dir: "/etc/haproxy"
  63. # Directory where the binaries will be installed
  64. bin_dir: /usr/local/bin
  65. docker_bin_dir: /usr/bin
  66. containerd_bin_dir: "{{ bin_dir }}"
  67. etcd_data_dir: /var/lib/etcd
  68. # Where the binaries will be downloaded.
  69. # Note: ensure that you've enough disk space (about 1G)
  70. local_release_dir: "/tmp/releases"
  71. # Random shifts for retrying failed ops like pushing/downloading
  72. retry_stagger: 5
  73. # Install epel repo on Centos/RHEL
  74. epel_enabled: false
  75. # DNS configuration.
  76. # Kubernetes cluster name, also will be used as DNS domain
  77. cluster_name: cluster.local
  78. # Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods
  79. ndots: 2
  80. # Default resolv.conf options
  81. docker_dns_options:
  82. - ndots:{{ ndots }}
  83. - timeout:2
  84. - attempts:2
  85. # Can be coredns, coredns_dual, manual, or none
  86. dns_mode: coredns
  87. # Enable dns autoscaler
  88. enable_dns_autoscaler: true
  89. # Enable nodelocal dns cache
  90. enable_nodelocaldns: true
  91. enable_nodelocaldns_secondary: false
  92. nodelocaldns_ip: 169.254.25.10
  93. nodelocaldns_health_port: 9254
  94. nodelocaldns_second_health_port: 9256
  95. nodelocaldns_bind_metrics_host_ip: false
  96. nodelocaldns_secondary_skew_seconds: 5
  97. # Should be set to a cluster IP if using a custom cluster DNS
  98. manual_dns_server: ""
  99. # Can be host_resolvconf, docker_dns or none
  100. resolvconf_mode: host_resolvconf
  101. # Deploy netchecker app to verify DNS resolve as an HTTP service
  102. deploy_netchecker: false
  103. # Ip address of the kubernetes DNS service (called skydns for historical reasons)
  104. skydns_server: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(3) | ansible.utils.ipaddr('address') }}"
  105. skydns_server_secondary: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(4) | ansible.utils.ipaddr('address') }}"
  106. dns_domain: "{{ cluster_name }}"
  107. docker_dns_search_domains:
  108. - 'default.svc.{{ dns_domain }}'
  109. - 'svc.{{ dns_domain }}'
  110. kube_dns_servers:
  111. coredns: ["{{ skydns_server }}"]
  112. coredns_dual: "{{ [skydns_server] + [skydns_server_secondary] }}"
  113. manual: ["{{ manual_dns_server }}"]
  114. dns_servers: "{{ kube_dns_servers[dns_mode] }}"
  115. enable_coredns_k8s_external: false
  116. coredns_k8s_external_zone: k8s_external.local
  117. enable_coredns_k8s_endpoint_pod_names: false
  118. # Kubernetes configuration dirs and system namespace.
  119. # Those are where all the additional config stuff goes
  120. # the kubernetes normally puts in /srv/kubernetes.
  121. # This puts them in a sane location and namespace.
  122. # Editing those values will almost surely break something.
  123. kube_config_dir: /etc/kubernetes
  124. kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
  125. kube_manifest_dir: "{{ kube_config_dir }}/manifests"
  126. # Kubectl command
  127. # This is for consistency when using kubectl command in roles, and ensure
  128. kubectl: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf"
  129. # This is where all the cert scripts and certs will be located
  130. kube_cert_dir: "{{ kube_config_dir }}/ssl"
  131. # compatibility directory for kubeadm
  132. kube_cert_compat_dir: "/etc/kubernetes/pki"
  133. # This is where all of the bearer tokens will be stored
  134. kube_token_dir: "{{ kube_config_dir }}/tokens"
  135. # This is the user that owns the cluster installation.
  136. kube_owner: kube
  137. # This is the group that the cert creation scripts chgrp the
  138. # cert files to. Not really changeable...
  139. kube_cert_group: kube-cert
  140. # Set to true when the CAs are managed externally.
  141. # When true, disables all tasks manipulating certificates. Ensure before the kubespray run that:
  142. # - Certificates and CAs are present in kube_cert_dir
  143. # - Kubeconfig files are present in kube_config_dir
  144. kube_external_ca_mode: false
  145. # Cluster Loglevel configuration
  146. kube_log_level: 2
  147. # Choose network plugin (cilium, calico, kube-ovn, weave or flannel. Use cni for generic cni plugin)
  148. # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
  149. kube_network_plugin: calico
  150. kube_network_plugin_multus: false
  151. # Determines if calico_rr group exists
  152. peer_with_calico_rr: "{{ 'calico_rr' in groups and groups['calico_rr'] | length > 0 }}"
  153. # Choose data store type for calico: "etcd" or "kdd" (kubernetes datastore)
  154. calico_datastore: "kdd"
  155. # Kubernetes internal network for services, unused block of space.
  156. kube_service_addresses: 10.233.0.0/18
  157. # internal network. When used, it will assign IP
  158. # addresses from this range to individual pods.
  159. # This network must be unused in your network infrastructure!
  160. kube_pods_subnet: 10.233.64.0/18
  161. # internal network node size allocation (optional). This is the size allocated
  162. # to each node for pod IP address allocation. Note that the number of pods per node is
  163. # also limited by the kubelet_max_pods variable which defaults to 110.
  164. #
  165. # Example:
  166. # Up to 64 nodes and up to 254 or kubelet_max_pods (the lowest of the two) pods per node:
  167. # - kube_pods_subnet: 10.233.64.0/18
  168. # - kube_network_node_prefix: 24
  169. # - kubelet_max_pods: 110
  170. #
  171. # Example:
  172. # Up to 128 nodes and up to 126 or kubelet_max_pods (the lowest of the two) pods per node:
  173. # - kube_pods_subnet: 10.233.64.0/18
  174. # - kube_network_node_prefix: 25
  175. # - kubelet_max_pods: 110
  176. kube_network_node_prefix: 24
  177. # Configure Dual Stack networking (i.e. both IPv4 and IPv6)
  178. enable_dual_stack_networks: false
  179. # Kubernetes internal network for IPv6 services, unused block of space.
  180. # This is only used if enable_dual_stack_networks is set to true
  181. # This provides 4096 IPv6 IPs
  182. kube_service_addresses_ipv6: fd85:ee78:d8a6:8607::1000/116
  183. # Internal network. When used, it will assign IPv6 addresses from this range to individual pods.
  184. # This network must not already be in your network infrastructure!
  185. # This is only used if enable_dual_stack_networks is set to true.
  186. # This provides room for 256 nodes with 254 pods per node.
  187. kube_pods_subnet_ipv6: fd85:ee78:d8a6:8607::1:0000/112
  188. # IPv6 subnet size allocated to each for pods.
  189. # This is only used if enable_dual_stack_networks is set to true
  190. # This provides room for 254 pods per node.
  191. kube_network_node_prefix_ipv6: 120
  192. # The virtual cluster IP, real host IPs and ports the API Server will be
  193. # listening on.
  194. # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
  195. # access IP value (automatically evaluated below)
  196. kube_apiserver_ip: "{{ kube_service_addresses | ansible.utils.ipaddr('net') | ansible.utils.ipaddr(1) | ansible.utils.ipaddr('address') }}"
  197. # NOTE: If you specific address/interface and use loadbalancer_apiserver_localhost
  198. # loadbalancer_apiserver_localhost (nginx/haproxy) will deploy on masters on 127.0.0.1:{{ loadbalancer_apiserver_port | default(kube_apiserver_port) }} too.
  199. kube_apiserver_bind_address: 0.0.0.0
  200. # https
  201. kube_apiserver_port: 6443
  202. # If non-empty, will use this string as identification instead of the actual hostname
  203. kube_override_hostname: >-
  204. {%- if cloud_provider is defined and cloud_provider in ['aws'] -%}
  205. {%- else -%}
  206. {{ inventory_hostname }}
  207. {%- endif -%}
  208. # define kubelet config dir for dynamic kubelet
  209. # kubelet_config_dir:
  210. default_kubelet_config_dir: "{{ kube_config_dir }}/dynamic_kubelet_dir"
  211. # Aggregator
  212. kube_api_aggregator_routing: false
  213. # Profiling
  214. kube_profiling: false
  215. # Graceful Node Shutdown
  216. kubelet_shutdown_grace_period: 60s
  217. # kubelet_shutdown_grace_period_critical_pods should be less than kubelet_shutdown_grace_period
  218. # to give normal pods time to be gracefully evacuated
  219. kubelet_shutdown_grace_period_critical_pods: 20s
  220. # Whether to deploy the container engine
  221. deploy_container_engine: "{{ inventory_hostname in groups['k8s_cluster'] or etcd_deployment_type == 'docker' }}"
  222. # Container for runtime
  223. container_manager: containerd
  224. # Enable Node Resource Interface in containerd or CRI-O. Requires crio_version >= v1.26.0
  225. # or containerd_version >= 1.7.0.
  226. nri_enabled: false
  227. # Enable Kata Containers as additional container runtime
  228. # When enabled, it requires `container_manager` different than Docker
  229. kata_containers_enabled: false
  230. # Enable gVisor as an additional container runtime
  231. # gVisor is only supported with container_manager Docker or containerd
  232. gvisor_enabled: false
  233. # Enable crun as additional container runtime
  234. # When enabled, it requires container_manager=crio
  235. crun_enabled: false
  236. # Enable youki as additional container runtime
  237. # When enabled, it requires container_manager=crio
  238. youki_enabled: false
  239. # Container on localhost (download images when download_localhost is true)
  240. container_manager_on_localhost: "{{ container_manager }}"
  241. # CRI socket path
  242. cri_socket: >-
  243. {%- if container_manager == 'crio' -%}
  244. unix:///var/run/crio/crio.sock
  245. {%- elif container_manager == 'containerd' -%}
  246. unix:///var/run/containerd/containerd.sock
  247. {%- elif container_manager == 'docker' -%}
  248. unix:///var/run/cri-dockerd.sock
  249. {%- endif -%}
  250. crio_insecure_registries: []
  251. ## Uncomment this if you want to force overlay/overlay2 as docker storage driver
  252. ## Please note that overlay2 is only supported on newer kernels
  253. # docker_storage_options: -s overlay2
  254. ## Enable docker_container_storage_setup, it will configure devicemapper driver on Centos7 or RedHat7.
  255. docker_container_storage_setup: false
  256. ## It must be define a disk path for docker_container_storage_setup_devs.
  257. ## Otherwise docker-storage-setup will be executed incorrectly.
  258. # docker_container_storage_setup_devs: /dev/vdb
  259. ## Only set this if you have more than 3 nameservers:
  260. ## If true Kubespray will only use the first 3, otherwise it will fail
  261. docker_dns_servers_strict: false
  262. # Path used to store Docker data
  263. docker_daemon_graph: "/var/lib/docker"
  264. ## Used to set docker daemon iptables options to true
  265. docker_iptables_enabled: "false"
  266. # Docker log options
  267. # Rotate container stderr/stdout logs at 50m and keep last 5
  268. docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5"
  269. ## A list of insecure docker registries (IP address or domain name), for example
  270. ## to allow insecure-registry access to self-hosted registries. Empty by default.
  271. # docker_insecure_registries:
  272. # - mirror.registry.io
  273. # - 172.19.16.11
  274. docker_insecure_registries: []
  275. ## A list of additional registry mirrors, for example China registry mirror. Empty by default.
  276. # docker_registry_mirrors:
  277. # - https://registry.docker-cn.com
  278. # - https://mirror.aliyuncs.com
  279. docker_registry_mirrors: []
  280. ## If non-empty will override default system MounFlags value.
  281. ## This option takes a mount propagation flag: shared, slave
  282. ## or private, which control whether mounts in the file system
  283. ## namespace set up for docker will receive or propagate mounts
  284. ## and unmounts. Leave empty for system default
  285. # docker_mount_flags:
  286. ## A string of extra options to pass to the docker daemon.
  287. # docker_options: ""
  288. ## A list of plugins to install using 'docker plugin install --grant-all-permissions'
  289. ## Empty by default so no plugins will be installed.
  290. docker_plugins: []
  291. # Containerd options - thse are relevant when container_manager == 'containerd'
  292. containerd_use_systemd_cgroup: true
  293. # Containerd conf default dir
  294. containerd_storage_dir: "/var/lib/containerd"
  295. containerd_state_dir: "/run/containerd"
  296. containerd_systemd_dir: "/etc/systemd/system/containerd.service.d"
  297. containerd_cfg_dir: "/etc/containerd"
  298. # Settings for containerized control plane (etcd/kubelet/secrets)
  299. # deployment type for legacy etcd mode
  300. etcd_deployment_type: host
  301. cert_management: script
  302. # Make a copy of kubeconfig on the host that runs Ansible in {{ inventory_dir }}/artifacts
  303. kubeconfig_localhost: false
  304. # Download kubectl onto the host that runs Ansible in {{ bin_dir }}
  305. kubectl_localhost: false
  306. # Define credentials_dir here so it can be overridden
  307. credentials_dir: "{{ inventory_dir }}/credentials"
  308. # K8s image pull policy (imagePullPolicy)
  309. k8s_image_pull_policy: IfNotPresent
  310. # Kubernetes dashboard
  311. # RBAC required. see docs/getting-started.md for access details.
  312. dashboard_enabled: false
  313. # Addons which can be enabled
  314. helm_enabled: false
  315. krew_enabled: false
  316. registry_enabled: false
  317. metrics_server_enabled: false
  318. enable_network_policy: true
  319. local_path_provisioner_enabled: false
  320. local_volume_provisioner_enabled: false
  321. local_volume_provisioner_directory_mode: 0700
  322. cinder_csi_enabled: false
  323. aws_ebs_csi_enabled: false
  324. azure_csi_enabled: false
  325. gcp_pd_csi_enabled: false
  326. vsphere_csi_enabled: false
  327. upcloud_csi_enabled: false
  328. csi_snapshot_controller_enabled: false
  329. persistent_volumes_enabled: false
  330. cephfs_provisioner_enabled: false
  331. rbd_provisioner_enabled: false
  332. ingress_nginx_enabled: false
  333. ingress_alb_enabled: false
  334. cert_manager_enabled: false
  335. expand_persistent_volumes: false
  336. metallb_enabled: false
  337. metallb_speaker_enabled: "{{ metallb_enabled }}"
  338. argocd_enabled: false
  339. ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (Fixed in 1.9: https://github.com/kubernetes/kubernetes/issues/50461)
  340. # openstack_blockstorage_version: "v1/v2/auto (default)"
  341. openstack_blockstorage_ignore_volume_az: "{{ volume_cross_zone_attachment | default('false') }}"
  342. # set max volumes per node (cinder-csi), default not set
  343. # node_volume_attach_limit: 25
  344. # Cinder CSI topology, when false volumes can be cross-mounted between availability zones
  345. # cinder_topology: false
  346. # Set Cinder topology zones (can be multiple zones, default not set)
  347. # cinder_topology_zones:
  348. # - nova
  349. cinder_csi_ignore_volume_az: "{{ volume_cross_zone_attachment | default('false') }}"
  350. ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following 2 variables.
  351. openstack_lbaas_enabled: false
  352. # openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP"
  353. ## To enable automatic floating ip provisioning, specify a subnet.
  354. # openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default"
  355. ## Override default LBaaS behavior
  356. # openstack_lbaas_use_octavia: False
  357. # openstack_lbaas_method: "ROUND_ROBIN"
  358. # openstack_lbaas_provider: "haproxy"
  359. openstack_lbaas_create_monitor: "yes"
  360. openstack_lbaas_monitor_delay: "1m"
  361. openstack_lbaas_monitor_timeout: "30s"
  362. openstack_lbaas_monitor_max_retries: "3"
  363. openstack_cacert: "{{ lookup('env', 'OS_CACERT') }}"
  364. # Default values for the external OpenStack Cloud Controller
  365. external_openstack_lbaas_enabled: true
  366. external_openstack_network_ipv6_disabled: false
  367. external_openstack_network_internal_networks: []
  368. external_openstack_network_public_networks: []
  369. # Default values for the external Hcloud Cloud Controller
  370. external_hcloud_cloud:
  371. hcloud_api_token: ""
  372. token_secret_name: hcloud
  373. service_account_name: cloud-controller-manager
  374. controller_image_tag: "latest"
  375. ## A dictionary of extra arguments to add to the openstack cloud controller manager daemonset
  376. ## Format:
  377. ## external_hcloud_cloud.controller_extra_args:
  378. ## arg1: "value1"
  379. ## arg2: "value2"
  380. controller_extra_args: {}
  381. ## List of authorization modes that must be configured for
  382. ## the k8s cluster. Only 'AlwaysAllow', 'AlwaysDeny', 'Node' and
  383. ## 'RBAC' modes are tested. Order is important.
  384. authorization_modes: ['Node', 'RBAC']
  385. rbac_enabled: "{{ 'RBAC' in authorization_modes }}"
  386. # When enabled, API bearer tokens (including service account tokens) can be used to authenticate to the kubelet's HTTPS endpoint
  387. kubelet_authentication_token_webhook: true
  388. # When enabled, access to the kubelet API requires authorization by delegation to the API server
  389. kubelet_authorization_mode_webhook: true
  390. # kubelet uses certificates for authenticating to the Kubernetes API
  391. # Automatically generate a new key and request a new certificate from the Kubernetes API as the current certificate approaches expiration
  392. kubelet_rotate_certificates: true
  393. # kubelet can also request a new server certificate from the Kubernetes API
  394. kubelet_rotate_server_certificates: false
  395. # If set to true, kubelet errors if any of kernel tunables is different than kubelet defaults
  396. kubelet_protect_kernel_defaults: true
  397. # Set additional sysctl variables to modify Linux kernel variables, for example:
  398. # additional_sysctl:
  399. # - { name: kernel.pid_max, value: 131072 }
  400. #
  401. additional_sysctl: []
  402. ## List of key=value pairs that describe feature gates for
  403. ## the k8s cluster.
  404. kube_feature_gates: []
  405. kube_apiserver_feature_gates: []
  406. kube_controller_feature_gates: []
  407. kube_scheduler_feature_gates: []
  408. kube_proxy_feature_gates: []
  409. kubelet_feature_gates: []
  410. kubeadm_feature_gates: []
  411. # Local volume provisioner storage classes
  412. # Levarages Ansibles string to Python datatype casting. Otherwise the dict_key isn't substituted
  413. # see https://github.com/ansible/ansible/issues/17324
  414. local_volume_provisioner_storage_classes: |
  415. {
  416. "{{ local_volume_provisioner_storage_class | default('local-storage') }}": {
  417. "host_dir": "{{ local_volume_provisioner_base_dir | default('/mnt/disks') }}",
  418. "mount_dir": "{{ local_volume_provisioner_mount_dir | default('/mnt/disks') }}",
  419. "volume_mode": "Filesystem",
  420. "fs_type": "ext4"
  421. }
  422. }
  423. # weave's network password for encryption
  424. # if null then no network encryption
  425. # you can use --extra-vars to pass the password in command line
  426. weave_password: EnterPasswordHere
  427. ssl_ca_dirs: |-
  428. [
  429. {% if ansible_os_family in ['Flatcar', 'Flatcar Container Linux by Kinvolk'] -%}
  430. '/usr/share/ca-certificates',
  431. {% elif ansible_os_family == 'RedHat' -%}
  432. '/etc/pki/tls',
  433. '/etc/pki/ca-trust',
  434. {% elif ansible_os_family == 'Debian' -%}
  435. '/usr/share/ca-certificates',
  436. {% endif -%}
  437. ]
  438. # Vars for pointing to kubernetes api endpoints
  439. is_kube_master: "{{ inventory_hostname in groups['kube_control_plane'] }}"
  440. kube_apiserver_count: "{{ groups['kube_control_plane'] | length }}"
  441. kube_apiserver_address: "{{ ip | default(fallback_ips[inventory_hostname]) }}"
  442. kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
  443. first_kube_control_plane_address: "{{ hostvars[groups['kube_control_plane'][0]]['access_ip'] | default(hostvars[groups['kube_control_plane'][0]]['ip'] | default(fallback_ips[groups['kube_control_plane'][0]])) }}"
  444. loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
  445. loadbalancer_apiserver_type: "nginx"
  446. # applied if only external loadbalancer_apiserver is defined, otherwise ignored
  447. apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
  448. kube_apiserver_global_endpoint: |-
  449. {% if loadbalancer_apiserver is defined -%}
  450. https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
  451. {%- elif loadbalancer_apiserver_localhost and (loadbalancer_apiserver_port is not defined or loadbalancer_apiserver_port == kube_apiserver_port) -%}
  452. https://localhost:{{ kube_apiserver_port }}
  453. {%- else -%}
  454. https://{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
  455. {%- endif %}
  456. kube_apiserver_endpoint: |-
  457. {% if loadbalancer_apiserver is defined -%}
  458. https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port | default(kube_apiserver_port) }}
  459. {%- elif not is_kube_master and loadbalancer_apiserver_localhost -%}
  460. https://localhost:{{ loadbalancer_apiserver_port | default(kube_apiserver_port) }}
  461. {%- elif is_kube_master -%}
  462. https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0', '127.0.0.1') }}:{{ kube_apiserver_port }}
  463. {%- else -%}
  464. https://{{ first_kube_control_plane_address }}:{{ kube_apiserver_port }}
  465. {%- endif %}
  466. kube_apiserver_client_cert: "{{ kube_cert_dir }}/ca.crt"
  467. kube_apiserver_client_key: "{{ kube_cert_dir }}/ca.key"
  468. # Set to true to deploy etcd-events cluster
  469. etcd_events_cluster_enabled: false
  470. # etcd group can be empty when kubeadm manages etcd
  471. etcd_hosts: "{{ groups['etcd'] | default(groups['kube_control_plane']) }}"
  472. # Vars for pointing to etcd endpoints
  473. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  474. etcd_address: "{{ ip | default(fallback_ips[inventory_hostname]) }}"
  475. etcd_access_address: "{{ access_ip | default(etcd_address) }}"
  476. etcd_events_access_address: "{{ access_ip | default(etcd_address) }}"
  477. etcd_peer_url: "https://{{ etcd_access_address }}:2380"
  478. etcd_client_url: "https://{{ etcd_access_address }}:2379"
  479. etcd_events_peer_url: "https://{{ etcd_events_access_address }}:2382"
  480. etcd_events_client_url: "https://{{ etcd_events_access_address }}:2383"
  481. etcd_access_addresses: |-
  482. {% for item in etcd_hosts -%}
  483. https://{{ hostvars[item]['etcd_access_address'] | default(hostvars[item]['ip'] | default(fallback_ips[item])) }}:2379{% if not loop.last %},{% endif %}
  484. {%- endfor %}
  485. etcd_events_access_addresses_list: |-
  486. [
  487. {% for item in etcd_hosts -%}
  488. 'https://{{ hostvars[item]['etcd_events_access_address'] | default(hostvars[item]['ip'] | default(fallback_ips[item])) }}:2383'{% if not loop.last %},{% endif %}
  489. {%- endfor %}
  490. ]
  491. etcd_metrics_addresses: |-
  492. {% for item in etcd_hosts -%}
  493. https://{{ hostvars[item]['etcd_access_address'] | default(hostvars[item]['ip'] | default(fallback_ips[item])) }}:{{ etcd_metrics_port | default(2381) }}{% if not loop.last %},{% endif %}
  494. {%- endfor %}
  495. etcd_events_access_addresses: "{{ etcd_events_access_addresses_list | join(',') }}"
  496. etcd_events_access_addresses_semicolon: "{{ etcd_events_access_addresses_list | join(';') }}"
  497. # user should set etcd_member_name in inventory/mycluster/hosts.ini
  498. etcd_member_name: |-
  499. {% for host in groups['etcd'] %}
  500. {% if inventory_hostname == host %}{{ hostvars[host].etcd_member_name | default("etcd" + loop.index | string) }}{% endif %}
  501. {% endfor %}
  502. etcd_peer_addresses: |-
  503. {% for item in groups['etcd'] -%}
  504. {{ hostvars[item].etcd_member_name | default("etcd" + loop.index | string) }}=https://{{ hostvars[item].etcd_access_address | default(hostvars[item].ip | default(fallback_ips[item])) }}:2380{% if not loop.last %},{% endif %}
  505. {%- endfor %}
  506. etcd_events_peer_addresses: |-
  507. {% for item in groups['etcd'] -%}
  508. {{ hostvars[item].etcd_member_name | default("etcd" + loop.index | string) }}-events=https://{{ hostvars[item].etcd_events_access_address | default(hostvars[item].ip | default(fallback_ips[item])) }}:2382{% if not loop.last %},{% endif %}
  509. {%- endfor %}
  510. etcd_heartbeat_interval: "250"
  511. etcd_election_timeout: "5000"
  512. etcd_snapshot_count: "10000"
  513. certificates_key_size: 2048
  514. certificates_duration: 36500
  515. etcd_config_dir: /etc/ssl/etcd
  516. etcd_events_data_dir: "/var/lib/etcd-events"
  517. etcd_cert_dir: "{{ etcd_config_dir }}/ssl"
  518. typha_enabled: false
  519. calico_apiserver_enabled: false
  520. _host_architecture_groups:
  521. x86_64: amd64
  522. aarch64: arm64
  523. armv7l: arm
  524. host_architecture: >-
  525. {%- if ansible_architecture in _host_architecture_groups -%}
  526. {{ _host_architecture_groups[ansible_architecture] }}
  527. {%- else -%}
  528. {{ ansible_architecture }}
  529. {%- endif -%}
  530. _host_os_groups:
  531. Linux: linux
  532. Darwin: darwin
  533. Win32NT: windows
  534. host_os: >-
  535. {%- if ansible_system in _host_os_groups -%}
  536. {{ _host_os_groups[ansible_system] }}
  537. {%- else -%}
  538. {{ ansible_system }}
  539. {%- endif -%}
  540. # Sets the eventRecordQPS parameter in kubelet-config.yaml.
  541. # Setting it to 0 allows unlimited requests per second.
  542. kubelet_event_record_qps: 50
  543. proxy_env_defaults:
  544. http_proxy: "{{ http_proxy | default('') }}"
  545. HTTP_PROXY: "{{ http_proxy | default('') }}"
  546. https_proxy: "{{ https_proxy | default('') }}"
  547. HTTPS_PROXY: "{{ https_proxy | default('') }}"
  548. no_proxy: "{{ no_proxy | default('') }}"
  549. NO_PROXY: "{{ no_proxy | default('') }}"
  550. # If we use SSL_CERT_FILE: {{ omit }} it cause in value __omit_place_holder__ and break environments
  551. # Combine dict is avoiding the problem with omit placeholder. Maybe it can be better solution?
  552. proxy_env: "{{ proxy_env_defaults | combine({'SSL_CERT_FILE': https_proxy_cert_file}) if https_proxy_cert_file is defined else proxy_env_defaults }}"
  553. proxy_disable_env:
  554. ALL_PROXY: ''
  555. FTP_PROXY: ''
  556. HTTPS_PROXY: ''
  557. HTTP_PROXY: ''
  558. NO_PROXY: ''
  559. all_proxy: ''
  560. ftp_proxy: ''
  561. http_proxy: ''
  562. https_proxy: ''
  563. no_proxy: ''
  564. # krew root dir
  565. krew_root_dir: "/usr/local/krew"
  566. # sysctl_file_path to add sysctl conf to
  567. sysctl_file_path: "/etc/sysctl.d/99-sysctl.conf"
  568. system_upgrade: false
  569. system_upgrade_reboot: on-upgrade # never, always
  570. # Enables or disables the scheduler plugins.
  571. scheduler_plugins_enabled: false