Edge Delta Kubernetes Input

Monitor Kubernetes pods and namespaces.

Overview

You can use the Kubernetes Input node to specify which Kubernetes pods and namespaces the agent should monitor.

Example Configuration

nodes:
  - name: my_k8s_input
    type: kubernetes_input
    include:
      - k8s.namespace.name=.*
    exclude:
      - k8s.namespace.name=kube-system
      - k8s.namespace.name=kube-public
      - k8s.namespace.name=kube-node-lease
      - k8s.pod.name=edgedelta
      - k8s.pod.name=prometheus
      - k8s.pod.name=promtail
      - k8s.pod.name=node-exporter

The Include and Exclude examples use item names from the OTEL schema. OTEL requires agent version 0.1.81 or higher. Previous agent versions used the legacy schema, for example k8s_pod_name, which is still supported in agent versions after 0.1.81.

Controlling Ingestion Based on Object Tenancy

Each include/exclude line prefaced with a - is a complete object reference, and each object is treated as a complete set of selection criteria. For example, this configuration will exclude all telemetry data from namespace nginx and all pods that start with webserver anywhere in the cluster:

    exclude:
      - k8s.namespace.name=nginx
      - k8s.pod.name=webserver.*

However the following configuration will only exclude telemetry data from pods prefaced with webserver when they exist in the namespace nginx. webserver.* pods that exist in other namespaces will not be excluded in this example:

    exclude:
      - k8s.namespace.name=nginx,k8s.pod.name=webserver.*

Required Parameters

name

A descriptive name for the node. This is the name that will appear in Visual Pipelines and you can reference this node in the yaml using the name. It must be unique across all nodes. It is a yaml list element so it begins with a - and a space followed by the string. It is a required parameter for all nodes.

nodes:
  - name: <node name>
    type: <node type>

type: kubernetes_input

The type parameter specifies the type of node being configured. It is specified as a string from a closed list of node types. It is a required parameter.

nodes:
  - name: <node name>
    type: <node type>

include

The include parameter is used to specify the scope of traffic sources to be ingested. It is specified in OTEL format with Golang regex or full text. If exclude is also specified, then logs matching in include are passed unless they are dropped by exclude. Include is required.

nodes:
  - name: <node name>
    type: kubernetes_input
    include:
    - k8s.namespace.name=.*

The following values can be included in the scope for a Kubernetes input:

  • k8s.pod.name
  • k8s.namespace.name
  • k8s.cronjob.name
  • k8s.daemonset.name
  • k8s.deployment.name
  • k8s.job.name
  • k8s.replicaset.name
  • k8s.statefulset.name
  • k8s.pod.labels.{labels]
  • k8s.container.name
  • container.image.name

For example:

  • k8s.namespace.name=.*
  • k8s.namespace.name=kube-system
  • k8s.namespace.name=nginx,k8s.deployment.name=nginx-canary.*

You can use k8s.{kind}.name=.+ rather than k8s.controller.kind=xxx (which is no longer supported), where the values of {kind} match the Kubernetes kind, such as k8s.daemonset.name, k8s.deployment.name, k8s.job.name, etc.

Optional Parameters

exclude

The exclude parameter is used to excluded traffic from certain components from being ingested. It is specified in OTEL format with Golang regex or full text. If exclude is specified it drops logs that match its Golang regex rules. Comma separated values indicate AND rules, while separate rules indicate OR matching. In this example logs that match rule-1 and rule-2 are excluded. Logs that match rule-3 are also excluded. A log matching only rule-1 would not be excluded. Exclude is optional.

  • If include is specified as well as exclude, then logs matching in include are passed unless they are dropped by exclude.
nodes:
  - name: <node name>
    type: kubernetes_input
    include:
    - k8s.namespace.name=.*
    exclude:
    - k8s.namespace.name=kube-system

The following values can be excluded from a Kubernetes input:

  • k8s.pod.name
  • k8s.namespace.name
  • k8s.cronjob.name
  • k8s.daemonset.name
  • k8s.deployment.name
  • k8s.job.name
  • k8s.replicaset.name
  • k8s.statefulset.name
  • k8s.pod.labels.{labels]
  • k8s.container.name
  • container.image.name

For example:

  • k8s.namespace.name=.*
  • k8s.namespace.name=kube-system
  • k8s.namespace.name=nginx,k8s.deployment.name=nginx-canary.*

You can use k8s.{kind}.name=.+ rather than k8s.controller.kind=xxx (which is no longer supported), where the values of {kind} match the Kubernetes kind, such as k8s.daemonset.name, k8s.deployment.name, k8s.job.name, etc.

line_pattern

The line_pattern parameter YAML only parameter specifies a Golang regex pattern that will be used as a line break rather than using a new line. It is specified with a Golang regex pattern, including a ^ for the line start, and it is optional.

nodes:
  - name: <node name>
    type: <node type>
    line_pattern: ^\d{4}-\d{2}-\d{2} 

See Also

Exclude 5 Namespaces