Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions cmd/agent/dist/conf.d/kata_containers.d/conf.yaml.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ad_identifiers:
- _kata_containers
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See conversation in slack: https://dd.slack.com/archives/C4TQDFK1P/p1776958386678999?thread_ts=1776947531.092389&cid=C4TQDFK1P

I don't know that the inclusion of this file should be part of this PR, but this file specifically should not be added to this repo without a corresponding entry in https://github.com/DataDog/integrations-core (or, at least, a corresponding PR in that repo)

Copy link
Copy Markdown
Author

@TheRayquaza TheRayquaza Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I added a draft PR for the kata container integration:
DataDog/integrations-core#23465

init_config:
instances:
-
## @param sandbox_storage_paths - list of strings - optional - default: ["/run/vc/sbs", "/run/kata"]
## Directories to scan for Kata shim sockets. When running the Agent in a container,
## host paths are typically mounted under /host — both variants are listed here so the
## check works without manual configuration in either deployment mode.
#
sandbox_storage_paths:
- /host/run/vc/sbs
- /host/run/kata

## @param tags - list of strings following the pattern: "key:value" - optional
## List of tags to attach to every metric, event, and service check emitted by this integration.
##
## Learn more about tagging: https://docs.datadoghq.com/tagging/
#
# tags:
# - <KEY_1>:<VALUE_1>
# - <KEY_2>:<VALUE_2>
1 change: 1 addition & 0 deletions comp/core/autodiscovery/listeners/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (l *EnvironmentListener) createServices() {
"kube_orchestrator": env.KubeOrchestratorExplorer,
"kubelet_config_orchestrator": env.KubeletConfigOrchestratorCheck,
"ecs_orchestrator": env.ECSOrchestratorExplorer,
"kata_containers": env.KataContainers,
}

for name, feature := range features {
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/env/environment_container_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ const (
// NonstandardCRIRuntime is a fallback value for when customers supply a CRI compliant runtime via the
// cri_socket_path configuration field
NonstandardCRIRuntime = "nonstandard-cri-runtime"
// KataContainers sandbox storage paths present
KataContainers Feature = "kata_containers"
)
24 changes: 24 additions & 0 deletions pkg/config/env/environment_containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func init() {
registerFeature(KubernetesDevicePlugins)
registerFeature(NVML)
registerFeature(NonstandardCRIRuntime)
registerFeature(KataContainers)
}

// IsAnyContainerFeaturePresent checks if any of known container features is present
Expand Down Expand Up @@ -82,6 +83,7 @@ func detectContainerFeatures(features FeatureMap, cfg model.Reader) {
detectPodResources(features, cfg)
detectDevicePlugins(features, cfg)
detectNVML(features, cfg)
detectKata(features)
}

func detectKubernetes(features FeatureMap, cfg model.Reader) {
Expand Down Expand Up @@ -342,6 +344,16 @@ func detectNVML(features FeatureMap, cfg model.Reader) {
log.Debugf("Agent did not find NVML library in any of the default paths: %v", defaultPaths)
}

func detectKata(features FeatureMap) {
for _, basePath := range getDefaultKataPaths() {
if _, err := os.Stat(basePath); err == nil {
features[KataContainers] = struct{}{}
log.Infof("Agent found Kata Containers sandbox path at: %s", basePath)
return
}
}
}

func getHostMountPrefixes() []string {
if IsContainerized() {
return []string{"", defaultHostMountPrefix}
Expand Down Expand Up @@ -423,6 +435,18 @@ func getDefaultNvmlPaths() []string {
return paths
}

func getDefaultKataPaths() []string {
var defaultKataSandboxPaths = []string{"/host/run/vc/sbs", "/host/run/kata"}
Comment thread
TheRayquaza marked this conversation as resolved.

paths := make([]string, 0, len(getHostMountPrefixes())*len(defaultKataSandboxPaths))
for _, prefix := range getHostMountPrefixes() {
for _, p := range defaultKataSandboxPaths {
paths = append(paths, path.Join(prefix, p))
}
}
return paths
}

// merge merges and dedupes 2 slices without changing order
func merge(s1, s2 []string) []string {
dedupe := map[string]struct{}{}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
features:
- |
Add automatic discovery of Kata Containers environments. The Agent now detects
the presence of Kata sandbox paths (``/host/run/vc/sbs``, ``/host/run/kata``) at startup
and automatically enables the ``kata_containers`` check without manual
configuration.
Loading