-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnetshoot-privileged-with-host.sh
57 lines (53 loc) · 1.17 KB
/
netshoot-privileged-with-host.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
#!/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 --rm -i --tty --overrides='{
"spec": {
"hostNetwork": true,
"nodeName": "'$NODE'",
"containers": [{
"args": [
"/bin/bash"
],
"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
}]
}],
"volumes": [{
"hostPath": {
"path": "/",
"type": ""
},
"name": "host-slash"
}]
}
}' --image nicolaka/netshoot -- /bin/bash