Created
December 21, 2020 07:12
-
-
Save jenting/a2820795cdae4aabcc0823c1ef0ad849 to your computer and use it in GitHub Desktop.
network-swiss-army-knife
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: overlaytest | |
spec: | |
selector: | |
matchLabels: | |
name: overlaytest | |
template: | |
metadata: | |
labels: | |
name: overlaytest | |
spec: | |
tolerations: | |
- operator: Exists | |
containers: | |
- image: leodotcloud/swiss-army-knife | |
imagePullPolicy: Always | |
name: overlaytest | |
command: ["sh", "-c", "tail -f /dev/null"] | |
terminationMessagePath: /dev/termination-log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
kubectl create -f overlaytest.yml | |
kubectl rollout status ds/overlaytest | |
echo "=> Start network overlay test" | |
kubectl get pods -l name=overlaytest -o jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.nodeName}{"\n"}{end}' | | |
while read spod shost | |
do kubectl get pods -l name=overlaytest -o jsonpath='{range .items[*]}{@.status.podIP}{" "}{@.spec.nodeName}{"\n"}{end}' | | |
while read tip thost | |
do kubectl --request-timeout='10s' exec $spod -c overlaytest -- /bin/sh -c "ping -c2 $tip > /dev/null 2>&1" | |
RC=$? | |
if [ $RC -ne 0 ] | |
then echo FAIL: $spod on $shost cannot reach pod IP $tip on $thost | |
else echo $shost can reach $thost | |
fi | |
done | |
done | |
echo "=> End network overlay test" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment