-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpod-demo.sh
executable file
·78 lines (50 loc) · 1.45 KB
/
pod-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 "cat pod.yml"
wait
pei "kubectl apply -f pod.yml,netshoot.yml"
pei "kubectl get pods --watch"
wait
pei "kubectl get pods -o wide"
wait
pei "kubectl exec -it bb1 -c bb1 -- curl -s localhost:80"
wait
BB3_ADR=$(kubectl get pods bb3 -o json | jq .status.podIP -r)
p "BB3_ADR=\$(kubectl get pods bb3 -o json | jq .status.podIP -r)"
pei "kubectl exec -it bb1 -c bb1 -- ping -c 4 \$BB3_ADR"
wait
NODE=$(kubectl get pods bb1 -o json | jq .spec.nodeName -r)
BB1_ADR=$(kubectl get pods bb1 -o json | jq .status.podIP -r)
CNI=$(docker exec kind-worker ip netns list | awk '{print $1}')
p "NODE=\$(kubectl get pods bb1 -o json | jq .spec.nodeName -r)"
p "BB1_ADR=\$(kubectl get pods bb1 -o json | jq .status.podIP -r)"
pei "docker exec \$NODE curl -s \$BB1_ADR"
wait
pei "docker exec \$NODE ip netns list"
wait
pei "docker exec \$NODE ip a"
wait
p "CNI=\$(docker exec \$NODE ip netns list)"
pei "docker exec \$NODE ip netns exec \$CNI ip a"
wait
pei "kubectl delete -f pod.yml"