move scripts back to files for ease of calling via tasks, update labels and taints, add generic agent labels, smooth out rke2 cni templates, update task labeling
This commit is contained in:
parent
18859e1700
commit
11e482ae39
@ -7,6 +7,7 @@ Ansible role for configuring k3s and rke2 kubernetes clusters
|
||||
- https://kube-vip.io/
|
||||
- https://github.com/sbstp/kubie
|
||||
- https://kubernetes.io/docs/tasks/tools/
|
||||
- https://helm.sh/
|
||||
|
||||
## Requirements
|
||||
|
||||
|
@ -33,6 +33,9 @@ k8s_helm_install_script: "{{ k8s_install_path }}/get_helm.sh"
|
||||
# apply CriticalAddonsOnly:NoExecute to control plane nodes
|
||||
k8s_taint_servers: false
|
||||
|
||||
# apply label role=agent to agent nodes
|
||||
k8s_label_agents: false
|
||||
|
||||
# shared k8s api port
|
||||
k8s_api_port: 6443
|
||||
|
||||
@ -139,8 +142,9 @@ k8s_kubelet_args:
|
||||
# canal, cilium, calico, flannel
|
||||
# k8s_cni_type: canal
|
||||
|
||||
# apply manifest overrides
|
||||
# k8s_cni_manifest_overrides: true
|
||||
# apply cni custom template
|
||||
# canal-config.yaml | cilium-config.yaml | calico-config.yaml
|
||||
# k8s_cni_custom_template: canal-config.yaml
|
||||
|
||||
# when using canal enable wg backend
|
||||
# k8s_canal_wireguard: true
|
||||
|
@ -37,12 +37,18 @@
|
||||
- k8s
|
||||
block:
|
||||
|
||||
- name: load server node taints
|
||||
- name: add generic server taint
|
||||
ansible.builtin.include_vars:
|
||||
file: "server-taint.yml"
|
||||
when:
|
||||
- k8s_taint_servers and k8s_node_type != "agent"
|
||||
|
||||
- name: add generic agent label
|
||||
ansible.builtin.include_vars:
|
||||
file: "agent-label.yml"
|
||||
when:
|
||||
- k8s_label_agents and k8s_node_type == "agent"
|
||||
|
||||
- name: increase open file limit
|
||||
ansible.posix.sysctl:
|
||||
name: fs.inotify.max_user_instances
|
||||
|
@ -7,7 +7,7 @@
|
||||
- k8s-config
|
||||
|
||||
# CANAL NM CONFIG
|
||||
- name: template nm canal config
|
||||
- name: template canal network-manager config
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ k8s_type }}/canal.conf.j2"
|
||||
dest: "{{ k8s_nm_path }}/{{ k8s_type }}-canal.conf"
|
||||
|
@ -7,13 +7,13 @@
|
||||
when:
|
||||
- k8s_node_type == "bootstrap"
|
||||
|
||||
- name: rke2 template cni manifest override
|
||||
- name: rke2 cni custom template
|
||||
ansible.builtin.template:
|
||||
src: "templates/{{ k8s_type }}/{{ k8s_cni_type | d('canal') }}-config.yaml.j2"
|
||||
dest: "{{ k8s_manifests_path }}/{{ k8s_type }}-{{ k8s_cni_type | d('canal') }}-config.yaml"
|
||||
src: "templates/{{ k8s_type }}/cni/{{ k8s_cni_custom_template }}.j2"
|
||||
dest: "{{ k8s_manifests_path }}/{{ k8s_type }}-{{ k8s_cni_custom_template }}"
|
||||
mode: 0600
|
||||
when:
|
||||
- k8s_cni_manifest_overrides is defined and k8s_cni_manifest_overrides
|
||||
- k8s_cni_custom_template is defined
|
||||
- k8s_node_type == "bootstrap"
|
||||
|
||||
- name: rke2 start bootstrap node
|
||||
|
@ -56,7 +56,7 @@ node-external-ip: {{ k8s_external_ip }}
|
||||
# initial node taints
|
||||
{% for taint in k8s_node_taints -%}
|
||||
node-taint:
|
||||
- "{{ taint.name }}={{ taint.value }}:{{ taint.effect }}"
|
||||
- "{{ taint.key }}={{ taint.value }}:{{ taint.effect }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
||||
@ -64,7 +64,7 @@ node-taint:
|
||||
# initial node labels
|
||||
{% for label in k8s_node_lables -%}
|
||||
node-label:
|
||||
- "{{ label.name }}={{ label.value }}"
|
||||
- "{{ label.key }}={{ label.value }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
||||
@ -79,7 +79,7 @@ kubelet-arg:
|
||||
|
||||
{% if k8s_additional_configs is defined %}
|
||||
{% for k8s_config in k8s_additional_configs %}
|
||||
{{ k8s_config.name }}:
|
||||
{{ k8s_config.key }}:
|
||||
- "{{ k8s_config.value }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
@ -45,7 +45,7 @@ node-external-ip: {{ k8s_external_ip }}
|
||||
# initial node taints
|
||||
{% for taint in k8s_node_taints -%}
|
||||
node-taint:
|
||||
- "{{ taint.name }}={{ taint.value }}:{{ taint.effect }}"
|
||||
- "{{ taint.key }}={{ taint.value }}:{{ taint.effect }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
||||
@ -53,7 +53,7 @@ node-taint:
|
||||
# initial node labels
|
||||
{% for label in k8s_node_lables -%}
|
||||
node-label:
|
||||
- "{{ label.name }}={{ label.value }}"
|
||||
- "{{ label.key }}={{ label.value }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
||||
@ -68,7 +68,7 @@ kubelet-arg:
|
||||
|
||||
{% if k8s_additional_configs is defined %}
|
||||
{% for k8s_config in k8s_additional_configs %}
|
||||
{{ k8s_config.name }}:
|
||||
{{ k8s_config.key }}:
|
||||
- "{{ k8s_config.value }}"
|
||||
{% endfor -%}
|
||||
{% endif %}
|
||||
|
4
vars/agent-label.yml
Normal file
4
vars/agent-label.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
k8s_node_lables:
|
||||
- key: role
|
||||
value: agent
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
k8s_node_taints:
|
||||
- name: CriticalAddonsOnly
|
||||
- key: CriticalAddonsOnly
|
||||
value: true
|
||||
effect: NoExecute
|
||||
|
Loading…
Reference in New Issue
Block a user