diff --git a/.config.sample.env b/.config.sample.env index 899ec277..39fa00d2 100644 --- a/.config.sample.env +++ b/.config.sample.env @@ -36,11 +36,6 @@ export BOOTSTRAP_METALLB_INGRESS_ADDR="" # e.g. age15uzrw396e67z9wdzsxzdk7ka0g2gr3l460e0slaea563zll3hdfqwqxdta export BOOTSTRAP_AGE_PUBLIC_KEY="" - -# Enable / Disable kube-vip -# If this is set to false (e.g. on a cluster with a single-node control plane), do not install kube-vip. -# BOOTSTRAP_KUBE_VIP_ADDR needs to be set to the IP the API Server is reachable under -export BOOTSTRAP_KUBE_VIP_ENABLED="true" # The IP Address to use with kube-vip # Pick a unused IP that is on the same network as your nodes # and outside the ${BOOTSTRAP_METALLB_LB_RANGE} range diff --git a/cluster/apps/kube-system/kustomization.yaml b/cluster/apps/kube-system/kustomization.yaml index 92724f8a..4c6d3b53 100644 --- a/cluster/apps/kube-system/kustomization.yaml +++ b/cluster/apps/kube-system/kustomization.yaml @@ -8,6 +8,7 @@ resources: - ./external-dns - ./ingress-nginx - ./k8s-gateway + - ./kube-vip - ./metallb - ./metrics-server - ./reloader diff --git a/configure b/configure index e3eaf9f5..81b1dc14 100755 --- a/configure +++ b/configure @@ -45,10 +45,8 @@ main() { > "${PROJECT_DIR}/cluster/flux/vars/cluster-settings.yaml" envsubst < "${PROJECT_DIR}/tmpl/cluster/flux-cluster.yaml" \ > "${PROJECT_DIR}/cluster/flux/config/flux-cluster.yaml" - if [[ "${BOOTSTRAP_KUBE_VIP_ENABLED}" == "true" ]]; then - envsubst < "${PROJECT_DIR}/tmpl/cluster/kube-vip-daemonset.yaml" \ - > "${PROJECT_DIR}/cluster/apps/kube-system/kube-vip/daemon-set.yaml" - fi + envsubst < "${PROJECT_DIR}/tmpl/cluster/kube-vip-daemonset.yaml" \ + > "${PROJECT_DIR}/cluster/apps/kube-system/kube-vip/daemon-set.yaml" # generate cluster secrets envsubst < "${PROJECT_DIR}/tmpl/cluster/cluster-secrets.sops.yaml" \ > "${PROJECT_DIR}/cluster/flux/vars/cluster-secrets.sops.yaml" @@ -71,18 +69,6 @@ main() { # generate ansible settings envsubst < "${PROJECT_DIR}/tmpl/ansible/kube-vip.yml" \ > "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/kube-vip.yml" - # include kube-vip if enabled - if [[ ${BOOTSTRAP_KUBE_VIP_ENABLED} == "true" ]]; then - if [[ $(yq eval --no-doc 'contains({"resources": ["kube-vip"]})' "${PROJECT_DIR}/cluster/apps/kube-system/kustomization.yaml") == false ]]; then - yq --inplace '.resources += [ "kube-vip" ]' "${PROJECT_DIR}/cluster/apps/kube-system/kustomization.yaml" - fi - if [[ $(yq eval --no-doc 'contains({"k3s_server_manifests_templates": ["kube-vip-daemonset.yaml.j2"]})' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml") == false ]]; then - yq --inplace '.k3s_server_manifests_templates += [ "kube-vip-daemonset.yaml.j2" ]' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml" - fi - if [[ $(yq eval --no-doc 'contains({"k3s_server_manifests_urls": [{"url": "https://kube-vip.io/manifests/rbac.yaml", "filename": "kube-vip-rbac.yaml"}]})' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml") == false ]]; then - yq --inplace '.k3s_server_manifests_urls += [{"url": "https://kube-vip.io/manifests/rbac.yaml", "filename": "kube-vip-rbac.yaml"}]' "${PROJECT_DIR}/provision/ansible/inventory/group_vars/kubernetes/k3s.yml" - fi - fi # generate ansible hosts file and secrets generate_ansible_hosts generate_ansible_host_secrets diff --git a/provision/ansible/inventory/group_vars/kubernetes/k3s.yml b/provision/ansible/inventory/group_vars/kubernetes/k3s.yml index bc7aa023..e6ee41af 100644 --- a/provision/ansible/inventory/group_vars/kubernetes/k3s.yml +++ b/provision/ansible/inventory/group_vars/kubernetes/k3s.yml @@ -28,6 +28,9 @@ k3s_registration_address: "{{ kubevip_address }}" # (list) A list of URLs to deploy on the primary control plane. Read notes below. k3s_server_manifests_urls: + # Kube-vip + - url: https://kube-vip.io/manifests/rbac.yaml + filename": kube-vip-rbac.yaml # Tigera Operator # https://github.com/projectcalico/calico/issues/7003 - url: https://raw.githubusercontent.com/projectcalico/calico/v3.24.2/manifests/tigera-operator.yaml @@ -53,4 +56,5 @@ k3s_server_manifests_urls: # (list) A flat list of templates to deploy on the primary control plane # /var/lib/rancher/k3s/server/manifests k3s_server_manifests_templates: - - "calico-installation.yaml.j2" + - calico-installation.yaml.j2 + - kube-vip-daemonset.yaml.j2