github.com/looshlee/cilium@v1.6.12/examples/demo/demo3.sh (about) 1 #!/usr/bin/env bash 2 3 . $(dirname ${BASH_SOURCE})/../../contrib/shell/util.sh 4 5 NETWORK="cilium" 6 CLIENT_LABEL="id.client" 7 SERVER_LABEL="id.server" 8 9 function cleanup { 10 tmux kill-session -t my-session >/dev/null 2>&1 11 docker rm -f client server 2> /dev/null || true 12 } 13 14 trap cleanup EXIT 15 16 docker network rm $NETWORK > /dev/null 2>&1 17 docker network create --ipv6 --subnet ::1/112 --driver cilium --ipam-driver cilium $NETWORK > /dev/null 18 cilium policy delete --all 19 20 desc "Policy enforcement is disabled by default, enable it." 21 run "cilium config PolicyEnforcement=always" 22 23 desc "How to debug a connectivity issue?" 24 desc "Start client and server containers" 25 run "docker run -d --net cilium --name server -l $SERVER_LABEL tgraf/netperf" 26 run "docker run -d --net cilium --name client -l $CLIENT_LABEL tgraf/netperf" 27 sleep 2 28 29 SERVER_ID=$(cilium endpoint list | grep $SERVER_LABEL | awk '{ print $1}') 30 CLIENT_ID=$(cilium endpoint list | grep $CLIENT_LABEL | awk '{ print $1}') 31 cilium endpoint config $CLIENT_ID debug=false 32 cilium endpoint config $SERVER_ID debug=false 33 34 run "cilium endpoint list" 35 36 SERVER_IP=$(docker inspect --format '{{ .NetworkSettings.Networks.cilium.GlobalIPv6Address }}' server) 37 desc "Situation: Ping doesn't work, now what?" 38 run "docker exec -ti client ping6 -c 2 $SERVER_IP" 39 40 tmux new -d -s my-session \ 41 "$(dirname ${BASH_SOURCE})/demo3_top.sh" \; \ 42 split-window -v -d "$(dirname $BASH_SOURCE)/demo3_bottom.sh" \; \ 43 attach \; 44 45 desc "Clean up" 46 run "docker rm -f server client"