Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add k0s support #1123

Merged
merged 29 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ae2718a
ignore idea
brunnels Jan 8, 2024
20764e9
Initial work on support for k0s
brunnels Jan 8, 2024
61d4078
* Changed config param to bootstrap_distribution
brunnels Jan 8, 2024
9cf455d
* Switched to single storage path for openebs
brunnels Jan 9, 2024
1d984ba
* added the storageclass name to be declarative
brunnels Jan 9, 2024
3600011
* added newline
brunnels Jan 9, 2024
86ff24c
* fixed spacing in K0sTasks
brunnels Jan 9, 2024
3bb45e1
* updated configure task to use venv
brunnels Jan 10, 2024
7ce2910
* tweaked configure task cmd
brunnels Jan 10, 2024
f40699b
* tweaked k0s task cmd
brunnels Jan 11, 2024
384d074
* fixed whitespace
brunnels Jan 11, 2024
2f31c7a
add k0sctl to brew tasks
onedr0p Jan 11, 2024
9915a21
Update bootstrap/vars/config.sample.yaml
onedr0p Jan 11, 2024
394a261
Update bootstrap/vars/config.sample.yaml
onedr0p Jan 11, 2024
3f98769
Update k0s-config.yaml.j2
onedr0p Jan 11, 2024
ed9aad9
Update config.sample.yaml
onedr0p Jan 11, 2024
efd3f80
controllerManager and scheduler bind to `0.0.0.0` for metrics
onedr0p Jan 11, 2024
1598f73
Update custom-cilium-helmchart.yaml.j2.j2
onedr0p Jan 11, 2024
e9c0eec
Update helmvalues.yaml.j2
onedr0p Jan 11, 2024
cacc851
Update bootstrap/tasks/addons/main.yaml
onedr0p Jan 11, 2024
3252c39
first pass at readme updates
onedr0p Jan 11, 2024
d6ded50
update placement of k0sconfig options
onedr0p Jan 11, 2024
ce13bd5
disable telemetry on k0sctl too
onedr0p Jan 11, 2024
5a7808d
disable k0s telemetry in env too
onedr0p Jan 11, 2024
43eca2c
update: jinja spacing in k0sconfig
onedr0p Jan 11, 2024
f2bc783
fix: ensure bootstrap_local_storage_path is delete on nuke
onedr0p Jan 11, 2024
178f2fa
fix: update renovate regex for k3s/k0s
onedr0p Jan 11, 2024
91455ce
fix: update nuke playbook and only include k3s task when k3s
onedr0p Jan 11, 2024
ef99521
fix: update nuke playbook and only include k3s task when k3s and incl…
onedr0p Jan 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ tasks:
desc: Configure repository from Ansible vars
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
dir: "{{.BOOTSTRAP_DIR}}"
cmd: ansible-playbook configure.yaml
cmds:
- ../.venv/bin/ansible-playbook configure.yaml
brunnels marked this conversation as resolved.
Show resolved Hide resolved
env:
ANSIBLE_DISPLAY_SKIPPED_HOSTS: "false"
6 changes: 3 additions & 3 deletions bootstrap/configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
ansible.builtin.set_fact:
repository_path: "{{ repository.stdout }}"

- name: Override kube-vip address when there is a single master node and no address is defined
when: bootstrap_nodes.master | length == 1 and not bootstrap_kube_vip_addr
- name: Override kubeapi address when there is a single master node and no address is defined
when: bootstrap_nodes.master | length == 1 and not bootstrap_kubeapi_addr
ansible.builtin.set_fact:
bootstrap_kube_vip_enabled: false
bootstrap_kube_vip_addr: "{{ bootstrap_nodes.master[0].address }}"
bootstrap_kubeapi_addr: "{{ bootstrap_nodes.master[0].address }}"

- name: Verify configuration
ansible.builtin.include_tasks: tasks/validation/main.yaml
Expand Down
22 changes: 11 additions & 11 deletions bootstrap/tasks/validation/net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@
success_msg: external ingress address {{ bootstrap_external_ingress_addr }} is within {{ bootstrap_node_cidr }}.
fail_msg: external ingress address {{ bootstrap_external_ingress_addr }} is not within {{ bootstrap_node_cidr }}.

- name: Verify kube-vip
- name: Verify kubeapi address
ansible.builtin.assert:
that: bootstrap_kube_vip_addr is ansible.utils.ipv4
success_msg: kube-vip address {{ bootstrap_kube_vip_addr }} is valid.
fail_msg: kube-vip address {{ bootstrap_kube_vip_addr }} is invalid.
that: bootstrap_kubeapi_addr is ansible.utils.ipv4
success_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is valid.
fail_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is invalid.

- name: Verify kube-vip in node CIDR
- name: Verify kubeapi address in node CIDR
ansible.builtin.assert:
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_kube_vip_addr)
success_msg: kube-vip address {{ bootstrap_kube_vip_addr }} is within {{ bootstrap_node_cidr }}.
fail_msg: kube-vip address {{ bootstrap_kube_vip_addr }} is not within {{ bootstrap_node_cidr }}.
that: bootstrap_node_cidr | ansible.utils.network_in_usable(bootstrap_kubeapi_addr)
success_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is within {{ bootstrap_node_cidr }}.
fail_msg: kubeapi address {{ bootstrap_kubeapi_addr }} is not within {{ bootstrap_node_cidr }}.

- name: Verify all IP addresses are unique
ansible.builtin.assert:
Expand All @@ -117,7 +117,7 @@
bootstrap_k8s_gateway_addr,
bootstrap_external_ingress_addr,
bootstrap_internal_ingress_addr,
bootstrap_kube_vip_addr
bootstrap_kubeapi_addr
] | unique | length == 4
success_msg: All IP addresses are unique.
fail_msg: All IP addresses are not unique.
Expand All @@ -133,10 +133,10 @@
loop_control:
label: "{{ item.address }}"

- name: Verify nodes are not the same IPs as k8s_gateway, ingress external/internal or kube-vip
- name: Verify nodes are not the same IPs as k8s_gateway, ingress external/internal or kubeapi address
when: bootstrap_kube_vip_enabled | default(true)
ansible.builtin.assert:
that: item.address not in (bootstrap_k8s_gateway_addr, bootstrap_external_ingress_addr, bootstrap_internal_ingress_addr, bootstrap_kube_vip_addr)
that: item.address not in (bootstrap_k8s_gateway_addr, bootstrap_external_ingress_addr, bootstrap_internal_ingress_addr, bootstrap_kubeapi_addr)
success_msg: Node address {{ item.address }} is different than k8s_gateway, ingress-nginx or kube-vip.
fail_msg: Node address {{ item.address }} is not different than k8s_gateway, ingress-nginx or kube-vip.
quiet: true
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/tasks/validation/vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- bootstrap_internal_ingress_addr
- bootstrap_ipv6_enabled
- bootstrap_k8s_gateway_addr
- bootstrap_kube_vip_addr
- bootstrap_kubeapi_addr
- bootstrap_local_storage_path
- bootstrap_node_cidr
- bootstrap_service_cidr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ k3s_etcd_datastore: true
{% else %}
k3s_etcd_datastore: false
{% endif %}
k3s_registration_address: "{% raw %}{{ kube_vip_addr }}{% endraw %}"
k3s_registration_address: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
# /var/lib/rancher/k3s/server/manifests
k3s_server_manifests_templates:
- custom-cilium-helmchart.yaml.j2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
timezone: "{{ bootstrap_timezone }}"
github_username: "{{ bootstrap_github_username }}"
coredns_addr: "{{ bootstrap_service_cidr.split(',')[0] | ansible.utils.nthhost(10) }}"
kube_vip_addr: "{{ bootstrap_kube_vip_addr }}"
kubeapi_addr: "{{ bootstrap_kubeapi_addr }}"
cluster_cidr: "{{ bootstrap_cluster_cidr.split(',')[0] }}"
service_cidr: "{{ bootstrap_service_cidr.split(',')[0] }}"
node_cidr: "{{ bootstrap_node_cidr }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ k3s_server:
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
{% endif %}
tls-san:
- "{% raw %}{{ kube_vip_addr }}{% endraw %}"
- "{% raw %}{{ kubeapi_addr }}{% endraw %}"
docker: false
flannel-backend: "none" # This needs to be in quotes
disable:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
ipv6:
enabled: true
{% endif %}
k8sServiceHost: "{% raw %}{{ kube_vip_addr }}{% endraw %}"
k8sServiceHost: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
k8sServicePort: 6443
kubeProxyReplacement: true
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
args: ["manager"]
env:
- name: address
value: "{% raw %}{{ kube_vip_addr }}{% endraw %}"
value: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
- name: vip_arp
value: "true"
- name: lb_enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ data:
ipv6:
enabled: true
{% endif %}
k8sServiceHost: "${KUBE_VIP_ADDR}"
k8sServiceHost: "${KUBEAPI_ADDR}"
k8sServicePort: 6443
kubeProxyReplacement: true
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
data:
TIMEZONE: "{{ bootstrap_timezone }}"
COREDNS_ADDR: "{{ bootstrap_service_cidr.split(',')[0] | ansible.utils.nthhost(10) }}"
KUBE_VIP_ADDR: "{{ bootstrap_kube_vip_addr }}"
KUBEAPI_ADDR: "{{ bootstrap_kubeapi_addr }}"
CLUSTER_CIDR: "{{ bootstrap_cluster_cidr.split(',')[0] }}"
SERVICE_CIDR: "{{ bootstrap_service_cidr.split(',')[0] }}"
NODE_CIDR: "{{ bootstrap_node_cidr }}"
Expand Down
7 changes: 4 additions & 3 deletions bootstrap/vars/config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ bootstrap_cloudflare_tunnel_id:

# CIDR your nodes are on (e.g. 192.168.1.0/24)
bootstrap_node_cidr:
# The IP address to use with kube-vip, choose an available IP in your nodes network that is not being used
# (Optional) Leave this blank if you are deploying a single master node, this will disable kube-vip and use the master node IP instead
bootstrap_kube_vip_addr:
# The IP address of the kubeapi, choose an available IP in your nodes network that is not being used
# (Optional) Leave this blank if you are deploying a single master node, this will disable kube-vip in k3s
# or keepalived in k0s and use the master node IP instead
bootstrap_kubeapi_addr:
# The Load balancer IP for k8s_gateway, choose an available IP in your nodes network that is not being used
bootstrap_k8s_gateway_addr:
# The Load balancer IP for external ingress, choose an available IP in your nodes network that is not being used
Expand Down