title: Set burst for bandwidth limit for a pod
body: <p>For what I know, there're two way to limit bandwidth with k8s. </p>
  
  <p>First, configure the CNI with</p>
  
  <pre><code>{
     "type": "bandwidth",
     "capabilities": {"bandwidth": true},
     "ingressRate": 10000000,
     "ingressBurst": 10000000,
     "egressRate": 10000000,
     "egressBurst": 10000000
  }
  </code></pre>
  
  <p>And second, annotate a pod with:</p>
  
  <pre><code>annotations:
    kubernetes.io/ingress-bandwidth: 8M
    kubernetes.io/egress-bandwidth: 8M
  </code></pre>
  
  <p>I read through the documentations but didn't find any way to configure burst for a pod.</p>
  
  <p>But the default burst is too large to make the limitation useful:</p>
  
  <p><code>qdisc tbf 1: dev calia2333445823 root refcnt 2 rate 8Mbit burst 256Mb lat 25.0ms</code></p>
  
  <p>And it seems when the CNI is configured with bandwidth limit, then pod annotations will not override the CNI's configure and take effect. </p>
  
  <p>So how can I set a burst for just a pod?</p>
  
  <hr>
  
  <p>iperf output to illustrate the burst:</p>
  
  <p>server:</p>
  
  <pre><code>Accepted connection from 192.168.0.34, port 49470
  [  5] local 192.168.203.129 port 1234 connected to 192.168.0.34 port 49472
  [ ID] Interval           Transfer     Bandwidth
  [  5]   0.00-1.00   sec   246 MBytes  2060541 Kbits/sec                  (omitted)
  [  5]   1.00-2.00   sec   935 KBytes  7657 Kbits/sec                  (omitted)
  [  5]   2.00-3.00   sec   933 KBytes  7645 Kbits/sec                  (omitted)
  [  5]   0.00-1.00   sec   935 KBytes  7655 Kbits/sec
  [  5]   1.00-2.00   sec   935 KBytes  7659 Kbits/sec
  [  5]   2.00-3.00   sec   935 KBytes  7655 Kbits/sec
  [  5]   3.00-4.00   sec   933 KBytes  7645 Kbits/sec
  [  5]   4.00-5.00   sec   932 KBytes  7637 Kbits/sec
  [  5]   5.00-6.00   sec   935 KBytes  7657 Kbits/sec
  [  5]   6.00-7.00   sec   936 KBytes  7667 Kbits/sec
  [  5]   7.00-8.00   sec   932 KBytes  7632 Kbits/sec
  [  5]   8.00-9.00   sec   935 KBytes  7659 Kbits/sec
  [  5]   9.00-10.00  sec   933 KBytes  7647 Kbits/sec
  [  5]  10.00-11.00  sec   935 KBytes  7654 Kbits/sec
  [  5]  11.00-11.15  sec   141 KBytes  7582 Kbits/sec
  - - - - - - - - - - - - - - - - - - - - - - - - -
  [ ID] Interval           Transfer     Bandwidth
  [  5]   0.00-11.15  sec  0.00 Bytes  0.00 Kbits/sec                  sender
  [  5]   0.00-11.15  sec  10.2 MBytes  7650 Kbits/sec                  receiver
  </code></pre>
  
  <p>client:</p>
  
  <pre><code>[  4] local 192.168.0.34 port 49472 connected to 192.168.203.129 port 1234
  [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
  [  4]   0.00-1.00   sec   247 MBytes  2073202 Kbits/sec    0    324 KBytes       (omitted)
  [  4]   1.00-2.00   sec   700 KBytes  5732 Kbits/sec    0    366 KBytes       (omitted)
  [  4]   2.00-3.00   sec  1.55 MBytes  13037 Kbits/sec    0    407 KBytes       (omitted)
  [  4]   0.00-1.00   sec   891 KBytes  7291 Kbits/sec    0    448 KBytes
  [  4]   1.00-2.00   sec   954 KBytes  7821 Kbits/sec    0    491 KBytes
  [  4]   2.00-3.00   sec  1018 KBytes  8344 Kbits/sec    0    532 KBytes
  [  4]   3.00-4.00   sec  1.06 MBytes  8858 Kbits/sec    0    573 KBytes
  [  4]   4.00-5.00   sec  1.18 MBytes  9897 Kbits/sec    0    615 KBytes
  [  4]   5.00-6.00   sec  1.24 MBytes  10433 Kbits/sec    0    656 KBytes
  [  4]   6.00-7.00   sec  1.25 MBytes  10487 Kbits/sec    0    697 KBytes
  [  4]   7.00-8.00   sec  1.25 MBytes  10488 Kbits/sec    0    766 KBytes
  [  4]   8.00-9.00   sec  0.00 Bytes  0.00 Kbits/sec    0    899 KBytes
  [  4]   9.00-10.00  sec  1.25 MBytes  10485 Kbits/sec    0   1.03 MBytes
  - - - - - - - - - - - - - - - - - - - - - - - - -
  [ ID] Interval           Transfer     Bandwidth       Retr
  [  4]   0.00-10.00  sec  10.0 MBytes  8410 Kbits/sec    0             sender
  [  4]   0.00-10.00  sec  10.2 MBytes  8532 Kbits/sec                  receiver
  </code></pre>
  
  <hr>
  
  <p>Environment:</p>
  
  <ul>
  <li>Kubernetes 1.15.7</li>
  <li>Calico v3.11.1</li>
  <li>bandwidth plugin v0.8.0</li>
  <li>tc iproute 4.11.0-14.el7</li>
  </ul>