Files
home-cluster/bootstrap/templates/k0s-config.yaml.j2
T
d093d0a4e1 add k0s support (#1123)
* ignore idea

* Initial work on support for k0s

* *  Changed config param to bootstrap_distribution
*  Replaced democratic-csi with openebs
*  Added notes about system-upgrade-controller being ignored with k0s
*  Removed password for nodes

* *  Switched to single storage path for openebs
*  Removed democratic-csi helm repo
*  Added missing openebs helm repo
*  Fixed template formatting
*  Made bootstrap_private_github_repo hidden/undocumented
*  Updated flux cluster config to accommodate bootstrap_private_github_repo

* *  added the storageclass name to be declarative

* *  added newline
*  set chart wait false

* *  fixed spacing in K0sTasks
*  fixed openebs path
*  properly added openebs helm repo

* *  updated configure task to use venv
*  renamed bootstrap_kube_vip_addr to bootstrap_kubeapi_addr
*  renamed bootstrap_kube_vip_addr derived variables accordingly

* *  tweaked configure task cmd
*  started work on k0s-config.yaml template

* *  tweaked k0s task cmd
*  moved coredns under addons rather than optional
*  fixed typo in coredns task
*  normalized formatting in k0s-config
*  disabled telemetry in k0s-config
*  added renovate to k0s-config
*  removed tunnel and added routing mode in k0s-config cilium chart values
*  updated docs in config example
*  fixed issue with k0s-config controller role so it didn't default to worker+controller if more than one master

* *  fixed whitespace

* add k0sctl to brew tasks

* Update bootstrap/vars/config.sample.yaml

* Update bootstrap/vars/config.sample.yaml

* Update k0s-config.yaml.j2

* Update config.sample.yaml

* controllerManager and scheduler bind to `0.0.0.0` for metrics

* Update custom-cilium-helmchart.yaml.j2.j2

* Update helmvalues.yaml.j2

* Update bootstrap/tasks/addons/main.yaml

* first pass at readme updates

* update placement of k0sconfig options

* disable telemetry on k0sctl too

* disable k0s telemetry in env too

* update: jinja spacing in k0sconfig

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: ensure bootstrap_local_storage_path is delete on nuke

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update renovate regex for k3s/k0s

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update nuke playbook and only include k3s task when k3s

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update nuke playbook and only include k3s task when k3s and include jinja comments

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
Co-authored-by: Devin Buhl <onedr0p@users.noreply.github.com>
Co-authored-by: Devin Buhl <devin@buhl.casa>
2024-01-11 15:03:36 -05:00

127 lines
4.4 KiB
YAML

#jinja2: trim_blocks: True, lstrip_blocks: True
---
apiVersion: k0sctl.k0sproject.io/v1beta1
kind: Cluster
metadata:
name: k0s-cluster
spec:
hosts:
{% for item in bootstrap_nodes.master %}
- role: {{ item.role | default('controller+worker') }}
ssh:
address: {{ item.address }}
user: {{ item.username }}
installFlags:
- --disable-components=metrics-server
{% if item.role | default('') == 'controller+worker' %}
- --no-taints
{% endif %}
{% endfor %}
{% if bootstrap_nodes.worker | default([]) | length > 0 %}
{% for item in bootstrap_nodes.worker %}
- role: worker
ssh:
address: {{ item.address }}
user: {{ item.username }}
{% endfor %}
{% endif %}
k0s:
# renovate: datasource=github-releases depName=k0sproject/k0s
version: "v1.28.4+k0s.0"
dynamicConfig: false
config:
spec:
telemetry:
enabled: false
controllerManager:
extraArgs:
# Required to monitor kube-controller-manager with kube-prometheus-stack
bind-address: "0.0.0.0"
scheduler:
extraArgs:
# Required to monitor kube-scheduler with kube-prometheus-stack
bind-address: "0.0.0.0"
api:
sans:
- {{ bootstrap_kubeapi_addr }}
{% if bootstrap_kubeapi_hostname is defined %}
- {{ bootstrap_kubeapi_hostname }}
{% endif %}
{% for item in bootstrap_nodes.master %}
{% if item.address != bootstrap_kubeapi_addr %}
- {{ item.address }}
{% endif %}
{% if (bootstrap_kubeapi_hostname is not defined) or (item.name != bootstrap_kubeapi_hostname) %}
- {{ item.name }}
{% endif %}
{% endfor %}
extensions:
helm:
repositories:
- name: cilium
url: https://helm.cilium.io
charts:
- name: cilium
chartname: cilium/cilium
# renovate: datasource=github-releases depName=cilium/cilium
version: "1.14.5"
namespace: kube-system
values: |2
autoDirectNodeRoutes: true
bpf:
masquerade: true
bgp:
enabled: false
cluster:
name: home-cluster
id: 1
containerRuntime:
integration: containerd
socketPath: /var/run/k0s/containerd.sock
endpointRoutes:
enabled: true
hubble:
enabled: false
ipam:
mode: kubernetes
ipv4NativeRoutingCIDR: "{{ bootstrap_cluster_cidr }}"
{% if bootstrap_ipv6_enabled | default(false) %}
ipv6NativeRoutingCIDR: "{{ bootstrap_cluster_cidr_v6 }}"
ipv6:
enabled: true
{% endif %}
k8sServiceHost: "{{ bootstrap_kubeapi_addr }}"
k8sServicePort: 6443
kubeProxyReplacement: true
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
l2announcements:
{% if bootstrap_ipv6_enabled | default(false) %}
enabled: false
{% else %}
enabled: true
# https://github.com/cilium/cilium/issues/26586
leaseDuration: 120s
leaseRenewDeadline: 60s
leaseRetryPeriod: 1s
{% endif %}
loadBalancer:
algorithm: maglev
mode: {{ bootstrap_cilium_loadbalancer_mode | default('dsr', true) }}
localRedirectPolicy: true
operator:
replicas: 1
rollOutPods: true
rollOutCiliumPods: true
routingMode: native
securityContext:
privileged: true
network:
kubeProxy:
disabled: true
{% if bootstrap_nodes.master | length > 1 %}
nodeLocalLoadBalancing:
enabled: true
type: EnvoyProxy
{% endif %}
provider: custom