github.com/looshlee/cilium@v1.6.12/examples/demo/demo5_top.sh (about) 1 #!/usr/bin/env bash 2 3 . $(dirname ${BASH_SOURCE})/../../contrib/shell/util.sh 4 5 dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 6 7 run "" 8 9 desc "Import kubernetes' network policy when kubernetes is ready" 10 run "${dir}/../../examples/kubernetes/0-policy.sh 300" 11 desc "Import guestbook's replication controller and service to kubernetes" 12 run "${dir}/../../examples/kubernetes/1-guestbook.sh 300" 13 desc "Success!" 14 desc "Wait until the guestbook's service is ready" 15 run "${dir}/../../tests/wait-for-docker.bash k8s_guestbook 100" 16 desc "Success!" 17 desc "Wait until the redis-slave's service is ready" 18 run "${dir}/../../tests/wait-for-docker.bash k8s_redis-slave 100" 19 desc "Success!" 20 desc "Wait until the redis-master's service is ready" 21 run "${dir}/../../tests/wait-for-docker.bash k8s_redis-master 100" 22 desc "Success!" 23 desc "" 24 desc "List the services which have been installed" 25 run "sudo cilium service list" 26 27 containerID=$(docker ps -aq --filter=name=k8s_guestbook) 28 desc "Ping will not work because we are not load balancing ICMP messages for the redis-master service" 29 run "docker exec -ti ${containerID} ping6 -c 2 redis-master" 30 31 run "cilium endpoint list" 32 redis_master_IP_dirty=$(docker exec -ti `docker ps -aq --filter=name=k8s_redis-master` sh -c "ip -6 a s | grep global | grep -oE \"${ipv6regex}\" ") 33 redis_master_IP=$(echo ${redis_master_IP_dirty}|tr -d '\r') 34 desc "Although it will work if we directly ping the redis-master container's IP" 35 run "docker exec -ti ${containerID} ping6 -c 2 ${redis_master_IP}" 36 37 desc "We are load balancing services, so we will \"ping\" the redis service on port 6379" 38 run "docker exec -ti ${containerID} sh -c 'nc redis-master 6379 <<EOF 39 PING 40 EOF'"