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.

370 lines
15 KiB

6 years ago
  1. ---
  2. ## Required for bootstrap-os/preinstall/download roles and setting facts
  3. # Valid bootstrap options (required): ubuntu, coreos, centos, none
  4. bootstrap_os: none
  5. # Use proxycommand if bastion host is in group all
  6. # This change obseletes editing ansible.cfg file depending on bastion existance
  7. ansible_ssh_common_args: "{% if 'bastion' in groups['all'] %} -o ProxyCommand='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -W %h:%p {{ hostvars['bastion']['ansible_user'] }}@{{ hostvars['bastion']['ansible_host'] }} {% if ansible_ssh_private_key_file is defined %}-i {{ ansible_ssh_private_key_file }}{% endif %} ' {% endif %}"
  8. kube_api_anonymous_auth: false
  9. # Default value, but will be set to true automatically if detected
  10. is_atomic: false
  11. # optional disable the swap
  12. disable_swap: true
  13. ## Change this to use another Kubernetes version, e.g. a current beta release
  14. kube_version: v1.11.2
  15. ## Kube Proxy mode One of ['iptables','ipvs']
  16. kube_proxy_mode: iptables
  17. # Set to true to allow pre-checks to fail and continue deployment
  18. ignore_assert_errors: false
  19. # Directory where the binaries will be installed
  20. bin_dir: /usr/local/bin
  21. docker_bin_dir: /usr/bin
  22. etcd_data_dir: /var/lib/etcd
  23. # Where the binaries will be downloaded.
  24. # Note: ensure that you've enough disk space (about 1G)
  25. local_release_dir: "/tmp/releases"
  26. # Random shifts for retrying failed ops like pushing/downloading
  27. retry_stagger: 5
  28. # DNS configuration.
  29. # Kubernetes cluster name, also will be used as DNS domain
  30. cluster_name: cluster.local
  31. # Subdomains of DNS domain to be resolved via /etc/resolv.conf for hostnet pods
  32. ndots: 2
  33. # Can be dnsmasq_kubedns, kubedns, manual or none
  34. dns_mode: kubedns
  35. # Should be set to a cluster IP if using a custom cluster DNS
  36. # manual_dns_server: 10.x.x.x
  37. # Can be docker_dns, host_resolvconf or none
  38. resolvconf_mode: docker_dns
  39. # Deploy netchecker app to verify DNS resolve as an HTTP service
  40. deploy_netchecker: false
  41. # Ip address of the kubernetes skydns service
  42. skydns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(3)|ipaddr('address') }}"
  43. skydns_server_secondary: "{{ kube_service_addresses|ipaddr('net')|ipaddr(4)|ipaddr('address') }}"
  44. dnsmasq_dns_server: "{{ kube_service_addresses|ipaddr('net')|ipaddr(2)|ipaddr('address') }}"
  45. dns_domain: "{{ cluster_name }}"
  46. # Kubernetes configuration dirs and system namespace.
  47. # Those are where all the additional config stuff goes
  48. # the kubernetes normally puts in /srv/kubernets.
  49. # This puts them in a sane location and namespace.
  50. # Editting those values will almost surely break something.
  51. kube_config_dir: /etc/kubernetes
  52. kube_script_dir: "{{ bin_dir }}/kubernetes-scripts"
  53. kube_manifest_dir: "{{ kube_config_dir }}/manifests"
  54. # This is where all the cert scripts and certs will be located
  55. kube_cert_dir: "{{ kube_config_dir }}/ssl"
  56. # This is where all of the bearer tokens will be stored
  57. kube_token_dir: "{{ kube_config_dir }}/tokens"
  58. # This is where to save basic auth file
  59. kube_users_dir: "{{ kube_config_dir }}/users"
  60. # This is the group that the cert creation scripts chgrp the
  61. # cert files to. Not really changable...
  62. kube_cert_group: kube-cert
  63. # Cluster Loglevel configuration
  64. kube_log_level: 2
  65. # Users to create for basic auth in Kubernetes API via HTTP
  66. kube_api_pwd: "changeme"
  67. kube_users:
  68. kube:
  69. pass: "{{kube_api_pwd}}"
  70. role: admin
  71. # Choose network plugin (cilium, calico, weave or flannel)
  72. # Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
  73. kube_network_plugin: calico
  74. # Determines if calico-rr group exists
  75. peer_with_calico_rr: "{{ 'calico-rr' in groups and groups['calico-rr']|length > 0 }}"
  76. # Kubernetes internal network for services, unused block of space.
  77. kube_service_addresses: 10.233.0.0/18
  78. # internal network. When used, it will assign IP
  79. # addresses from this range to individual pods.
  80. # This network must be unused in your network infrastructure!
  81. kube_pods_subnet: 10.233.64.0/18
  82. # internal network node size allocation (optional). This is the size allocated
  83. # to each node on your network. With these defaults you should have
  84. # room for 64 nodes with 254 pods per node.
  85. # Example: Up to 256 nodes, 100 pods per node (/16 network):
  86. # - kube_service_addresses: 10.233.0.0/17
  87. # - kube_pods_subnet: 10.233.128.0/17
  88. # - kube_network_node_prefix: 25
  89. # Example: Up to 4096 nodes, 100 pods per node (/12 network):
  90. # - kube_service_addresses: 10.192.0.0/13
  91. # - kube_pods_subnet: 10.200.0.0/13
  92. # - kube_network_node_prefix: 25
  93. kube_network_node_prefix: 24
  94. # The virtual cluster IP, real host IPs and ports the API Server will be
  95. # listening on.
  96. # NOTE: loadbalancer_apiserver_localhost somewhat alters the final API enpdoint
  97. # access IP value (automatically evaluated below)
  98. kube_apiserver_ip: "{{ kube_service_addresses|ipaddr('net')|ipaddr(1)|ipaddr('address') }}"
  99. kube_apiserver_bind_address: 0.0.0.0
  100. # https
  101. kube_apiserver_port: 6443
  102. # http
  103. kube_apiserver_insecure_bind_address: 127.0.0.1
  104. kube_apiserver_insecure_port: 8080
  105. # Aggregator
  106. kube_api_aggregator_routing: false
  107. # Container for runtime
  108. container_manager: docker
  109. # Path used to store Docker data
  110. docker_daemon_graph: "/var/lib/docker"
  111. # Docker log options
  112. # Rotate container stderr/stdout logs at 50m and keep last 5
  113. docker_log_opts: "--log-opt max-size=50m --log-opt max-file=5"
  114. ## A string of extra options to pass to the docker daemon.
  115. ## This string should be exactly as you wish it to appear.
  116. ## An obvious use case is allowing insecure-registry access
  117. ## to self hosted registries like so:
  118. docker_options: >
  119. --insecure-registry={{ kube_service_addresses }} --graph={{ docker_daemon_graph }} {{ docker_log_opts }}
  120. {% if ansible_architecture == "aarch64" and ansible_os_family == "RedHat" %}
  121. --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current
  122. --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd
  123. --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --signature-verification=false
  124. {% endif %}
  125. ## If non-empty will override default system MounFlags value.
  126. ## This option takes a mount propagation flag: shared, slave
  127. ## or private, which control whether mounts in the file system
  128. ## namespace set up for docker will receive or propagate mounts
  129. ## and unmounts. Leave empty for system default
  130. docker_mount_flags:
  131. # Settings for containerized control plane (etcd/kubelet/secrets)
  132. etcd_deployment_type: docker
  133. kubelet_deployment_type: docker
  134. cert_management: script
  135. vault_deployment_type: docker
  136. helm_deployment_type: host
  137. # Enable kubeadm deployment (experimental)
  138. kubeadm_enabled: false
  139. # Make a copy of kubeconfig on the host that runs Ansible in {{ inventory_dir }}/artifacts
  140. kubeconfig_localhost: false
  141. # Download kubectl onto the host that runs Ansible in {{ bin_dir }}
  142. kubectl_localhost: false
  143. # K8s image pull policy (imagePullPolicy)
  144. k8s_image_pull_policy: IfNotPresent
  145. # Kubernetes dashboard
  146. # RBAC required. see docs/getting-started.md for access details.
  147. dashboard_enabled: true
  148. # Addons which can be enabled
  149. efk_enabled: false
  150. helm_enabled: false
  151. registry_enabled: false
  152. enable_network_policy: true
  153. local_volume_provisioner_enabled: "{{ local_volumes_enabled | default('false') }}"
  154. persistent_volumes_enabled: false
  155. cephfs_provisioner_enabled: false
  156. ingress_nginx_enabled: false
  157. cert_manager_enabled: false
  158. ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (Fixed in 1.9: https://github.com/kubernetes/kubernetes/issues/50461)
  159. # openstack_blockstorage_version: "v1/v2/auto (default)"
  160. ## When OpenStack is used, if LBaaSv2 is available you can enable it with the following 2 variables.
  161. openstack_lbaas_enabled: false
  162. # openstack_lbaas_subnet_id: "Neutron subnet ID (not network ID) to create LBaaS VIP"
  163. ## To enable automatic floating ip provisioning, specify a subnet.
  164. # openstack_lbaas_floating_network_id: "Neutron network ID (not subnet ID) to get floating IP from, disabled by default"
  165. ## Override default LBaaS behavior
  166. # openstack_lbaas_use_octavia: False
  167. # openstack_lbaas_method: "ROUND_ROBIN"
  168. # openstack_lbaas_provider: "haproxy"
  169. openstack_lbaas_create_monitor: "yes"
  170. openstack_lbaas_monitor_delay: "1m"
  171. openstack_lbaas_monitor_timeout: "30s"
  172. openstack_lbaas_monitor_max_retries: "3"
  173. ## List of authorization modes that must be configured for
  174. ## the k8s cluster. Only 'AlwaysAllow', 'AlwaysDeny', 'Node' and
  175. ## 'RBAC' modes are tested. Order is important.
  176. authorization_modes: ['Node', 'RBAC']
  177. rbac_enabled: "{{ 'RBAC' in authorization_modes or kubeadm_enabled }}"
  178. # When enabled, API bearer tokens (including service account tokens) can be used to authenticate to the kubelet’s HTTPS endpoint
  179. kubelet_authentication_token_webhook: true
  180. # When enabled, access to the kubelet API requires authorization by delegation to the API server
  181. kubelet_authorization_mode_webhook: false
  182. ## List of key=value pairs that describe feature gates for
  183. ## the k8s cluster.
  184. kube_feature_gates:
  185. - "PersistentLocalVolumes={{ local_volume_provisioner_enabled | string }}"
  186. - "VolumeScheduling={{ local_volume_provisioner_enabled | string }}"
  187. - "MountPropagation={{ local_volume_provisioner_enabled | string }}"
  188. # Vault data dirs.
  189. vault_base_dir: /etc/vault
  190. vault_cert_dir: "{{ vault_base_dir }}/ssl"
  191. vault_config_dir: "{{ vault_base_dir }}/config"
  192. vault_roles_dir: "{{ vault_base_dir }}/roles"
  193. vault_secrets_dir: "{{ vault_base_dir }}/secrets"
  194. # Local volume provisioner dirs
  195. local_volume_provisioner_base_dir: /mnt/disks
  196. local_volume_provisioner_mount_dir: /mnt/disks
  197. ## Running on top of openstack vms with cinder enabled may lead to unschedulable pods due to NoVolumeZoneConflict restriction in kube-scheduler.
  198. ## See https://github.com/kubernetes-incubator/kubespray/issues/2141
  199. ## Set this variable to true to get rid of this issue
  200. volume_cross_zone_attachment: false
  201. # weave's network password for encryption
  202. # if null then no network encryption
  203. # you can use --extra-vars to pass the password in command line
  204. weave_password: EnterPasswordHere
  205. # Weave uses consensus mode by default
  206. # Enabling seed mode allow to dynamically add or remove hosts
  207. # https://www.weave.works/docs/net/latest/ipam/
  208. weave_mode_seed: false
  209. # This two variable are automatically changed by the weave's role in group_vars/k8s-cluster.yml.
  210. # Do not manually change these values
  211. weave_seed: uninitialized
  212. weave_peers: uninitialized
  213. ## Set no_proxy to all assigned cluster IPs and hostnames
  214. no_proxy: >-
  215. {%- if http_proxy is defined or https_proxy is defined %}
  216. {%- if loadbalancer_apiserver is defined -%}
  217. {{ apiserver_loadbalancer_domain_name| default('') }},
  218. {{ loadbalancer_apiserver.address | default('') }},
  219. {%- endif -%}
  220. {%- for item in (groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]))|unique -%}
  221. {{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }},
  222. {%- if (item != hostvars[item]['ansible_hostname']) -%}
  223. {{ hostvars[item]['ansible_hostname'] }},
  224. {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }},
  225. {%- endif -%}
  226. {{ item }},{{ item }}.{{ dns_domain }},
  227. {%- endfor -%}
  228. 127.0.0.1,localhost
  229. {%- endif %}
  230. proxy_env:
  231. http_proxy: "{{ http_proxy| default ('') }}"
  232. https_proxy: "{{ https_proxy| default ('') }}"
  233. no_proxy: "{{ no_proxy| default ('') }}"
  234. ssl_ca_dirs: >-
  235. [
  236. {% if ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] -%}
  237. '/usr/share/ca-certificates',
  238. {% elif ansible_os_family == 'RedHat' -%}
  239. '/etc/pki/tls',
  240. '/etc/pki/ca-trust',
  241. {% elif ansible_os_family == 'Debian' -%}
  242. '/usr/share/ca-certificates',
  243. {% endif -%}
  244. ]
  245. # Vars for pointing to kubernetes api endpoints
  246. is_kube_master: "{{ inventory_hostname in groups['kube-master'] }}"
  247. kube_apiserver_count: "{{ groups['kube-master'] | length }}"
  248. kube_apiserver_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  249. kube_apiserver_access_address: "{{ access_ip | default(kube_apiserver_address) }}"
  250. first_kube_master: "{{ hostvars[groups['kube-master'][0]]['access_ip'] | default(hostvars[groups['kube-master'][0]]['ip'] | default(hostvars[groups['kube-master'][0]]['ansible_default_ipv4']['address'])) }}"
  251. loadbalancer_apiserver_localhost: "{{ loadbalancer_apiserver is not defined }}"
  252. # applied if only external loadbalancer_apiserver is defined, otherwise ignored
  253. apiserver_loadbalancer_domain_name: "lb-apiserver.kubernetes.local"
  254. kube_apiserver_endpoint: |-
  255. {% if not is_kube_master and loadbalancer_apiserver_localhost -%}
  256. https://localhost:{{ nginx_kube_apiserver_port|default(kube_apiserver_port) }}
  257. {%- elif is_kube_master -%}
  258. https://{{ kube_apiserver_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_port }}
  259. {%- else -%}
  260. {%- if loadbalancer_apiserver is defined and loadbalancer_apiserver.port is defined -%}
  261. https://{{ apiserver_loadbalancer_domain_name|default('lb-apiserver.kubernetes.local') }}:{{ loadbalancer_apiserver.port|default(kube_apiserver_port) }}
  262. {%- else -%}
  263. https://{{ first_kube_master }}:{{ kube_apiserver_port }}
  264. {%- endif -%}
  265. {%- endif %}
  266. kube_apiserver_insecure_endpoint: >-
  267. http://{{ kube_apiserver_insecure_bind_address | regex_replace('0\.0\.0\.0','127.0.0.1') }}:{{ kube_apiserver_insecure_port }}
  268. kube_apiserver_client_cert: |-
  269. {% if kubeadm_enabled -%}
  270. {{ kube_cert_dir }}/ca.crt
  271. {%- else -%}
  272. {{ kube_cert_dir }}/apiserver.pem
  273. {%- endif %}
  274. kube_apiserver_client_key: |-
  275. {% if kubeadm_enabled -%}
  276. {{ kube_cert_dir }}/ca.key
  277. {%- else -%}
  278. {{ kube_cert_dir }}/apiserver-key.pem
  279. {%- endif %}
  280. # Set to true to deploy etcd-events cluster
  281. etcd_events_cluster_enabled: false
  282. # Vars for pointing to etcd endpoints
  283. is_etcd_master: "{{ inventory_hostname in groups['etcd'] }}"
  284. etcd_address: "{{ ip | default(ansible_default_ipv4['address']) }}"
  285. etcd_access_address: "{{ access_ip | default(etcd_address) }}"
  286. etcd_events_access_address: "{{ access_ip | default(etcd_address) }}"
  287. etcd_peer_url: "https://{{ etcd_access_address }}:2380"
  288. etcd_client_url: "https://{{ etcd_access_address }}:2379"
  289. etcd_events_peer_url: "https://{{ etcd_access_address }}:2382"
  290. etcd_events_client_url: "https://{{ etcd_access_address }}:2381"
  291. etcd_access_addresses: |-
  292. {% for item in groups['etcd'] -%}
  293. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2379{% if not loop.last %},{% endif %}
  294. {%- endfor %}
  295. etcd_events_access_addresses: |-
  296. {% for item in groups['etcd'] -%}
  297. https://{{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(hostvars[item]['ansible_default_ipv4']['address'])) }}:2381{% if not loop.last %},{% endif %}
  298. {%- endfor %}
  299. # user should set etcd_member_name in inventory/mycluster/hosts.ini
  300. etcd_member_name: |-
  301. {% for host in groups['etcd'] %}
  302. {% if inventory_hostname == host %}{{ hostvars[host].etcd_member_name | default("etcd" + loop.index|string) }}{% endif %}
  303. {% endfor %}
  304. etcd_peer_addresses: |-
  305. {% for item in groups['etcd'] -%}
  306. {{ hostvars[item].etcd_member_name | default("etcd" + loop.index|string) }}=https://{{ hostvars[item].access_ip | default(hostvars[item].ip | default(hostvars[item].ansible_default_ipv4['address'])) }}:2380{% if not loop.last %},{% endif %}
  307. {%- endfor %}
  308. etcd_events_peer_addresses: |-
  309. {% for item in groups['etcd'] -%}
  310. {{ hostvars[item].etcd_member_name | default("etcd" + loop.index|string) }}-events=https://{{ hostvars[item].access_ip | default(hostvars[item].ip | default(hostvars[item].ansible_default_ipv4['address'])) }}:2382{% if not loop.last %},{% endif %}
  311. {%- endfor %}
  312. podsecuritypolicy_enabled: false
  313. etcd_heartbeat_interval: "250"
  314. etcd_election_timeout: "5000"
  315. etcd_snapshot_count: "10000"