fix: remove local hostpath and cilium lb vars and update k0s (#1261)

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-26 17:28:36 -05:00
1 parent 95b0e2b0d8
commit 4ac206aef5
11 files changed
+32 -56

No files matched your search

@@ -93,7 +93,7 @@
- name: Remove local storage path
ansible.builtin.file:
path: "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
path: /var/openebs/local
state: absent
- name: Reboot
@@ -23,23 +23,11 @@
- name: Packages | Install
ansible.builtin.apt:
name: apt-transport-https,ca-certificates,conntrack,curl,dirmngr,gdisk,gnupg,hdparm,htop,
iptables,iputils-ping,ipvsadm,libseccomp2,lm-sensors,neofetch,net-tools,nfs-common,
iptables,iputils-ping,ipvsadm,libseccomp2,lm-sensors,net-tools,nfs-common,
nvme-cli,open-iscsi,parted,psmisc,python3,python3-apt,python3-kubernetes,python3-yaml,
smartmontools,socat,software-properties-common,unzip,util-linux
install_recommends: false
- name: User Configuration
block:
- name: User Configuration | Silence login
ansible.builtin.file:
dest: "{{ '/home/' + ansible_user if ansible_user != 'root' else '/root' }}/.hushlogin"
state: touch
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0644"
modification_time: preserve
access_time: preserve
- name: Network Configuration
notify: Reboot
block:
@@ -82,11 +70,6 @@
- name: System Configuration
notify: Reboot
block:
- name: System Configuration | Neofetch
ansible.builtin.copy:
dest: /etc/profile.d/neofetch.sh
mode: "0755"
content: neofetch --config none
- name: System Configuration | Disable apparmor
when: ansible_facts.services['apparmor.service'] is defined
ansible.builtin.systemd:
@@ -28,4 +28,4 @@ spec:
enabled: true
name: openebs-hostpath
isDefaultClass: false
basePath: "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
basePath: /var/openebs/local
@@ -13,31 +13,37 @@ spec:
installFlags:
- --disable-components=metrics-server
- --no-taints
files:
- name: bootstrap-scripts
src: scripts
hooks:
apply:
before:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/apply-system.sh | INSTALL_K0S_HOSTNAME="#{ item.name }#" bash -s -
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/apply-kube-vip.sh | bash -s -
- bash apply-system.sh "#{ item.name }#"
- bash apply-kube-vip.sh
reset:
before:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/reset-cilium.sh | bash -s -
- bash reset-cilium.sh
after:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/reset-system.sh | bash -s -
- bash reset-system.sh
#% endfor %#
#% for item in bootstrap_nodes.worker %#
- role: worker
ssh:
address: "#{ item.address }#"
user: "#{ item.ssh.username }#"
files:
- name: bootstrap-scripts
src: scripts
hooks:
apply:
before:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/apply-system.sh | INSTALL_K0S_HOSTNAME="#{ item.name }#" bash -s -
- bash apply-system.sh "#{ item.name }#"
reset:
before:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/reset-cilium.sh | bash -s -
- bash reset-cilium.sh
after:
- curl -sfL https://raw.githubusercontent.com/#{ bootstrap_github_username }#/#{ bootstrap_github_repository_name }#/#{ bootstrap_advanced_flags.github_repository_branch|default('main', true) }#/kubernetes/k0s/resources/reset-system.sh | bash -s -
- bash reset-system.sh
#% endfor %#
k0s:
# renovate: datasource=github-releases depName=k0sproject/k0s
@@ -8,11 +8,11 @@ set -o noglob
mkdir -p /var/lib/k0s/manifests/kube-vip
# Create kube-vip rbac
tee /var/lib/k0s/manifests/kube-vip/kube-vip-rbac.yaml > /dev/null <<EOF
cat >/var/lib/k0s/manifests/kube-vip/kube-vip-rbac.yaml <<EOF
#% include 'partials/kube-vip-rbac.partial.yaml.j2' %#
EOF
# Create kube-vip daemonset
tee /var/lib/k0s/manifests/kube-vip/kube-vip-ds.yaml > /dev/null <<EOF
cat >/var/lib/k0s/manifests/kube-vip/kube-vip-ds.yaml <<EOF
#% include 'partials/kube-vip-ds.partial.yaml.j2' %#
EOF
@@ -4,15 +4,17 @@ set -o noglob
[ $(id -u) -eq 0 ] || exec sudo $0 $@
K0S_HOSTNAME="$1"
# Prepare
sudo apt-get update -y
# Hostname
if [ -n "${INSTALL_K0S_HOSTNAME}" ] && [ "$(hostnamectl hostname)" != "${INSTALL_K0S_HOSTNAME}" ]; then
hostnamectl set-hostname "${INSTALL_K0S_HOSTNAME}"
tee /etc/hosts > /dev/null <<EOF
if [ -n "${K0S_HOSTNAME}" ] && [ "$(hostnamectl hostname)" != "${K0S_HOSTNAME}" ]; then
hostnamectl set-hostname "${K0S_HOSTNAME}"
cat >/etc/hosts <<EOF
127.0.0.1 localhost
127.0.1.1 $INSTALL_K0S_HOSTNAME
127.0.1.1 $K0S_HOSTNAME
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
@@ -25,7 +27,7 @@ timedatectl set-timezone "#{ bootstrap_timezone }#"
# Install Packages
apt-get install -y --no-install-recommends \
apt-transport-https ca-certificates conntrack curl dirmngr gdisk gnupg hdparm htop \
iptables iputils-ping ipvsadm libseccomp2 lm-sensors neofetch net-tools nfs-common \
iptables iputils-ping ipvsadm libseccomp2 lm-sensors net-tools nfs-common \
nvme-cli open-iscsi parted psmisc python3 python3-apt python3-kubernetes python3-yaml \
smartmontools socat software-properties-common unzip util-linux
@@ -33,7 +35,7 @@ apt-get install -y --no-install-recommends \
# Update DNS
chattr -i /etc/resolv.conf
rm -f /etc/resolv.conf
tee /etc/resolv.conf > /dev/null <<EOF
cat >/etc/resolv.conf <<EOF
search .
nameserver #{ bootstrap_dns_server }#
EOF
@@ -49,7 +51,7 @@ done
systemctl restart systemd-modules-load.service
# Sysctls
tee /etc/sysctl.d/99-kubernetes.conf > /dev/null <<EOF
cat >/etc/sysctl.d/99-kubernetes.conf <<EOF
fs.inotify.max_queued_events = 65536
fs.inotify.max_user_watches = 524288
fs.inotify.max_user_instances = 8192
@@ -64,15 +66,9 @@ if systemctl is-enabled apparmor.service; then
systemctl mask apparmor.service
fi
# Neofetch
tee /etc/profile.d/neofetch.sh > /dev/null <<EOF
neofetch --config none
EOF
chmod 755 /etc/profile.d/neofetch.sh
# Create containerd config
mkdir -p /etc/k0s/containerd.d
tee /etc/k0s/containerd.d/default.toml > /dev/null <<EOF
cat >/etc/k0s/containerd.d/default.toml <<EOF
[plugins."io.containerd.grpc.v1.cri"]
enable_unprivileged_ports = true
enable_unprivileged_icmp = true
@@ -7,7 +7,7 @@ set -o noglob
remove_interfaces() {
ip link show 2>/dev/null | grep 'cilium' | while read ignore iface ignore; do
iface=${iface%%@*}
[ -z "$iface" ] || ip link delete $iface
[ -z "$iface" ] || (ip link delete $iface || true)
done
}
@@ -8,7 +8,7 @@ set -o noglob
rm -rf /etc/k0s/containerd.d
# Remove local storage data
rm -rf "#{ bootstrap_advanced_flags.local_storage_path|default('/var/openebs/local', true) }#"
rm -rf /var/openebs/local
# Reboot
(sleep 10 && systemctl reboot)&
@@ -82,7 +82,7 @@ l2announcements:
#% endif %#
loadBalancer:
algorithm: maglev
mode: "#{ bootstrap_advanced_flags.cilium_loadbalancer_mode|default('dsr', true) }#"
mode: dsr
localRedirectPolicy: true
operator:
replicas: 1
@@ -50,7 +50,7 @@ l2announcements:
#% endif %#
loadBalancer:
algorithm: maglev
mode: "#{ bootstrap_advanced_flags.cilium_loadbalancer_mode|default('dsr', true) }#"
mode: dsr
localRedirectPolicy: true
operator:
replicas: 1
-9
View File
@@ -102,15 +102,6 @@ bootstrap_nodes:
# # Disable to prevent changes to nodes /etc/resolv.conf
# update_resolv_conf: true
#
# # Cilium load balancer mode, choose either 'dsr' or 'snat'
# # Due to unknown reasons some people need this set to 'snat' in order
# # for Cilium L2 announcements to work properly. Keep this dsr unless
# # you have issues with connecting to Cilium L2 announcements.
# cilium_loadbalancer_mode: dsr
#
# # Path for openebs openebs-hostpath to use for storage on ALL nodes
# local_storage_path: /var/openebs/local
#
# # Enable Dual Stack IPv4 first
# # IMPORTANT: I am looking for people to help maintain IPv6 support since I cannot test it.
# # https://github.com/onedr0p/flux-cluster-template/issues/1148