mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
56 lines
2.7 KiB
Cheetah
56 lines
2.7 KiB
Cheetah
#cloud-config
|
|
%{ if length(extra_ssh_keys) > 0 }
|
|
ssh_authorized_keys:
|
|
%{ for ssh_key in extra_ssh_keys }
|
|
- ${ssh_key}
|
|
%{ endfor }
|
|
%{ endif }
|
|
write_files:
|
|
- path: /var/lib/rancher/k3s/server/manifests/metrics.yaml
|
|
permissions: "0755"
|
|
owner: root:root
|
|
encoding: b64
|
|
content: ${metrics_yaml}
|
|
- path: /var/lib/rancher/k3s/server/manifests/prom.yaml
|
|
permissions: "0755"
|
|
owner: root:root
|
|
encoding: b64
|
|
content: ${prom_yaml}
|
|
runcmd:
|
|
- echo "net.ipv4.neigh.default.gc_interval = 3600" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.neigh.default.gc_stale_time = 3600" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.neigh.default.gc_thresh3 = 16384" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.neigh.default.gc_thresh2 = 8192" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.neigh.default.gc_thresh1 = 4096" >> /etc/sysctl.conf
|
|
- echo "fs.file-max = 12000500" >> /etc/sysctl.conf
|
|
- echo "fs.nr_open = 20000500" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.tcp_mem = '10000000 10000000 10000000'" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.tcp_rmem = '1024 4096 16384'" >> /etc/sysctl.conf
|
|
- echo "net.ipv4.tcp_wmem = '1024 4096 16384'" >> /etc/sysctl.conf
|
|
- echo "net.core.rmem_max = 16384" >> /etc/sysctl.conf
|
|
- echo "net.core.wmem_max = 16384" >> /etc/sysctl.conf
|
|
- ulimit -n 20000000
|
|
- echo "# <domain> <type> <item> <value>" >> /etc/security/limits.d/limits.conf
|
|
- echo " * soft nofile 20000" >> /etc/security/limits.d/limits.conf
|
|
- echo " * hard nofile 20000" >> /etc/security/limits.d/limits.conf
|
|
- sysctl -p
|
|
- apt-get update
|
|
- apt-get install -y git vim software-properties-common resolvconf linux-headers-$(uname -r)
|
|
- echo "nameserver 1.1.1.1" > /etc/resolvconf/resolv.conf.d/tail
|
|
- echo "RateLimitIntervalSec=0" >> /etc/systemd/journald.conf
|
|
- echo "RateLimitBurst=0" >> /etc/systemd/journald.conf
|
|
- systemctl restart systemd-journald.service
|
|
- systemctl start resolvconf
|
|
- wget https://raw.githubusercontent.com/galal-hussein/k3s/k3s_with_kine_fix/k3s
|
|
- cp k3s /usr/local/bin/k3s
|
|
- chmod +x /usr/local/bin/k3s
|
|
%{if master_index != 0 }
|
|
- sleep 20
|
|
%{ endif }
|
|
- until (curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_DOWNLOAD=true K3S_CLUSTER_SECRET="${k3s_cluster_secret}" INSTALL_K3S_VERSION="${install_k3s_version}" INSTALL_K3S_EXEC="${k3s_server_args} --cluster-cidr=10.0.0.0/8 --no-deploy traefik --no-deploy servicelb --tls-san ${lb_address} %{ if use_ha == "true" } --storage-endpoint="postgres://${db_username}:${db_password}@${db_address}:5432/${db_name}" %{ if master_index == 0 }--bootstrap-save%{ endif } %{ endif }" sh -); do echo 'Error installing k3s'; sleep 1; done
|
|
%{if debug != 0 }
|
|
- sed -i 's/bin\/k3s/bin\/k3s --debug/g' /etc/systemd/system/k3s.service
|
|
- systemctl daemon-reload
|
|
- systemctl restart k3s
|
|
%{ endif }
|