feat: add talos support (#1192)
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
cec32120db
commit
91d8b84f3c
33 files changed
+537
-42
No files matched your search
@@ -228,7 +228,7 @@
|
|||||||
"matchStrings": [
|
"matchStrings": [
|
||||||
// Example:
|
// Example:
|
||||||
// k3s_release_version: "v1.27.3+k3s1"
|
// k3s_release_version: "v1.27.3+k3s1"
|
||||||
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>\\S+))?\n.*?\"(?<currentValue>.*)\"\n",
|
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>\\S+))?( extractVersion=(?<extractVersion>\\S+))?\n.*?\"(?<currentValue>.*)\"\n",
|
||||||
// Example:
|
// Example:
|
||||||
// - https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml
|
// - https://github.com/rancher/system-upgrade-controller/releases/download/v0.11.0/crd.yaml
|
||||||
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>\\S+))?\n.*?-\\s(.*?)\/(?<currentValue>[^/]+)\/[^/]+\n",
|
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( versioning=(?<versioning>\\S+))?\n.*?-\\s(.*?)\/(?<currentValue>[^/]+)\/[^/]+\n",
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
ci_test: true
|
||||||
|
|
||||||
|
bootstrap_distribution: talos
|
||||||
|
bootstrap_github_username: onedr0p
|
||||||
|
bootstrap_github_repository_name: flux-cluster-template
|
||||||
|
bootstrap_github_repository_branch: main
|
||||||
|
bootstrap_age_public_key: $BOOTSTRAP_AGE_PUBLIC_KEY
|
||||||
|
bootstrap_timezone: Etc/UTC
|
||||||
|
bootstrap_acme_email: fake
|
||||||
|
bootstrap_acme_production_enabled: false
|
||||||
|
bootstrap_flux_github_webhook_token: fake
|
||||||
|
bootstrap_cloudflare_domain: fake
|
||||||
|
bootstrap_cloudflare_token: fake
|
||||||
|
bootstrap_cloudflare_account_tag: fake
|
||||||
|
bootstrap_cloudflare_tunnel_secret: fake
|
||||||
|
bootstrap_cloudflare_tunnel_id: fake
|
||||||
|
bootstrap_node_cidr: 10.10.10.0/24
|
||||||
|
bootstrap_kube_api_addr: 10.10.10.254
|
||||||
|
bootstrap_kube_api_hostname: fake
|
||||||
|
bootstrap_k8s_gateway_addr: 10.10.10.253
|
||||||
|
bootstrap_external_ingress_addr: 10.10.10.252
|
||||||
|
bootstrap_internal_ingress_addr: 10.10.10.251
|
||||||
|
bootstrap_cilium_loadbalancer_mode: dsr
|
||||||
|
bootstrap_ipv6_enabled: false
|
||||||
|
bootstrap_cluster_cidr: 10.42.0.0/16
|
||||||
|
bootstrap_service_cidr: 10.43.0.0/16
|
||||||
|
bootstrap_local_storage_path: /var/openebs/local
|
||||||
|
bootstrap_nodes:
|
||||||
|
master:
|
||||||
|
- name: k8s-0
|
||||||
|
address: 10.10.10.100
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
|
- name: k8s-1
|
||||||
|
address: 10.10.10.101
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
|
- name: k8s-2
|
||||||
|
address: 10.10.10.102
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
|
worker:
|
||||||
|
- name: k8s-3
|
||||||
|
address: 10.10.10.103
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
|
- name: k8s-4
|
||||||
|
address: 10.10.10.104
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
|
- name: k8s-5
|
||||||
|
address: 10.10.10.105
|
||||||
|
username: fake
|
||||||
|
diskSerial: fake
|
||||||
@@ -41,6 +41,7 @@ jobs:
|
|||||||
- k3s-ipv4
|
- k3s-ipv4
|
||||||
- k3s-ipv6
|
- k3s-ipv6
|
||||||
- k3s-no-kube-vip
|
- k3s-no-kube-vip
|
||||||
|
- talos
|
||||||
addon-files: ["addons"]
|
addon-files: ["addons"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -112,6 +113,13 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: task configure --yes
|
run: task configure --yes
|
||||||
|
|
||||||
|
- name: Run Talos configure
|
||||||
|
if: ${{ steps.config-env.outputs.distribution == 'talos' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
task talos:gensecret --yes
|
||||||
|
task talos:genconfig
|
||||||
|
|
||||||
- name: Run Ansible lint
|
- name: Run Ansible lint
|
||||||
if: ${{ steps.config-env.outputs.distribution == 'k3s' || steps.config-env.outputs.distribution == 'k0s' }}
|
if: ${{ steps.config-env.outputs.distribution == 'k3s' || steps.config-env.outputs.distribution == 'k0s' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
TALOS_DIR: "{{.ROOT_DIR}}/kubernetes/talos"
|
||||||
|
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talhelper.sops.yaml"
|
||||||
|
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
gensecret:
|
||||||
|
desc: Generate talos secret
|
||||||
|
prompt: This will overwrite the existing secret... continue?
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmds:
|
||||||
|
- talhelper gensecret > {{.TALHELPER_SECRET_FILE}}
|
||||||
|
- task: :sops:.encrypt-file
|
||||||
|
vars:
|
||||||
|
file: "{{.TALHELPER_SECRET_FILE}}"
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Missing talhelper config file", sh: "test -f {{.TALHELPER_CONFIG_FILE}}" }
|
||||||
|
|
||||||
|
genconfig:
|
||||||
|
desc: Generate talos config
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmd: talhelper genconfig
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Missing talhelper config file", sh: "test -f {{.TALHELPER_CONFIG_FILE}}" }
|
||||||
|
|
||||||
|
apply-config:
|
||||||
|
desc: Apply talos config on a node
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmd: talhelper gencommand apply --extra-flags=--insecure | bash
|
||||||
|
|
||||||
|
bootstrap:
|
||||||
|
desc: Bootstrap the talos cluster
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmd: talhelper gencommand bootstrap | bash
|
||||||
|
|
||||||
|
kubeconfig:
|
||||||
|
desc: Generate talos kubeconfig
|
||||||
|
prompt: This will overwrite the existing kubeconfig... continue?
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmd: talosctl kubeconfig {{.ROOT_DIR}} --force
|
||||||
|
|
||||||
|
apply-extras:
|
||||||
|
desc: Apply extras
|
||||||
|
dir: "{{.TALOS_DIR}}"
|
||||||
|
cmds:
|
||||||
|
- kubectl --kubeconfig {{.KUBECONFIG_FILE}} kustomize --enable-helm ./cni | kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename -
|
||||||
|
- kubectl --kubeconfig {{.KUBECONFIG_FILE}} kustomize --enable-helm ./kubelet-csr-approver | kubectl apply --kubeconfig {{.KUBECONFIG_FILE}} --server-side --filename -
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Missing kubeconfig", sh: "test -f {{.KUBECONFIG_FILE}}" }
|
||||||
|
|
||||||
|
upgrade-talos:
|
||||||
|
desc: Upgrade talos on a node
|
||||||
|
cmd: talosctl --nodes {{.node}} upgrade --image {{.image}} --preserve=true --reboot-mode=powercycle
|
||||||
|
vars:
|
||||||
|
image: '{{ or .image (fail "Argument (image) is required") }}'
|
||||||
|
node: '{{ or .node (fail "Argument (node) is required") }}'
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" }
|
||||||
|
|
||||||
|
upgrade-k8s:
|
||||||
|
desc: Upgrade k8s on a node
|
||||||
|
cmd: talosctl --nodes {{.node}} upgrade-k8s --to {{.to}}
|
||||||
|
vars:
|
||||||
|
node: '{{ or .node (fail "Argument (node) is required") }}'
|
||||||
|
to: '{{ or .to (fail "Argument (to) is required") }}'
|
||||||
|
preconditions:
|
||||||
|
- { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" }
|
||||||
@@ -14,3 +14,4 @@ moreutils
|
|||||||
sops
|
sops
|
||||||
stern-bin
|
stern-bin
|
||||||
talhelper-bin
|
talhelper-bin
|
||||||
|
talosctl
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
tap "fluxcd/tap"
|
tap "fluxcd/tap"
|
||||||
tap "go-task/tap"
|
tap "go-task/tap"
|
||||||
tap "k0sproject/tap"
|
tap "k0sproject/tap"
|
||||||
|
tap "siderolabs/talos"
|
||||||
brew "age"
|
brew "age"
|
||||||
brew "cloudflared"
|
brew "cloudflared"
|
||||||
brew "direnv"
|
brew "direnv"
|
||||||
@@ -16,4 +17,5 @@ brew "moreutils"
|
|||||||
brew "sops"
|
brew "sops"
|
||||||
brew "stern"
|
brew "stern"
|
||||||
brew "talhelper"
|
brew "talhelper"
|
||||||
|
brew "talosctl"
|
||||||
brew "yq"
|
brew "yq"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Deploy a Kubernetes cluster backed by Flux
|
# Deploy a Kubernetes cluster backed by Flux
|
||||||
|
|
||||||
Welcome to my highly opinionated template for deploying a single Kubernetes ([k3s](https://k3s.io) or [k0s](https://github.com/k0sproject/k0s)) cluster with [Ansible](https://www.ansible.com) and using [Flux](https://toolkit.fluxcd.io) to manage its state.
|
Welcome to my opinionated and extendable template for deploying a single Kubernetes cluster with [k0s](https://github.com/k0sproject/k0s), [k3s](https://k3s.io) or [Talos](https://github.com/siderolabs/talos) backed by [Flux](https://fluxcd.io/flux/) to manage its state.
|
||||||
|
|
||||||
## 👋 Introduction
|
## 👋 Introduction
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ includes:
|
|||||||
repository:
|
repository:
|
||||||
aliases: ["repo"]
|
aliases: ["repo"]
|
||||||
taskfile: .taskfiles/Repository/Taskfile.yaml
|
taskfile: .taskfiles/Repository/Taskfile.yaml
|
||||||
|
talos: .taskfiles/Talos/Taskfile.yaml
|
||||||
sops: .taskfiles/Sops/Taskfile.yaml
|
sops: .taskfiles/Sops/Taskfile.yaml
|
||||||
workstation: .taskfiles/Workstation/Taskfile.yaml
|
workstation: .taskfiles/Workstation/Taskfile.yaml
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Check if required CLI tools are present
|
- name: Check if required CLI tools are present
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: command -v {{ item }} >/dev/null 2>&1
|
||||||
command -v {{ item }} >/dev/null 2>&1
|
|
||||||
loop: ["age", "cloudflared", "flux", "sops", "jq", "kubeconform", "kustomize"]
|
loop: ["age", "cloudflared", "flux", "sops", "jq", "kubeconform", "kustomize"]
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: false
|
check_mode: false
|
||||||
@@ -10,10 +9,18 @@
|
|||||||
|
|
||||||
- name: Check if required CLI tools are present for k0s
|
- name: Check if required CLI tools are present for k0s
|
||||||
when: bootstrap_distribution == "k0s"
|
when: bootstrap_distribution == "k0s"
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: command -v {{ item }} >/dev/null 2>&1
|
||||||
command -v {{ item }} >/dev/null 2>&1
|
|
||||||
loop: ["k0sctl"]
|
loop: ["k0sctl"]
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: false
|
check_mode: false
|
||||||
register: result
|
register: result
|
||||||
failed_when: result.rc != 0 and result.rc != 127
|
failed_when: result.rc != 0 and result.rc != 127
|
||||||
|
|
||||||
|
- name: Check if required CLI tools are present for talos
|
||||||
|
when: bootstrap_distribution == "talos"
|
||||||
|
ansible.builtin.shell: command -v {{ item }} >/dev/null 2>&1
|
||||||
|
loop: ["talhelper", "talosctl"]
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
register: result
|
||||||
|
failed_when: result.rc != 0 and result.rc != 127
|
||||||
@@ -1,11 +1,4 @@
|
|||||||
---
|
---
|
||||||
- name: Set reachable address
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
current_address: "{{ item.external_address | default(item.address) }}"
|
|
||||||
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.address }}"
|
|
||||||
|
|
||||||
- name: Check if master node count is odd
|
- name: Check if master node count is odd
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
@@ -161,7 +154,6 @@
|
|||||||
fail_msg: Node address {{ item.address }} is not within {{ bootstrap_node_cidr }}.
|
fail_msg: Node address {{ item.address }} is not within {{ bootstrap_node_cidr }}.
|
||||||
quiet: true
|
quiet: true
|
||||||
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
||||||
when: item.external_address is not defined
|
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.address }}"
|
label: "{{ item.address }}"
|
||||||
|
|
||||||
@@ -193,14 +185,24 @@
|
|||||||
fail_msg: All node names are not unique.
|
fail_msg: All node names are not unique.
|
||||||
quiet: true
|
quiet: true
|
||||||
|
|
||||||
- name: Check if nodes SSH ports are reachable
|
- name: Check if SSH ports are reachable
|
||||||
when: not ci_test | default(false)
|
when: (not ci_test | default(false)) and (not bootstrap_distribution == "talos")
|
||||||
ansible.builtin.wait_for:
|
ansible.builtin.wait_for:
|
||||||
host: "{{ current_address }}"
|
host: "{{ item.address }}"
|
||||||
port: 22
|
port: 22
|
||||||
search_regex: OpenSSH
|
|
||||||
timeout: 10
|
timeout: 10
|
||||||
connection: local
|
connection: local
|
||||||
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ current_address }}"
|
label: "{{ item.address }}"
|
||||||
|
|
||||||
|
- name: Check if Talos ports are reachable
|
||||||
|
when: (not ci_test | default(false)) and (bootstrap_distribution == "talos")
|
||||||
|
ansible.builtin.wait_for:
|
||||||
|
host: "{{ item.address }}"
|
||||||
|
port: 50000
|
||||||
|
timeout: 10
|
||||||
|
connection: local
|
||||||
|
loop: "{{ bootstrap_nodes.master + bootstrap_nodes.worker | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.address }}"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
- name: Check if bootstrap distribution is valid
|
- name: Check if bootstrap distribution is valid
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: bootstrap_distribution in ['k0s', 'k3s']
|
that: bootstrap_distribution in ['k0s', 'k3s', 'talos']
|
||||||
success_msg: Distribution {{ bootstrap_distribution }} is valid
|
success_msg: Distribution {{ bootstrap_distribution }} is valid
|
||||||
fail_msg: Distribution {{ bootstrap_distribution }} is not valid
|
fail_msg: Distribution {{ bootstrap_distribution }} is not valid
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
---
|
---
|
||||||
creation_rules:
|
creation_rules:
|
||||||
|
- # IMPORTANT: This rule MUST be above the others
|
||||||
|
path_regex: talos/.*\.sops\.ya?ml
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- "#{ bootstrap_age_public_key }#"
|
||||||
- path_regex: kubernetes/.*\.sops\.ya?ml
|
- path_regex: kubernetes/.*\.sops\.ya?ml
|
||||||
encrypted_regex: "^(data|stringData)$"
|
encrypted_regex: "^(data|stringData)$"
|
||||||
key_groups:
|
key_groups:
|
||||||
|
|||||||
@@ -7,11 +7,7 @@ kubernetes:
|
|||||||
#% for item in bootstrap_nodes.master %#
|
#% for item in bootstrap_nodes.master %#
|
||||||
"#{ item.name }#":
|
"#{ item.name }#":
|
||||||
ansible_user: "#{ item.username }#"
|
ansible_user: "#{ item.username }#"
|
||||||
#% if item.external_address is defined %#
|
|
||||||
ansible_host: "#{ item.external_address }#"
|
|
||||||
#% else %#
|
|
||||||
ansible_host: "#{ item.address }#"
|
ansible_host: "#{ item.address }#"
|
||||||
#% endif %#
|
|
||||||
#% endfor %#
|
#% endfor %#
|
||||||
#% if bootstrap_nodes.worker | default([]) | length > 0 %#
|
#% if bootstrap_nodes.worker | default([]) | length > 0 %#
|
||||||
worker:
|
worker:
|
||||||
@@ -19,11 +15,7 @@ kubernetes:
|
|||||||
#% for item in bootstrap_nodes.worker %#
|
#% for item in bootstrap_nodes.worker %#
|
||||||
"#{ item.name }#":
|
"#{ item.name }#":
|
||||||
ansible_user: "#{ item.username }#"
|
ansible_user: "#{ item.username }#"
|
||||||
#% if item.external_address is defined %#
|
|
||||||
ansible_host: "#{ item.external_address }#"
|
|
||||||
#% else %#
|
|
||||||
ansible_host: "#{ item.address }#"
|
ansible_host: "#{ item.address }#"
|
||||||
#% endif %#
|
|
||||||
#% endfor %#
|
#% endfor %#
|
||||||
#% endif %#
|
#% endif %#
|
||||||
#% endif %#
|
#% endif %#
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#% if bootstrap_distribution == "talos" %#
|
||||||
|
---
|
||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2beta2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: kubelet-csr-approver
|
||||||
|
spec:
|
||||||
|
interval: 30m
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: kubelet-csr-approver
|
||||||
|
version: 1.0.6
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: postfinance
|
||||||
|
namespace: flux-system
|
||||||
|
install:
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
upgrade:
|
||||||
|
cleanupOnFail: true
|
||||||
|
remediation:
|
||||||
|
retries: 3
|
||||||
|
uninstall:
|
||||||
|
keepHistory: false
|
||||||
|
values:
|
||||||
|
providerRegex: |
|
||||||
|
^k(m|w)\d\d?$
|
||||||
|
#% endif %#
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#% if bootstrap_distribution == "talos" %#
|
||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ./helmrelease.yaml
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#% if bootstrap_distribution == "talos" %#
|
||||||
|
---
|
||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: &app kubelet-csr-approver
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
targetNamespace: kube-system
|
||||||
|
commonMetadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: *app
|
||||||
|
path: ./kubernetes/apps/kube-system/kubelet-csr-approver/app
|
||||||
|
prune: false # never should be deleted
|
||||||
|
sourceRef:
|
||||||
|
kind: GitRepository
|
||||||
|
name: home-kubernetes
|
||||||
|
wait: false
|
||||||
|
interval: 30m
|
||||||
|
retryInterval: 1m
|
||||||
|
timeout: 5m
|
||||||
|
#% endif %#
|
||||||
@@ -7,7 +7,10 @@ resources:
|
|||||||
#% if bootstrap_distribution == "k3s" %#
|
#% if bootstrap_distribution == "k3s" %#
|
||||||
- ./coredns/ks.yaml
|
- ./coredns/ks.yaml
|
||||||
#% endif %#
|
#% endif %#
|
||||||
|
#% if bootstrap_distribution == "talos" %#
|
||||||
|
- ./kubelet-csr-approver/ks.yaml
|
||||||
|
#% endif %#
|
||||||
- ./metrics-server/ks.yaml
|
- ./metrics-server/ks.yaml
|
||||||
#% if bootstrap_distribution == "k0s" and spegel.enabled | default(false) %#
|
#% if (bootstrap_distribution == "k0s" or bootstrap_distribution == "talos") and spegel.enabled | default(false) %#
|
||||||
- ./spegel/ks.yaml
|
- ./spegel/ks.yaml
|
||||||
#% endif %#
|
#% endif %#
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#% if bootstrap_distribution == "k0s" and spegel.enabled | default(false) %#
|
#% if (bootstrap_distribution == "k0s" or bootstrap_distribution == "talos") and spegel.enabled | default(false) %#
|
||||||
---
|
---
|
||||||
apiVersion: helm.toolkit.fluxcd.io/v2beta2
|
apiVersion: helm.toolkit.fluxcd.io/v2beta2
|
||||||
kind: HelmRelease
|
kind: HelmRelease
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#% if bootstrap_distribution == "k0s" and spegel.enabled | default(false) %#
|
#% if (bootstrap_distribution == "k0s" or bootstrap_distribution == "talos") and spegel.enabled | default(false) %#
|
||||||
---
|
---
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#% if bootstrap_distribution == "k0s" and spegel.enabled | default(false) %#
|
#% if (bootstrap_distribution == "k0s" or bootstrap_distribution == "talos") and spegel.enabled | default(false) %#
|
||||||
---
|
---
|
||||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ resources:
|
|||||||
- ./metrics-server.yaml
|
- ./metrics-server.yaml
|
||||||
- ./openebs.yaml
|
- ./openebs.yaml
|
||||||
- ./piraeus.yaml
|
- ./piraeus.yaml
|
||||||
|
- ./postfinance.yaml
|
||||||
- ./prometheus-community.yaml
|
- ./prometheus-community.yaml
|
||||||
- ./stakater.yaml
|
- ./stakater.yaml
|
||||||
- ./weave-gitops.yaml
|
- ./weave-gitops.yaml
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||||
|
kind: HelmRepository
|
||||||
|
metadata:
|
||||||
|
name: postfinance
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 1h
|
||||||
|
url: https://postfinance.github.io/kubelet-csr-approver
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
# Bootstrap
|
||||||
|
|
||||||
|
## Talos
|
||||||
|
|
||||||
|
### 1. Create Talos Secrets
|
||||||
|
|
||||||
|
```sh
|
||||||
|
task talos:gensecret
|
||||||
|
task talos:genconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Apply Talos Config
|
||||||
|
|
||||||
|
```sh
|
||||||
|
task talos:apply-config
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Boostrap Talos and get kubeconfig
|
||||||
|
|
||||||
|
```sh
|
||||||
|
task talos:bootstrap
|
||||||
|
task talos:kubeconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Install Cilium and kubelet-csr-approver into the cluster
|
||||||
|
|
||||||
|
```sh
|
||||||
|
task talos:apply-extras
|
||||||
|
```
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
charts/
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
helmCharts:
|
||||||
|
- name: cilium
|
||||||
|
repo: https://helm.cilium.io
|
||||||
|
version: 1.14.5
|
||||||
|
releaseName: cilium
|
||||||
|
namespace: kube-system
|
||||||
|
valuesFile: values.yaml
|
||||||
|
commonAnnotations:
|
||||||
|
meta.helm.sh/release-name: cilium
|
||||||
|
meta.helm.sh/release-namespace: kube-system
|
||||||
|
commonLabels:
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
---
|
||||||
|
#% filter indent(width=0, first=True) %#
|
||||||
|
#% include 'partials/cilium-values-init.partial.yaml.j2' %#
|
||||||
|
#% endfilter %#
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
charts/
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
---
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
namespace: kube-system
|
||||||
|
helmCharts:
|
||||||
|
- name: kubelet-csr-approver
|
||||||
|
repo: https://postfinance.github.io/kubelet-csr-approver
|
||||||
|
version: 1.0.6
|
||||||
|
releaseName: kubelet-csr-approver
|
||||||
|
namespace: kube-system
|
||||||
|
valuesInline:
|
||||||
|
providerRegex: ^k(m|w)\d\d?$
|
||||||
|
bypassDnsResolution: true
|
||||||
|
commonAnnotations:
|
||||||
|
meta.helm.sh/release-name: kubelet-csr-approver
|
||||||
|
meta.helm.sh/release-namespace: kube-system
|
||||||
|
commonLabels:
|
||||||
|
app.kubernetes.io/managed-by: Helm
|
||||||
|
#% endif %#
|
||||||
@@ -0,0 +1,192 @@
|
|||||||
|
#% if bootstrap_distribution == 'talos' %#
|
||||||
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/budimanjojo/talhelper/master/pkg/config/schemas/talconfig.json
|
||||||
|
---
|
||||||
|
# renovate: datasource=github-releases depName=siderolabs/talos
|
||||||
|
talosVersion: v1.6.1
|
||||||
|
# renovate: datasource=github-releases depName=kubernetes/kubernetes extractVersion=^v(?<version>.*)$
|
||||||
|
kubernetesVersion: 1.29.1
|
||||||
|
|
||||||
|
clusterName: &cluster home-kubernetes
|
||||||
|
|
||||||
|
#% if bootstrap_kube_api_hostname | default('') %#
|
||||||
|
endpoint: https://#{ bootstrap_kube_api_hostname }#:6443
|
||||||
|
#% else %#
|
||||||
|
endpoint: https://#{ bootstrap_kube_api_addr }#:6443
|
||||||
|
#% endif %#
|
||||||
|
|
||||||
|
clusterPodNets:
|
||||||
|
- "#{ bootstrap_cluster_cidr.split(',')[0] }#"
|
||||||
|
clusterSvcNets:
|
||||||
|
- "#{ bootstrap_service_cidr.split(',')[0] }#"
|
||||||
|
|
||||||
|
additionalApiServerCertSans: &sans
|
||||||
|
- "#{ bootstrap_kube_api_addr }#"
|
||||||
|
- 127.0.0.1 #KubePrism
|
||||||
|
#% if bootstrap_kube_api_hostname | default('') %#
|
||||||
|
- "#{ bootstrap_kube_api_hostname }#"
|
||||||
|
#% endif %#
|
||||||
|
|
||||||
|
additionalMachineCertSans: *sans
|
||||||
|
|
||||||
|
cniConfig:
|
||||||
|
name: none
|
||||||
|
|
||||||
|
nodes:
|
||||||
|
#% for item in bootstrap_nodes.master %#
|
||||||
|
- hostname: "#{ item.name }#"
|
||||||
|
ipAddress: "#{ item.address }#"
|
||||||
|
installDiskSelector:
|
||||||
|
serial: "#{ item.diskSerial }#"
|
||||||
|
controlPlane: true
|
||||||
|
networkInterfaces:
|
||||||
|
- interface: eth0
|
||||||
|
dhcp: false
|
||||||
|
mtu: 1500
|
||||||
|
routes:
|
||||||
|
- network: 0.0.0.0/0
|
||||||
|
gateway: "#{ bootstrap_node_cidr | nthhost(1) }#"
|
||||||
|
vip:
|
||||||
|
ip: "#{ bootstrap_kube_api_addr }#"
|
||||||
|
#% endfor %#
|
||||||
|
#% if bootstrap_nodes.worker | default([]) | length > 0 %#
|
||||||
|
#% for item in bootstrap_nodes.worker %#
|
||||||
|
- hostname: "#{ item.name }#"
|
||||||
|
ipAddress: "#{ item.address }#"
|
||||||
|
installDiskSelector:
|
||||||
|
serial: "#{ item.diskSerial }#"
|
||||||
|
controlPlane: false
|
||||||
|
networkInterfaces:
|
||||||
|
- interface: eth0
|
||||||
|
dhcp: false
|
||||||
|
mtu: 1500
|
||||||
|
routes:
|
||||||
|
- network: 0.0.0.0/0
|
||||||
|
gateway: "#{ bootstrap_node_cidr | nthhost(1) }#"
|
||||||
|
#% endfor %#
|
||||||
|
#% endif %#
|
||||||
|
|
||||||
|
controlPlane:
|
||||||
|
patches:
|
||||||
|
# Configure containerd
|
||||||
|
- &containerdPatch |-
|
||||||
|
machine:
|
||||||
|
files:
|
||||||
|
- op: create
|
||||||
|
path: /etc/cri/conf.d/20-customization.part
|
||||||
|
content: |-
|
||||||
|
[plugins."io.containerd.grpc.v1.cri"]
|
||||||
|
enable_unprivileged_ports = true
|
||||||
|
enable_unprivileged_icmp = true
|
||||||
|
#% if spegel.enabled | default(false) %#
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd]
|
||||||
|
discard_unpacked_layers = false
|
||||||
|
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
|
||||||
|
discard_unpacked_layers = false
|
||||||
|
#% endif %#
|
||||||
|
|
||||||
|
# Disable search domain everywhere
|
||||||
|
- &disableSearchDomainPatch |-
|
||||||
|
machine:
|
||||||
|
network:
|
||||||
|
disableSearchDomain: true
|
||||||
|
|
||||||
|
# Enable cluster discovery
|
||||||
|
- &discoveryPatch |-
|
||||||
|
cluster:
|
||||||
|
discovery:
|
||||||
|
registries:
|
||||||
|
kubernetes:
|
||||||
|
disabled: false
|
||||||
|
service:
|
||||||
|
disabled: false
|
||||||
|
|
||||||
|
# Configure kubelet
|
||||||
|
- &kubeletPatch |-
|
||||||
|
machine:
|
||||||
|
kubelet:
|
||||||
|
extraArgs:
|
||||||
|
rotate-server-certificates: true
|
||||||
|
nodeIP:
|
||||||
|
validSubnets:
|
||||||
|
- "#{ bootstrap_node_cidr }#"
|
||||||
|
|
||||||
|
# Enable KubePrism
|
||||||
|
- &kubePrismPatch |-
|
||||||
|
machine:
|
||||||
|
features:
|
||||||
|
kubePrism:
|
||||||
|
enabled: true
|
||||||
|
port: 7445
|
||||||
|
|
||||||
|
# Force nameserver
|
||||||
|
- &nameserverPatch |-
|
||||||
|
machine:
|
||||||
|
network:
|
||||||
|
nameservers:
|
||||||
|
- 1.1.1.1
|
||||||
|
|
||||||
|
# Configure NTP
|
||||||
|
- &ntpPatch |-
|
||||||
|
machine:
|
||||||
|
time:
|
||||||
|
disabled: false
|
||||||
|
servers:
|
||||||
|
- time.cloudflare.com
|
||||||
|
|
||||||
|
# Custom sysctl settings
|
||||||
|
- &sysctlPatch |-
|
||||||
|
machine:
|
||||||
|
sysctls:
|
||||||
|
fs.inotify.max_queued_events: 65536
|
||||||
|
fs.inotify.max_user_watches: 524288
|
||||||
|
fs.inotify.max_user_instances: 8192
|
||||||
|
|
||||||
|
# Cluster configuration
|
||||||
|
- |-
|
||||||
|
cluster:
|
||||||
|
allowSchedulingOnMasters: true
|
||||||
|
controllerManager:
|
||||||
|
extraArgs:
|
||||||
|
bind-address: 0.0.0.0
|
||||||
|
proxy:
|
||||||
|
disabled: true
|
||||||
|
scheduler:
|
||||||
|
extraArgs:
|
||||||
|
bind-address: 0.0.0.0
|
||||||
|
|
||||||
|
# ETCD configuration
|
||||||
|
- |-
|
||||||
|
cluster:
|
||||||
|
etcd:
|
||||||
|
extraArgs:
|
||||||
|
listen-metrics-urls: http://0.0.0.0:2381
|
||||||
|
advertisedSubnets:
|
||||||
|
- "#{ bootstrap_node_cidr }#"
|
||||||
|
|
||||||
|
# Disable default API server admission plugins.
|
||||||
|
- |-
|
||||||
|
- op: remove
|
||||||
|
path: /cluster/apiServer/admissionControl
|
||||||
|
|
||||||
|
# Enable K8s Talos API Access
|
||||||
|
- |-
|
||||||
|
machine:
|
||||||
|
features:
|
||||||
|
kubernetesTalosAPIAccess:
|
||||||
|
enabled: true
|
||||||
|
allowedRoles:
|
||||||
|
- os:admin
|
||||||
|
allowedKubernetesNamespaces:
|
||||||
|
- kube-system
|
||||||
|
|
||||||
|
worker:
|
||||||
|
patches:
|
||||||
|
- *containerdPatch
|
||||||
|
- *disableSearchDomainPatch
|
||||||
|
- *discoveryPatch
|
||||||
|
- *kubeletPatch
|
||||||
|
- *kubePrismPatch
|
||||||
|
- *nameserverPatch
|
||||||
|
- *ntpPatch
|
||||||
|
- *sysctlPatch
|
||||||
|
#% endif %#
|
||||||
@@ -70,6 +70,9 @@ k8sServicePort: 6444
|
|||||||
#% elif bootstrap_distribution == "k0s" %#
|
#% elif bootstrap_distribution == "k0s" %#
|
||||||
k8sServiceHost: localhost
|
k8sServiceHost: localhost
|
||||||
k8sServicePort: 7443
|
k8sServicePort: 7443
|
||||||
|
#% elif bootstrap_distribution == "talos" %#
|
||||||
|
k8sServiceHost: localhost
|
||||||
|
k8sServicePort: 7445
|
||||||
#% endif %#
|
#% endif %#
|
||||||
kubeProxyReplacement: true
|
kubeProxyReplacement: true
|
||||||
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ k8sServicePort: 6444
|
|||||||
#% elif bootstrap_distribution == "k0s" %#
|
#% elif bootstrap_distribution == "k0s" %#
|
||||||
k8sServiceHost: localhost
|
k8sServiceHost: localhost
|
||||||
k8sServicePort: 7443
|
k8sServicePort: 7443
|
||||||
|
#% elif bootstrap_distribution == "talos" %#
|
||||||
|
k8sServiceHost: localhost
|
||||||
|
k8sServicePort: 7445
|
||||||
#% endif %#
|
#% endif %#
|
||||||
kubeProxyReplacement: true
|
kubeProxyReplacement: true
|
||||||
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# Bootstrap configuration - config.yaml is gitignored
|
# Bootstrap configuration - config.yaml is gitignored
|
||||||
#
|
#
|
||||||
|
|
||||||
# Distribution can either be 'k3s' or 'k0s'
|
# Distribution can either be 'k3s', 'k0s', or 'talos'
|
||||||
bootstrap_distribution: k3s
|
bootstrap_distribution: k3s
|
||||||
|
|
||||||
# Github username (e.g. onedr0p)
|
# Github username (e.g. onedr0p)
|
||||||
@@ -77,15 +77,15 @@ bootstrap_local_storage_path: /var/openebs/local
|
|||||||
bootstrap_nodes:
|
bootstrap_nodes:
|
||||||
# Use only 1, 3 or more odd master nodes, recommended is 3
|
# Use only 1, 3 or more odd master nodes, recommended is 3
|
||||||
master:
|
master:
|
||||||
# - name: # name or hostname of the master node (must match [a-z0-9-\.]+)
|
# - name: # name or hostname of the master node (must match [a-z0-9-\.]+)
|
||||||
# address: # ip address of the master node
|
# address: # ip address of the master node
|
||||||
# username: # ssh username of the master node
|
# username: # ssh username of the master node
|
||||||
# role: # (Optional) k0s only: can be controller+worker (default) or controller
|
# role: # (Optional: k0s) controller+worker (default) or controller
|
||||||
# # external_address: # (Optional) k3s only: Only use when SSH is not reachable on the IP specified in 'address' field
|
# diskSerial: # (Required: Talos) Serial number of Disk for this master node
|
||||||
# ...
|
# ...
|
||||||
worker: # set to [] or omit if no workers are needed
|
worker: # set to [] or omit if no workers are needed
|
||||||
# - name: # name or hostname of the worker node (must match [a-z0-9-\.]+)
|
# - name: # name or hostname of the worker node (must match [a-z0-9-\.]+)
|
||||||
# address: # ip address of the worker node
|
# address: # ip address of the worker node
|
||||||
# username: # ssh username of the worker node
|
# username: # ssh username of the worker node
|
||||||
# # external_address: # (Optional) k3s only: Only use when SSH is not reachable on the IP specified in 'address' field
|
# diskSerial: # (Required: Talos) Serial number of Disk for this worker node
|
||||||
# ...
|
# ...
|
||||||
Reference in new issue
Block a user