-
Notifications
You must be signed in to change notification settings - Fork 0
/
automate.sh
executable file
·39 lines (33 loc) · 1.22 KB
/
automate.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
#!/usr/bin/env bash
# checking pre-reqs
echo "#### Checking RKE ####"
if [ ! -e /usr/local/bin/rke ]; then
curl -LO https://github.com/rancher/rke/releases/download/v0.2.0/rke_linux-amd64
chmod +x rke_linux-amd64
mv rke_linux-amd64 rke
sudo mv rke /usr/local/bin/rke
else
echo "Pre-req OK!"
fi
echo "#### Checking kubetctl ####"
if [ ! -e /usr/local/bin/kubectl ]; then
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
else
echo "Pre-req OK!"
fi
echo "#### Create and setup machines ####"
vagrant up
echo "#### Deploy K8S via RKE ####"
./deploy-k8s-rke.sh
export KUBECONFIG=kube_config_rancher-cluster.yml
echo "# Checking services status"
K8S_PENDING=`kubectl get pods --all-namespaces --kubeconfig kube_config_rancher-cluster.yml --field-selector=status.phase!=Running,status.phase!=Succeeded | wc -l`
while [ ${K8S_PENDING} -ne 0 ]; do
sleep 10
echo -n "."
K8S_PENDING=`kubectl get pods --all-namespaces --kubeconfig kube_config_rancher-cluster.yml --field-selector=status.phase!=Running,status.phase!=Succeeded | wc -l`
done
echo "# Kubernetes services OK."
#kubectl apply -f app_deploy/*.yml