-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathspin-kube-k3s.sh
executable file
·46 lines (35 loc) · 1.29 KB
/
spin-kube-k3s.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -euo pipefail
source $(dirname $(realpath "$0"))/spin-kube.sh
NODE_IP=${NODE_IP:-""}
# List of binary names
binaries=("kubectl" "helm")
for binary in "${binaries[@]}"; do
which_binary "$binary"
done
cluster_args=()
# If node IP is set, script is being run on another machine
if [[ -n "$NODE_IP" ]]; then
# Add remote host's IP as a SAN for the servers and agents certificates
cluster_args=(
"--tls-san=$NODE_IP"
"--tls-san=0.0.0.0"
'--kube-controller-manager-arg 'bind-address=0.0.0.0''
'--kube-proxy-arg 'metrics-bind-address=0.0.0.0'' '--kube-scheduler-arg 'bind-address=0.0.0.0''
)
fi
# Install k3s making the kubeconfig readable (https://docs.k3s.io/installation/configuration)
curl -sfL https://get.k3s.io | sh -s - server --write-kubeconfig-mode '0644' ${cluster_args[@]}
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# Apply node labels used by install_* helpers from spin-kube.sh
kubectl annotate node --all workload=system
kubectl annotate node --all runtime=containerd-shim-spin
install_cert_manager
install_datadog
install_k6_operator
install_kwasm_operator
# Re-export kubeconfig as kwasm operator may restart the k3s process
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# Provision Nodes
kubectl annotate node --all kwasm.sh/kwasm-node=true
install_spin_operator