-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflush-gn-iptable-chains.sh
59 lines (55 loc) · 1.33 KB
/
flush-gn-iptable-chains.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
#!/bin/sh
NODE=$1
if [[ "$CONTEXT" != "" ]]; then
CONTEXT="--context ${CONTEXT}"
fi
if [[ x"$NODE" == x ]]; then
echo please provide a node name as the first argument
echo ""
kubectl $CONTEXT get nodes -o wide
echo ""
echo "submariner gws:"
echo ""
kubectl $CONTEXT get nodes -o wide -l submariner.io/gateway=true
exit 1
fi
kubectl $CONTEXT --v=4 run netshoot-hostmount-$(uuidgen) --generator=run-pod/v1 --overrides='{
"spec": {
"hostNetwork": true,
"nodeName": "'$NODE'",
"containers": [{
"args": [
"/bin/bash", "-c",
"iptables -t nat -F SUBMARINER-GN-EGRESS; iptables -t nat -F SUBMARINER-GN-INGRESS; iptables -t nat -F SUBMARINER-GN-MARK;"
],
"stdin": true,
"stdinOnce": true,
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"tty": true,
"securityContext": {
"allowPrivilegeEscalation": true,
"privileged": true,
"runAsUser": 0,
"capabilities": {
"add": ["ALL"]
}
},
"name": "netshoot-hostmount",
"image": "nicolaka/netshoot",
"volumeMounts": [{
"mountPath": "/host",
"name": "host-slash",
"readOnly": true
}]
}],
"restartPolicy": "Never",
"volumes": [{
"hostPath": {
"path": "/",
"type": ""
},
"name": "host-slash"
}]
}
}' --image nicolaka/netshoot -- /bin/bash