Skip to content

Commit 45e11b2

Browse files
authored
feat: Added the ability to deploy monitoring agent with universal eBPF enabled. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/tree/main/solutions/fully-configurable/DA-docs.md) (#133)
1 parent 2974500 commit 45e11b2

File tree

10 files changed

+50
-5
lines changed

10 files changed

+50
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ No modules.
121121
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | The ID of the cluster you wish to deploy the agent in | `string` | n/a | yes |
122122
| <a name="input_cluster_resource_group_id"></a> [cluster\_resource\_group\_id](#input\_cluster\_resource\_group\_id) | The Resource Group ID of the cluster | `string` | n/a | yes |
123123
| <a name="input_container_filter"></a> [container\_filter](#input\_container\_filter) | To filter custom containers, specify which containers to include or exclude from metrics collection for the cloud monitoring agent. See https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_filter_data. | <pre>list(object({<br/> type = string<br/> parameter = string<br/> name = string<br/> }))</pre> | `[]` | no |
124+
| <a name="input_enable_universal_ebpf"></a> [enable\_universal\_ebpf](#input\_enable\_universal\_ebpf) | Deploy monitoring agent with universal eBPF enabled. It requires kernel version 5.8+. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/tree/main/solutions/fully-configurable/DA-docs.md). | `bool` | `true` | no |
124125
| <a name="input_existing_access_key_secret_name"></a> [existing\_access\_key\_secret\_name](#input\_existing\_access\_key\_secret\_name) | An alternative to using the Sysdig Agent `access_key`. Specify the name of a Kubernetes secret containing an access-key entry. Either `access_key` or `existing_access_key_secret_name` is required. | `string` | `null` | no |
125126
| <a name="input_image_registry_base_url"></a> [image\_registry\_base\_url](#input\_image\_registry\_base\_url) | The image registry base URL to pull the Cloud Monitoring agent images from. For example `icr.io`, `quay.io`, etc. | `string` | `"icr.io"` | no |
126127
| <a name="input_image_registry_namespace"></a> [image\_registry\_namespace](#input\_image\_registry\_namespace) | The namespace within the image registry to pull the Cloud Monitoring agent images from. | `string` | `"ext/sysdig"` | no |

examples/obs-agent-iks/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,5 @@ module "monitoring_agents" {
110110
# # Monitoring agent
111111
access_key = module.cloud_monitoring.access_key
112112
cloud_monitoring_instance_region = var.region
113+
enable_universal_ebpf = true
113114
}

examples/obs-agent-ocp/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ locals {
5454
subnet_prefix = "default"
5555
pool_name = "default" # ibm_container_vpc_cluster automatically names default pool "default" (See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/2849)
5656
machine_type = "bx2.4x16"
57-
operating_system = "REDHAT_8_64"
57+
operating_system = "RHEL_9_64"
5858
workers_per_zone = 2 # minimum of 2 is allowed when using single zone
5959
}
6060
]
@@ -107,7 +107,8 @@ module "monitoring_agents" {
107107
access_key = module.cloud_monitoring.access_key
108108
cloud_monitoring_instance_region = var.region
109109
# example of how to include / exclude metrics - more info https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_log_metrics
110-
metrics_filter = [{ exclude = "metricA.*" }, { include = "metricB.*" }]
111-
container_filter = [{ type = "exclude", parameter = "kubernetes.namespace.name", name = "kube-system" }]
112-
blacklisted_ports = [22, 2379, 3306]
110+
metrics_filter = [{ exclude = "metricA.*" }, { include = "metricB.*" }]
111+
container_filter = [{ type = "exclude", parameter = "kubernetes.namespace.name", name = "kube-system" }]
112+
blacklisted_ports = [22, 2379, 3306]
113+
enable_universal_ebpf = true
113114
}

ibm_catalog.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@
259259
},
260260
{
261261
"key": "wait_till_timeout"
262+
},
263+
{
264+
"key": "enable_universal_ebpf"
262265
}
263266
],
264267
"install_type": "fullstack"

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ resource "helm_release" "cloud_monitoring_agent" {
131131
type = "string"
132132
value = regex("@(.*)", var.kernel_module_image_tag_digest)[0]
133133
}
134+
set {
135+
name = "agent.ebpf.enabled"
136+
value = var.enable_universal_ebpf
137+
}
138+
139+
set {
140+
name = "agent.ebpf.kind"
141+
value = "universal_ebpf"
142+
}
134143
# Specific to SCC WP, enabled by default
135144
set {
136145
name = "nodeAnalyzer.enabled"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## When to Enable `enable_universal_ebpf`
2+
3+
For Clusters using Red Hat CoreOS (RHCOS) or RHEL 9 nodes with restricted outbound internet access, the monitoring agent pods may fail to start due to the inability to retrieve kernel modules which are necessary for the agent to connect with kernel.
4+
5+
Setting the input variable `enable_universal_ebpf` to `true` ensures the agent uses eBPF-based instrumentation, which avoids the need for external downloads and allows successful deployment in restricted environments.
6+
7+
### When Should You Enable It?
8+
9+
Set `enable_universal_ebpf` to true if:
10+
11+
- Your cluster nodes run on RHCOS or RHEL 9 and do not have public or outbound internet access.
12+
- You want to avoid relying on dynamic downloads for kernel modules.
13+
14+
### Kernel Compatibility
15+
16+
- **RHCOS and RHEL9**: Since kernel version **5.14 or later** is used. Default value for variable has been set to true.
17+
- **RHEL 8**: Although it uses kernel version **4.18**, the necessary kernel headers are pre-installed, so enabling eBPF is safe and has no impact.

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ module "monitoring_agent" {
4242
agent_limits_memory = var.agent_limits_memory
4343
agent_requests_cpu = var.agent_requests_cpu
4444
agent_requests_memory = var.agent_requests_memory
45+
enable_universal_ebpf = var.enable_universal_ebpf
4546
}

solutions/fully-configurable/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,9 @@ variable "agent_limits_memory" {
232232
description = "Specifies the memory limit for the agent."
233233
default = "1024Mi"
234234
}
235+
236+
variable "enable_universal_ebpf" {
237+
type = bool
238+
description = "Deploy monitoring agent with universal eBPF enabled. It requires kernel version 5.8+. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/tree/main/solutions/fully-configurable/DA-docs.md)."
239+
default = true
240+
}

tests/resources/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ locals {
5555
pool_name = "default" # ibm_container_vpc_cluster automatically names default pool "default" (See https://github.com/IBM-Cloud/terraform-provider-ibm/issues/2849)
5656
machine_type = "bx2.4x16"
5757
workers_per_zone = 2 # minimum of 2 is allowed when using single zone
58-
operating_system = "REDHAT_8_64"
58+
operating_system = "RHCOS"
5959
}
6060
]
6161
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ variable "agent_limits_memory" {
256256
description = "Specifies the memory limit for the agent."
257257
default = "1024Mi"
258258
}
259+
260+
variable "enable_universal_ebpf" {
261+
type = bool
262+
description = "Deploy monitoring agent with universal eBPF enabled. It requires kernel version 5.8+. [Learn more](https://github.com/terraform-ibm-modules/terraform-ibm-monitoring-agent/tree/main/solutions/fully-configurable/DA-docs.md)."
263+
default = true
264+
}

0 commit comments

Comments
 (0)