github.com/looshlee/cilium@v1.6.12/examples/demo/demo1.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  . $(dirname ${BASH_SOURCE})/../../contrib/shell/util.sh
     4  
     5  NETWORK="cilium"
     6  CLIENT_LABEL="client"
     7  
     8  function cleanup {
     9  	docker rm -f demo1 2> /dev/null || true
    10  }
    11  
    12  trap cleanup EXIT
    13  
    14  docker network rm $NETWORK > /dev/null 2>&1
    15  
    16  desc "Demo: Start a container and examine network configuration"
    17  desc ""
    18  desc "Create network \"cilium\""
    19  desc "This step is only required once, all containers can be attached to the same network,"
    20  desc "thus creating a single flat network. Isolation can then be defined based on labels."
    21  run "docker network create --ipv6 --subnet ::1/112 --driver cilium --ipam-driver cilium $NETWORK"
    22  
    23  desc "Start a container"
    24  run "docker run -d --net cilium --name demo1 -l $CLIENT_LABEL tgraf/netperf"
    25  
    26  desc "Examine network configuration of container"
    27  desc "The container was allocated a unique IPv6 address from the node prefix"
    28  run "docker exec -ti demo1 ip -6 address list"
    29  
    30  desc "All traffic uses a single default route pointing to the node's address"
    31  run "docker exec -ti demo1 ip -6 route list dev cilium0"
    32  
    33  desc "Examine list of local cilium endpoints"
    34  run "cilium endpoint list"
    35  
    36  desc "Clean up"
    37  run "docker rm -f demo1"