Add option for unsupported single node with database backend. Issue #27

This commit is contained in:
Xan Manning 2020-05-30 15:16:20 +01:00
parent 6090071982
commit 848a5457ff
5 changed files with 16 additions and 3 deletions

View File

@ -53,6 +53,7 @@ consistency.
| `k3s_server_manifests_dir` | Path for place the `k3s_server_manifests_templates`. | `/var/lib/rancher/k3s/server/manifests` |
| `k3s_server_manifests_templates` | A list of Auto-Deploying Manifests Templates. | [] |
| `k3s_use_experimental` | Allow the use of experimental features in k3s. | `false` |
| `k3s_use_unsupported_config` | Allow the use of unsupported configurations in k3s. | `false` |
| `k3s_non_root` | Install k3s as non-root user. See notes below. | `false` |
| `k3s_control_workers` | Are control hosts also workers? | `true` |
| `k3s_cluster_cidr` | Network CIDR to use for pod IPs | 10.42.0.0/16 |
@ -133,7 +134,8 @@ To install k3s as non root you must not use `become: true`. The intention of
this variable is to run a single node development environment. At the time
of release v1.0.1, rootless is still experimental.
You must also ensure that you set `k3s_use_experimental` to `true`.
You must also ensure that you set both `k3s_use_experimental`
and `k3s_use_unsupported_config` to `true`.
Additionally `k3s_install_dir` must be writable by your user.
@ -169,7 +171,7 @@ Below are variables that are set against specific hosts in your inventory.
#### Important note about `k3s_control_node` and High Availability (HA)
By default only one host will be defined as a control node by Ansible, If you
do not set a host as a control node, the role will automatically delegate
do not set a host as a control node, this role will automatically delegate
the first play host as a control node (master). This is not suitable for use in
a Production workload.
@ -182,6 +184,10 @@ the play hosts.
See: [High Availability with an External DB](https://rancher.com/docs/k3s/latest/en/installation/ha/)
It is also possible, though not supported, to run a single K3s master with a
`k3s_datastore_endpoint` defined. As this is not a typically supported
configuration you will need to set `k3s_use_unsupported_config` to `true`.
Since K3s v1.0.0 it is possible to use DQLite as the backend database, and this
is done by setting `k3s_dqlite_datastore` to true. As this is an experimental
feature you will also need to set `k3s_use_experimental` to true.

View File

@ -29,6 +29,9 @@ k3s_server_manifests_templates: []
# Use experimental features in k3s?
k3s_use_experimental: false
# Allow for unsupported configurations in k3s?
k3s_use_unsupported_config: false
# Use a database or etcd cluster to enable HA. Examples below:
# MySQL:
# k3s_datastore_endpoint "mysql://username:password@tcp(hostname:3306)/database-name"

View File

@ -46,6 +46,7 @@
@@@
P_{{ hostvars[item].k3s_primary_control_node | default(False) }}
create: true
regexp: "^{{ item }} @@@ {{ hostvars[item].ansible_host | default(hostvars[item].ansible_fqdn) }}"
loop: "{{ play_hosts }}"
when: hostvars[item].k3s_control_node is defined

View File

@ -9,6 +9,7 @@
success_msg: "Control plane configuration is valid."
fail_msg: "Control plane configuration is invalid. Please see notes about k3s_control_node and HA in README.md."
when: k3s_controller_count | length == 1
and not k3s_use_unsupported_config
- name: Check the conditions when multiple controllers are defined
assert:

View File

@ -3,6 +3,8 @@
- import_tasks: check-variables.yml
- import_tasks: check-experimental-variables.yml
- import_tasks: check-unsupported-rootless.yml
when: k3s_non_root is defined and k3s_non_root
when: k3s_non_root is defined
and k3s_non_root
and k3s_use_unsupported_config
- import_tasks: check-master-count.yml
when: k3s_build_cluster is defined and k3s_build_cluster