-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathservices-demo.sh
executable file
·105 lines (87 loc) · 2.76 KB
/
services-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
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
#!/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 apply -f web.yml,database.yml,netshoot.yml"
wait
pei "kubectl get pods --watch"
wait
# Stateful
p "#Statefulset demo"
pei "kubectl get statefulset postgres"
wait
pei "kubectl describe statefulset postgres"
wait
pei "kubectl exec netshoot -- host postgres-0.postgres.default.svc.cluster.local."
wait
pei "kubectl exec netshoot -- host postgres-1.postgres.default.svc.cluster.local."
wait
pei "kubectl exec netshoot -- host postgres"
wait
# Nodeport
p "#Nodeport DEMO"
pei "kubectl scale deployment app --replicas 6"
wait
pei "kubectl get pods -o wide -l app=app"
wait
pei "kubectl get pods -o wide -l app=app --watch"
wait
NODE1=$(kubectl get nodes kind-worker -o json | jq -r .status.addresses[0].address)
NODE2=$(kubectl get nodes kind-worker2 -o json | jq -r .status.addresses[0].address)
NODE3=$(kubectl get nodes kind-worker3 -o json | jq -r .status.addresses[0].address)
pei "kubectl apply -f service-nodeport.yml"
wait
pei "kubectl exec -it netshoot -- wget -q -O- \$NODE1:30040/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$NODE2:30040/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$NODE3:30040/host"
wait
# Cluster IP
p "#Cluster IP DEMO"
pei "kubectl apply -f service-clusterip.yml"
wait
pei "kubectl get service clusterip-service"
wait
pei "kubectl get endpoints clusterip-service"
wait
CLUSTER_IP=$(kubectl get service clusterip-service -o json | jq -r .spec.clusterIP)
CLUSTER_PORT=$(kubectl get service clusterip-service -o json | jq -r .spec.ports[0].port)
pei "kubectl exec -it netshoot -- wget -q -O- \$CLUSTER_IP:\$CLUSTER_PORT/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$CLUSTER_IP:\$CLUSTER_PORT/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$CLUSTER_IP:\$CLUSTER_PORT/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$CLUSTER_IP:\$CLUSTER_PORT/host"
pei "kubectl exec -it netshoot -- wget -q -O- \$CLUSTER_IP:\$CLUSTER_PORT/host"
wait
#Headless
p "#HEADLESS DEMO"
pei "kubectl apply -f service-headless.yml"
wait
pei "kubectl exec netshoot -- host -v -t a headless-service"
wait
pei "kubectl describe endpoints headless-service"
wait
# External Service
p "#HEADLESS DEMO"
pei "kubectl apply -f service-external.yml"
wait
pei "kubectl exec -it netshoot -- host -v -t a external-service"
wait
pei "kubectl exec -it netshoot -- host -v -t a github.com"
wait