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.

135 lines
5.4 KiB

  1. Ansible variables
  2. ===============
  3. Inventory
  4. -------------
  5. The inventory is composed of 3 groups:
  6. * **kube-node** : list of kubernetes nodes where the pods will run.
  7. * **kube-master** : list of servers where kubernetes master components (apiserver, scheduler, controller) will run.
  8. Note: if you want the server to act both as master and node the server must be defined on both groups _kube-master_ and _kube-node_
  9. * **etcd**: list of server to compose the etcd server. you should have at least 3 servers for failover purposes.
  10. Below is a complete inventory example:
  11. ```
  12. ## Configure 'ip' variable to bind kubernetes services on a
  13. ## different ip than the default iface
  14. node1 ansible_ssh_host=95.54.0.12 # ip=10.3.0.1
  15. node2 ansible_ssh_host=95.54.0.13 # ip=10.3.0.2
  16. node3 ansible_ssh_host=95.54.0.14 # ip=10.3.0.3
  17. node4 ansible_ssh_host=95.54.0.15 # ip=10.3.0.4
  18. node5 ansible_ssh_host=95.54.0.16 # ip=10.3.0.5
  19. node6 ansible_ssh_host=95.54.0.17 # ip=10.3.0.6
  20. [kube-master]
  21. node1
  22. node2
  23. [etcd]
  24. node1
  25. node2
  26. node3
  27. [kube-node]
  28. node2
  29. node3
  30. node4
  31. node5
  32. node6
  33. [k8s-cluster:children]
  34. kube-node
  35. kube-master
  36. etcd
  37. ```
  38. Group vars
  39. --------------
  40. The main variables to change are located in the directory ```inventory/group_vars/all.yml```.
  41. Ansible tags
  42. ------------
  43. The following tags are defined in playbooks:
  44. | Tag name | Used for
  45. |--------------------------|---------
  46. | apps | K8s apps definitions
  47. | azure | Cloud-provider Azure
  48. | bastion | Setup ssh config for bastion
  49. | bootstrap-os | Anything related to host OS configuration
  50. | calico | Network plugin Calico
  51. | canal | Network plugin Canal
  52. | cloud-provider | Cloud-provider related tasks
  53. | dnsmasq | Configuring DNS stack for hosts and K8s apps
  54. | docker | Configuring docker for hosts
  55. | download | Fetching container images to a delegate host
  56. | etcd | Configuring etcd cluster
  57. | etcd-pre-upgrade | Upgrading etcd cluster
  58. | etcd-secrets | Configuring etcd certs/keys
  59. | etchosts | Configuring /etc/hosts entries for hosts
  60. | facts | Gathering facts and misc check results
  61. | flannel | Network plugin flannel
  62. | gce | Cloud-provider GCP
  63. | hyperkube | Manipulations with K8s hyperkube image
  64. | k8s-pre-upgrade | Upgrading K8s cluster
  65. | k8s-secrets | Configuring K8s certs/keys
  66. | kpm | Installing K8s apps definitions with KPM
  67. | kube-apiserver | Configuring self-hosted kube-apiserver
  68. | kube-controller-manager | Configuring self-hosted kube-controller-manager
  69. | kubectl | Installing kubectl and bash completion
  70. | kubelet | Configuring kubelet service
  71. | kube-proxy | Configuring self-hosted kube-proxy
  72. | kube-scheduler | Configuring self-hosted kube-scheduler
  73. | localhost | Special steps for the localhost (ansible runner)
  74. | master | Configuring K8s master node role
  75. | netchecker | Installing netchecker K8s app
  76. | network | Configuring networking plugins for K8s
  77. | nginx | Configuring LB for kube-apiserver instances
  78. | node | Configuring K8s minion (compute) node role
  79. | openstack | Cloud-provider OpenStack
  80. | preinstall | Preliminary configuration steps
  81. | resolvconf | Configuring /etc/resolv.conf for hosts/apps
  82. | upgrade | Upgrading, f.e. container images/binaries
  83. | upload | Distributing images/binaries across hosts
  84. | weave | Network plugin Weave
  85. Note: Use the ``bash scripts/gen_tags.sh`` command to generate a list of all
  86. tags found in the codebase. New tags will be listed with the empty "Used for"
  87. field.
  88. Example commands
  89. ----------------
  90. Example command to filter and apply only DNS configuration tasks and skip
  91. everything else related to host OS configuration and downloading images of containers:
  92. ```
  93. ansible-playbook -i inventory/inventory.ini cluster.yml --tags preinstall,dnsmasq,facts --skip-tags=download,bootstrap-os
  94. ```
  95. And this play only removes the K8s cluster DNS resolver IP from hosts' /etc/resolv.conf files:
  96. ```
  97. ansible-playbook -i inventory/inventory.ini -e dns_server='' cluster.yml --tags resolvconf
  98. ```
  99. And this prepares all container images localy (at the ansible runner node) without installing
  100. or upgrading related stuff or trying to upload container to K8s cluster nodes:
  101. ```
  102. ansible-playbook -i inventory/inventory.ini cluster.yaml \
  103. -e download_run_once=true -e download_localhost=true \
  104. --tags download --skip-tags upload,upgrade
  105. ```
  106. Note: use `--tags` and `--skip-tags` wise and only if you're 100% sure what you're doing.
  107. Bastion host
  108. --------------
  109. If you prefer to not make your nodes publicly accessible (nodes with private IPs only),
  110. you can use a so called *bastion* host to connect to your nodes. To specify and use a bastion,
  111. simply add a line to your inventory, where you have to replace x.x.x.x with the public IP of the
  112. bastion host.
  113. ```
  114. bastion ansible_ssh_host=x.x.x.x
  115. ```
  116. For more information about Ansible and bastion hosts, read
  117. [Running Ansible Through an SSH Bastion Host](http://blog.scottlowe.org/2015/12/24/running-ansible-through-ssh-bastion-host/)