This repository has been archived by the owner on Apr 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_istio.sh
executable file
·76 lines (60 loc) · 2.12 KB
/
install_istio.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh -e
# Make sure we're in the script directory so that Istio is downloaded next to it
cd "$(dirname "$0")"
OS="$(uname)"
if [ "$OS" = "Darwin" ]; then
OSEXT="osx"
else
OSEXT="linux"
fi
ISTIO_VERSION="0.7.1"
ISTIO_URL="https://github.com/istio/istio/releases/download/${ISTIO_VERSION}/istio-${ISTIO_VERSION}-${OSEXT}.tar.gz"
if ! hash kubectl >/dev/null; then
echo "Make sure you have kubctl installed first" >&2
fi
download_istio() {
local name="istio-$ISTIO_VERSION"
if [ ! -d "$name" ]; then
echo "Downloading $name from $ISTIO_URL ..." >&2
curl -L "$ISTIO_URL" | tar xz
fi
if [ ! -L "istio" ]; then
ln -s "$name" "istio"
fi
}
install_istio_to_k8s() {
kubectl apply -f istio/install/kubernetes/istio.yaml
}
install_sidecar_injector_to_k8s() {
# Signed cert as a k8s secret
./istio/install/kubernetes/webhook-create-signed-cert.sh \
--service istio-sidecar-injector \
--namespace istio-system \
--secret sidecar-injector-certs
# Config map
kubectl apply -f istio/install/kubernetes/istio-sidecar-injector-configmap-release.yaml
# CA bundle
cat istio/install/kubernetes/istio-sidecar-injector.yaml | \
./istio/install/kubernetes/webhook-patch-ca-bundle.sh > \
istio/install/kubernetes/istio-sidecar-injector-with-ca-bundle.yaml
# Install sidecar injector w/ the CA
kubectl apply -f istio/install/kubernetes/istio-sidecar-injector-with-ca-bundle.yaml
# Label the default namespace so that it uses the sidecar injection by default
kubectl label namespace default istio-injection=enabled
}
setup_istio() {
# Attempting install twice
install_istio_to_k8s || install_istio_to_k8s
# Sidecar injector for attaching Envoy to Kubernetes pods
install_sidecar_injector_to_k8s
}
show_path() {
local bindir="$(cd istio/bin; pwd)"
echo "============================" >&2
echo "Add $bindir to your path; e.g copy paste in your shell and/or ~/.profile:" >&2
echo "export PATH=\"\$PATH:$bindir\""
echo "OR use Istio directly from ./istio/bin/istioctl"
}
download_istio
setup_istio
show_path