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.

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