-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.sh
executable file
·53 lines (36 loc) · 1.35 KB
/
deploy.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
#!/usr/bin/env bash
set -e
#variables
export NAME=k8s.shanelee.name.k8s.local
export KOPS_STATE_STORE=s3://shane-k8s-bucket
#Cluster kubeconfig and keygen (for key-pair generation)
mkdir -p ~/stacks/${NAME}
touch ~/stacks/${NAME}/kubeconfig
export KUBECONFIG=~/stacks/${NAME}/kubeconfig
mkdir -p ~/stacks/${NAME}/credentials
#needs user input
ssh-keygen -t rsa -f ~/stacks/${NAME}/credentials/id_rsa
echo "Create k8s gossip cluster"
kops create cluster --v=0 \
--cloud=aws \
--node-count 2 \
--master-size=m3.medium \
--master-zones=ap-southeast-2a \
--zones ap-southeast-2a,ap-southeast-2c \
--name= ${NAME} \
--node-size=m3.medium \
--node-volume-size=20 \
--ssh-public-key=~/stacks/${NAME}/credentials/id_rsa.pub \
2>&1 | tee ~/stacks/${NAME}/create_cluster.txt
kops update cluster ${NAME} --yes
echo "sleep for 5 mins to wait for cluster creation"
sleep 300
echo "kubectl version installed is $(kubectl version)"
kops export kubecfg ${NAME}
echo "verify nodes are visible in cluster"
kubectl get nodes -o wide
echo "Install addons for cluster"
echo "Install dashboard"
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
echo "Install heapster"
kubectl apply -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/monitoring-standalone/v1.7.0.yaml