diff --git a/inventory/sample/group_vars/k8s_cluster/k8s-net-cilium.yml b/inventory/sample/group_vars/k8s_cluster/k8s-net-cilium.yml index db827437e0f95c953392b1102a8759e052fc78c8..a583540bad24156c250f9f47fdc2da4ba7424658 100644 --- a/inventory/sample/group_vars/k8s_cluster/k8s-net-cilium.yml +++ b/inventory/sample/group_vars/k8s_cluster/k8s-net-cilium.yml @@ -163,6 +163,13 @@ cilium_l2announcements: false ### Enable auto generate certs if cilium_hubble_install: true # cilium_hubble_tls_generate: false +### Tune cilium_hubble_event_buffer_capacity & cilium_hubble_event_queue_size values to avoid dropping events when hubble is under heavy load +### Capacity of Hubble events buffer. The provided value must be one less than an integer power of two and no larger than 65535 +### (ie: 1, 3, ..., 2047, 4095, ..., 65535) (default 4095) +# cilium_hubble_event_buffer_capacity: 4095 +### Buffer size of the channel to receive monitor events. +# cilium_hubble_event_queue_size: 50 + # IP address management mode for v1.9+. # https://docs.cilium.io/en/v1.9/concepts/networking/ipam/ # cilium_ipam_mode: kubernetes diff --git a/roles/network_plugin/cilium/defaults/main.yml b/roles/network_plugin/cilium/defaults/main.yml index 2f4830a8ec6269e4470f8ab79f1e9b3e5c9e55dc..7e65e7faf7a6115fcd6db1c35d3e4f9f8502cf18 100644 --- a/roles/network_plugin/cilium/defaults/main.yml +++ b/roles/network_plugin/cilium/defaults/main.yml @@ -159,6 +159,12 @@ cilium_hubble_install: false ### Enable auto generate certs if cilium_hubble_install: true cilium_hubble_tls_generate: false +### Capacity of Hubble events buffer. The provided value must be one less than an integer power of two and no larger than 65535 +### (ie: 1, 3, ..., 2047, 4095, ..., 65535) (default 4095) +# cilium_hubble_event_buffer_capacity: 4095 +### Buffer size of the channel to receive monitor events. +# cilium_hubble_event_queue_size: 50 + # The default IP address management mode is "Cluster Scope". # https://docs.cilium.io/en/stable/concepts/networking/ipam/ cilium_ipam_mode: cluster-pool diff --git a/roles/network_plugin/cilium/tasks/check.yml b/roles/network_plugin/cilium/tasks/check.yml index c65591f66d34f14faed16979ae338c0afe8aa278..34a5afebb6bb0480bc9f17e7da0b639ec47aa9a2 100644 --- a/roles/network_plugin/cilium/tasks/check.yml +++ b/roles/network_plugin/cilium/tasks/check.yml @@ -61,3 +61,9 @@ when: - cilium_ipsec_enabled is defined - cilium_ipsec_enabled + +- name: Stop if cilium_hubble_event_buffer_capacity is not a power of 2 minus 1 and is not between 1 and 65535 + assert: + that: "cilium_hubble_event_buffer_capacity in [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535]" + msg: "Error: cilium_hubble_event_buffer_capacity:{{ cilium_hubble_event_buffer_capacity }} is not a power of 2 minus 1 and it should be between 1 and 65535." + when: cilium_hubble_event_buffer_capacity is defined diff --git a/roles/network_plugin/cilium/templates/cilium/config.yml.j2 b/roles/network_plugin/cilium/templates/cilium/config.yml.j2 index bdb07212bc58f280c63dbbb7d0008c210f4b7f36..ed37f122f2717685f3c18af1140e804bbacee898 100644 --- a/roles/network_plugin/cilium/templates/cilium/config.yml.j2 +++ b/roles/network_plugin/cilium/templates/cilium/config.yml.j2 @@ -192,6 +192,12 @@ data: {% for hubble_metrics_cycle in cilium_hubble_metrics %} {{ hubble_metrics_cycle }} {% endfor %} +{% endif %} +{% if cilium_hubble_event_buffer_capacity is defined %} + hubble-event-buffer-capacity: "{{ cilium_hubble_event_buffer_capacity }}" +{% endif %} +{% if cilium_hubble_event_queue_size is defined %} + hubble-event-queue-size: "{{ cilium_hubble_event_queue_size }}" {% endif %} hubble-listen-address: ":4244" {% if cilium_enable_hubble and cilium_hubble_install %}