-
Notifications
You must be signed in to change notification settings - Fork 50
/
setupcluster.sh
executable file
·51 lines (44 loc) · 1.3 KB
/
setupcluster.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
47
48
49
50
51
#!/usr/bin/env bash
# This script installs all the essential services on an already working Kubernetes cluster
# (i.e. VMs running with all the necessary Kubernetes components on them).
# This script is run on the host machine.
set -xe
dir=$(dirname "$0")
if [[ -n $USE_CILIUM ]]; then
helm install -n kube-system cilium cilium/cilium \
--set kubeProxyReplacement=true \
--set k8sServiceHost=kubernetes \
--set k8sServicePort=6443 \
--set cgroup.automount.enabled=false \
--set cgroup.hostRoot=/sys/fs/cgroup \
--wait --timeout 15m
fi
helm install -n kube-system coredns coredns/coredns \
--set service.clusterIP=10.32.0.10 \
--set replicaCount=2 \
--wait --timeout 3m
helm install -n kube-system nfs-provisioner nfs-provisioner/nfs-subdir-external-provisioner \
--set nfs.server=192.168.1.1 \
--set nfs.path="$(realpath "$dir")/nfs-pvs" \
--set storageClass.defaultClass=true
helm install -n kube-system metallb metallb/metallb \
--wait --timeout 3m
cat <<EOF | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: lb-pool
namespace: kube-system
spec:
addresses:
- 192.168.1.30-192.168.1.254
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: lb-l2adv
namespace: kube-system
spec:
ipAddressPools:
- lb-pool
EOF