-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcloud-demo.sh
executable file
·79 lines (64 loc) · 2.06 KB
/
cloud-demo.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
#!/usr/bin/env bash
########################
# include the magic
########################
. ./demo-magic.sh
########################
# Configure the options
########################
#
# speed at which to simulate typing. bigger num = faster
#
TYPE_SPEED=20
#
# custom prompt
#
# see http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html for escape sequences
#
DEMO_PROMPT="${GREEN}➜ ${CYAN}\W "
# text color
# DEMO_CMD_COLOR=$BLACK
# hide the evidence
clear
pei "kubectl cluster-info"
pei "kubectl get nodes -o wide"
wait
pei "kubectl apply -f web.yml,database.yml,netshoot.yml,service-clusterip.yml"
pei "kubectl scale deployment app --replicas 6"
wait
pei "kubectl get pods -o wide --watch"
wait
pei "kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.4/deploy/static/provider/aws/deploy.yaml"
pei "kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=90s"
wait
pei "cat ingress.yml"
wait
pei "kubectl apply -f ingress.yml"
wait
pei "kubectl get svc -n ingress-nginx"
wait
#Get External IP of the Ingress controller
EXT_IP=$(kubectl get svc -n ingress-nginx -o json ingress-nginx-controller | jq -r .status.loadBalancer.ingress[0].hostname)
#Curl it
p "EXT_IP=\$(kubectl get svc -n ingress-nginx -o json ingress-nginx-controller | jq -r .status.loadBalancer.ingress[0].hostname)"
pei "curl \$EXT_IP/host"
pei "curl \$EXT_IP/host"
pei "curl \$EXT_IP/host"
pei "curl \$EXT_IP/host"
pei "curl \$EXT_IP/host"
pei "curl \$EXT_IP/host"
wait
# Service Load Balancer Demo
p "#Service Load Balancer Demo"
pei "kubectl apply -f service-loadbalancer.yml"
wait
pei "kubectl get svc loadbalancer-service"
LB_IP=$(kubectl get svc -o json loadbalancer-service | jq -r .status.loadBalancer.ingress[0].hostname)
#Curl it
p "LB_IP=\$(kubectl get svc -o json loadbalancer-service | jq -r .status.loadBalancer.ingress[0].hostname)"
pei "curl \$LB_IP/host"
pei "curl \$LB_IP/host"
pei "curl \$LB_IP/host"
pei "curl \$LB_IP/host"
pei "curl \$LB_IP/host"
pei "curl \$LB_IP/host"