feat: update kube-vip ansible playbook for k0s and k3s - ipv6 config changes (#1234)

* feat: update kube-vip ansible playbook for k0s and k3s

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

* fix: update renovate

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

* fix: move ipv6 to advanced options

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

* feat: kube-vip manifests to partials

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

* feat: kube vip samesies

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

* fix: update config sample

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

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-22 15:28:21 -05:00
1 parent 6557c255d6
commit afbf097dac
61 files changed
+244 -307

No files matched your search

@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
- name: Cluster Installation
hosts: kubernetes
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k0s', 'k3s'] %#
---
- name: Cluster kube-vip
hosts: master
@@ -11,16 +11,21 @@
ansible.builtin.pause:
seconds: 5
tasks:
#% if bootstrap_distribution in ['k3s'] %#
- name: Ensure Kubernetes is running
ansible.builtin.include_role:
name: xanmanning.k3s
public: true
vars:
k3s_state: started
#% endif %#
- name: Upgrade kube-vip
ansible.builtin.template:
src: templates/kube-vip-static-pod.yaml.j2
dest: "{{ k3s_server_pod_manifests_dir }}/kube-vip-static-pod.yaml"
src: templates/kube-vip-ds.yaml.j2
#% if bootstrap_distribution in ['k3s'] %#
dest: "{{ k3s_server_manifests_dir }}/kube-vip-ds.yaml"
#% elif bootstrap_distribution in ['k0s'] %#
dest: "/var/lib/k0s/manifests/kube-vip/ds.yaml"
#% endif %#
mode: preserve
#% endif %#
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
- name: Cluster Nuke
hosts: kubernetes
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
- name: Prepare System
hosts: kubernetes
@@ -1,4 +1,4 @@
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
#% if bootstrap_distribution in ['k0s', 'k3s'] %#
---
- name: Reboot
hosts: kubernetes
@@ -1,4 +1,4 @@
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
#% if bootstrap_distribution in ['k0s', 'k3s'] %#
---
# https://github.com/kevincoakley/ansible-role-k8s-rolling-update
- name: Cluster rollout update
@@ -13,9 +13,9 @@
seconds: 5
tasks:
- name: Details
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
ansible.builtin.command: "k3s kubectl get node {{ inventory_hostname }} -o json"
#% elif bootstrap_distribution == 'k0s' %#
#% elif bootstrap_distribution in ['k0s'] %#
ansible.builtin.command: "k0s kubectl get node {{ inventory_hostname }} -o json"
#% endif %#
register: kubectl_get_node
@@ -33,9 +33,9 @@
- name: Cordon
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution == 'k0s' %#
#% elif bootstrap_distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: cordon
@@ -44,9 +44,9 @@
- name: Drain
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution == 'k0s' %#
#% elif bootstrap_distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: drain
@@ -80,9 +80,9 @@
- name: Uncordon
kubernetes.core.k8s_drain:
name: "{{ inventory_hostname }}"
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
kubeconfig: /etc/rancher/k3s/k3s.yaml
#% elif bootstrap_distribution == 'k0s' %#
#% elif bootstrap_distribution in ['k0s'] %#
kubeconfig: /var/lib/k0s/pki/admin.conf
#% endif %#
state: uncordon
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
- name: Cilium
block:
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
# https://github.com/k3s-io/k3s/issues/1971
- name: Cruft
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
- name: Get absolute path to this Git repository # noqa: command-instead-of-module
ansible.builtin.command: git rev-parse --show-toplevel
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
# https://docs.k3s.io/helm
apiVersion: helm.cattle.io/v1
@@ -9,7 +9,7 @@ metadata:
spec:
repo: https://helm.cilium.io/
chart: cilium
# renovate: datasource=github-releases depName=cilium/cilium
# renovate: datasource=helm depName=cilium repository=https://helm.cilium.io
version: "1.14.5"
targetNamespace: kube-system
bootstrap: true
@@ -1,77 +1,4 @@
#% if bootstrap_distribution == 'k3s' %#
#% if bootstrap_distribution in ['k3s'] %#
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kube-vip
namespace: kube-system
labels:
app.kubernetes.io/name: kube-vip
spec:
selector:
matchLabels:
app.kubernetes.io/name: kube-vip
template:
metadata:
labels:
app.kubernetes.io/name: kube-vip
spec:
containers:
- name: kube-vip
image: ghcr.io/kube-vip/kube-vip:v0.6.4
imagePullPolicy: IfNotPresent
args: ["manager"]
env:
- name: address
value: "#{ bootstrap_kube_api_addr }#"
- name: vip_arp
value: "true"
- name: lb_enable
value: "true"
- name: port
value: "6443"
- name: vip_cidr
value: "32"
- name: cp_enable
value: "true"
- name: cp_namespace
value: kube-system
- name: vip_ddns
value: "false"
- name: svc_enable
value: "false"
- name: vip_leaderelection
value: "true"
- name: vip_leaseduration
value: "15"
- name: vip_renewdeadline
value: "10"
- name: vip_retryperiod
value: "2"
- name: prometheus_server
value: :2112
securityContext:
capabilities:
add: ["NET_ADMIN", "NET_RAW", "SYS_TIME"]
hostAliases:
- hostnames:
- kubernetes
ip: 127.0.0.1
hostNetwork: true
serviceAccountName: kube-vip
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
#% include 'partials/kube-vip-ds.partial.yaml.j2' %#
#% endif %#
@@ -0,0 +1,4 @@
#% if bootstrap_distribution in ['k3s'] %#
---
#% include 'partials/kube-vip-rbac.partial.yaml.j2' %#
#% endif %#