mirror of
https://github.com/PyratLabs/ansible-role-k3s
synced 2024-12-12 05:50:18 +01:00
Merge branch 'v1_release' into main
This commit is contained in:
commit
cc59955b28
7 changed files with 17 additions and 17 deletions
|
@ -30,16 +30,16 @@ env:
|
|||
- MOLECULE_DISTRO: geerlingguy/docker-fedora31-ansible:latest
|
||||
MOLECULE_PLAYBOOK: playbook-no-deploy.yml
|
||||
|
||||
# Test multiple masters in control plane with PostgreSQL
|
||||
# Test multiple controllers in control plane with PostgreSQL
|
||||
- MOLECULE_DISTRO: geerlingguy/docker-fedora29-ansible:latest
|
||||
MOLECULE_SCENARIO: highavailability
|
||||
|
||||
# Test multiple masters with auto deploying manifests
|
||||
# Test multiple controllers with auto deploying manifests
|
||||
- MOLECULE_DISTRO: geerlingguy/docker-fedora30-ansible:latest
|
||||
MOLECULE_SCENARIO: highavailability
|
||||
MOLECULE_PLAYBOOK: playbook-auto-deploying-manifests.yml
|
||||
|
||||
# Test multiple masters in control plane with Etcd
|
||||
# Test multiple controllers in control plane with Etcd
|
||||
- MOLECULE_DISTRO: geerlingguy/docker-centos8-ansible:latest
|
||||
MOLECULE_SCENARIO: highavailability
|
||||
MOLECULE_PLAYBOOK: playbook-etcd.yml
|
||||
|
|
12
README.md
12
README.md
|
@ -3,7 +3,7 @@
|
|||
Ansible role for installing [Rancher Labs k3s](https://k3s.io/) ("Lightweight
|
||||
Kubernetes") as either a standalone server or cluster.
|
||||
|
||||
[![Build Status](https://www.travis-ci.org/PyratLabs/ansible-role-k3s.svg?branch=master)](https://www.travis-ci.org/PyratLabs/ansible-role-k3s)
|
||||
[![Build Status](https://www.travis-ci.org/PyratLabs/ansible-role-k3s.svg?branch=main)](https://www.travis-ci.org/PyratLabs/ansible-role-k3s)
|
||||
|
||||
## Requirements
|
||||
|
||||
|
@ -241,7 +241,7 @@ Below are variables that are set against specific hosts in your inventory.
|
|||
|
||||
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, this role will automatically delegate
|
||||
the first play host as a control node (master). This is not suitable for use in
|
||||
the first play host as a primary control node. This is not suitable for use in
|
||||
a Production workload.
|
||||
|
||||
If multiple hosts have `k3s_control_node` set to true, you must also set
|
||||
|
@ -253,7 +253,7 @@ 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
|
||||
It is also possible, though not supported, to run a single K3s control node 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`.
|
||||
|
||||
|
@ -270,7 +270,7 @@ to `true`.
|
|||
|
||||
If you are running k3s on systems with multiple network interfaces, it is
|
||||
necessary to have the flannel interface on a network interface that is routable
|
||||
to the master node(s).
|
||||
to the control plane node(s).
|
||||
|
||||
#### Notes about `_args`, `_labels` and `_taints` variables
|
||||
|
||||
|
@ -285,7 +285,7 @@ Affected variables:
|
|||
|
||||
These parameters allow for assigning additional args to K3s during runtime.
|
||||
For instance, to use the Azure Cloud Controller, assign the below to
|
||||
the master node's configuration in your host file.
|
||||
the control node's configuration in your host file.
|
||||
|
||||
**YAML**:
|
||||
|
||||
|
@ -327,7 +327,7 @@ No dependencies on other roles.
|
|||
|
||||
## Example Playbooks
|
||||
|
||||
Example playbook, single master node running v0.10.2:
|
||||
Example playbook, single control node running v0.10.2:
|
||||
|
||||
```yaml
|
||||
- hosts: k3s_nodes
|
||||
|
|
|
@ -29,7 +29,7 @@ galaxy_info:
|
|||
# Galaxy will use this branch. During import Galaxy will access files on
|
||||
# this branch. If Travis integration is configured, only notifications for this
|
||||
# branch will be accepted. Otherwise, in all cases, the repo's default branch
|
||||
# (usually master) will be used.
|
||||
# (usually main) will be used.
|
||||
# github_branch:
|
||||
|
||||
#
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
- reload systemd
|
||||
- restart k3s
|
||||
|
||||
- name: Ensure secondary masters are started
|
||||
- name: Ensure secondary controllers are started
|
||||
service:
|
||||
name: k3s
|
||||
state: started
|
||||
enabled: true
|
||||
register: ensure_secondary_masters_started
|
||||
until: ensure_secondary_masters_started is succeeded
|
||||
register: ensure_secondary_controllers_started
|
||||
until: ensure_secondary_controllers_started is succeeded
|
||||
retries: "{{ play_hosts | length }}"
|
||||
delay: 5
|
||||
when: k3s_control_node and not k3s_primary_control_node
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
k3s_control_node: "{{ 'false' if k3s_build_cluster else 'true' }}"
|
||||
when: k3s_control_node is not defined
|
||||
|
||||
- name: Ensure k3s master control node fact is set
|
||||
- name: Ensure k3s control node fact is set
|
||||
set_fact:
|
||||
k3s_primary_control_node: "{{ 'false' if k3s_build_cluster else 'true' }}"
|
||||
when: k3s_primary_control_node is not defined
|
||||
|
@ -19,7 +19,7 @@
|
|||
when: true not in (hostvars | json_query('*.k3s_control_node'))
|
||||
and k3s_build_cluster is defined and k3s_build_cluster
|
||||
|
||||
- name: Ensure a count of control masters is generated
|
||||
- name: Ensure a count of control nodes is generated
|
||||
set_fact:
|
||||
k3s_controller_count: "{{ k3s_controller_count + [ item ] }}"
|
||||
when: hostvars[item].k3s_control_node is defined
|
||||
|
@ -52,7 +52,7 @@
|
|||
check_mode: false
|
||||
when: hostvars[item].k3s_control_node is defined
|
||||
|
||||
- name: Delegate a master control plane node
|
||||
- name: Delegate a primary control plane node
|
||||
block:
|
||||
- name: Lookup control node from file
|
||||
command: "grep '{{ 'P_True' if (k3s_controller_count | length > 1) else 'C_True' }}' /tmp/inventory.txt"
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
when: k3s_non_root is defined
|
||||
and k3s_non_root
|
||||
and k3s_use_unsupported_config
|
||||
- import_tasks: check-master-count.yml
|
||||
- import_tasks: check-controller-count.yml
|
||||
when: k3s_build_cluster is defined and k3s_build_cluster
|
||||
|
|
Loading…
Reference in a new issue