-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_microk8s.sh
61 lines (44 loc) · 1.03 KB
/
install_microk8s.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
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
packageUpdate() {
echo "update apt cache"
apt update >> /dev/null
}
installSnap() {
echo "install snapd"
apt install -y snapd
snap install microk8s --classic
snap install kubectl --classic
snap install terraform --classic
}
preparation() {
iptables -P FORWARD ACCEPT
mkdir -p /usr/share/elasticsearch/data
mkdir -p /usr/share/elasticsearch/data/nodes
chown 1000:2000 /usr/share/elasticsearch/data
chown 1000:2000 /usr/share/elasticsearch/data/nodes
}
installMicrok8s() {
microk8s status --wait-ready >> /dev/null
microk8s enable dns
microk8s enable ingress
microk8s enable hostpath-storage
}
postTasks() {
microk8s config > kubeconfig
microk8s stop && microk8s start
echo "microk8s installed and configured"
echo "export KUBECONFIG=kubeconfig" >> .bashrc
source .bashrc
}
cd "$(dirname "$0")"
main() {
packageUpdate
installSnap
preparation
installMicrok8s
postTasks
}
main "$@"