Page MenuHomeSoftware Heritage
Paste P1350

test-inter-node-network.sh
ActivePublic

Authored by ardumont on Apr 26 2022, 11:28 AM.
#!/usr/bin/env bash
# set -x
export KUBECONFIG=staging-workers.yaml
kubectl create -f overlay-test.yaml
# kubectl rollout status ds/overlaytest
# > should diplay
# daemon set "overlaytest" successfully rolled out
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

Event Timeline

overlay-test.yaml:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: overlaytest
spec:
  selector:
      matchLabels:
        name: overlaytest
  template:
    metadata:
      labels:
        name: overlaytest
    spec:
      tolerations:
      - operator: Exists
      containers:
      - image: rancherlabs/swiss-army-knife
        imagePullPolicy: Always
        name: overlaytest
        command: ["sh", "-c", "tail -f /dev/null"]
        terminationMessagePath: /dev/termination-log
ardumont changed the title of this paste from test-inter-node.sh to test-inter-node-network.sh.Apr 26 2022, 11:29 AM

staging-workers.yaml is retrieved out of [1], 'Download Kube Config' button.

[1] https://rancher.euwest.azure.internal.softwareheritage.org/dashboard/c/c-t85mz/explorer#cluster-events