-
Notifications
You must be signed in to change notification settings - Fork 0
/
kube-up-aws.sh
107 lines (91 loc) · 2.7 KB
/
kube-up-aws.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
### Johann Helbling [email protected]
# set bash or unset exist env
set -o errexit
set -o nounset
set -o pipefail
unset AWS_HOME
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset KOPS_STATE_STORE
#### Checking if kops installed
echo "Checking your local enviroment"
sleep 2
echo "Checking if kops installed and config exist"
sleep 3
KOPS="/usr/local/bin/kops"
KOPSCONF="$HOME/.kops/config"
if [[ -f $KOPS && $KOPSCONF ]]; then
echo "$KOPS and $KOPSCONF found, OK"
else
echo "$KOPS not found, please follow Installing Documentation https://github.com/kubernetes/kops"
exit 1
fi
#### Checking some credentials
echo "Checking AWS credentials"
sleep 2
AWSCRED="$HOME/.aws/credentials"
if [[ -f $AWSCRED ]]; then
echo "$AWSCRED found, OK"
else
echo "$AWSCRED not found, please read Documentation https://aws.amazon.com/developers/access-keys"
echo "and create one with follow access rights"
echo "AmazonEC2FullAccess"
echo "AmazonRoute53FullAccess"
echo "AmazonS3FullAccess"
echo "IAMFullAccess"
echo "AmazonVPCFullAccess"
exit 1
fi
### Agree setup
echo "Setup a new high-availability (HA) Kubernetes cluster on AWS"
echo "Do you agree with this? [yes or no]: "
read yno
case $yno in
[yY] | [yY][Ee][Ss] )
echo "OK, you will do it, let me ask you some question"
;;
[nN] | [n|N][O|o] )
echo "Not agreed, you can't proceed the installation";
exit 1
;;
*) echo "Invalid input"
;;
esac
### Ask Kubernetes version
echo "Do you want deploy stable version of Kubernetes [yes or no]: "
read yno
case $yno in
[yY] | [yY][Ee][Ss] )
echo "OK, next question"
;;
[nN] | [n|N][O|o] )
echo "Sorry, i can only deploy stable version";
exit 1
;;
*) echo "Invalid input"
;;
esac
#### Ask cluster name
echo "Please enter your cluster name e.g. my.cluster.name.tld"
read cluster_name
export $cluster_name
echo "Cluster name $cluster_name was set..."
### Ask network topology
echo "Please enter topology of cluster e.g. 'private or public' "
read topology
export $topology
#### Ask AWS zones
echo "Network topology of Kubernetes cluster was set as $topology, now please define your zones e.g: 'eu-west-1a,eu-west-1b,eu-west-1c' for AZ"
read zones
export $zones
#### Ask nodes counts
echo "Please set nodes counter, 'NOTES: for AZ/HA set up 3 nodes required'"
read worker_number
export $worker_number
echo "Worker number was set to $worker_counter, please define node size e.g. m4.large"
### Ask nodes sizing
read nodes_size
export $nodes_size
echo "Nodes size was set as $node_size"
exit 1