Splunk observability k8s auto instrumentation setup

From chambear2809/splunk-cisco-skills · View interactive version

Splunk observability k8s auto instrumentation setup is an AI agent skill from the GitHub repository chambear2809/splunk-cisco-skills. Use when wiring zero-code Java, Node.js, Python, .NET, Go, Apache, or Nginx instrumentation into Splunk Observability Cloud APM, adding AlwaysOn Profiling, discovering workloads, or reverting operator-managed instrumentation. Render, apply, verify, and uninstall Splunk/OpenTelemetry Operator auto-in

How to use this skill

Skill file

Splunk Observability Kubernetes Auto-Instrumentation

Prerequisites

| Tool or access | Purpose | Verify |

|---|---|---|

| Bash and Python 3 | Run bundled setup and validation helpers | bash --version && python3 --version |

| Required product/platform access | Inspect or configure the selected target | Complete the documented preflight |

| Credential files for live modes | Keep secrets out of chat | Verify paths only |

Workflow Overview

┌───────────┐   ┌───────────────┐   ┌───────────────┐   ┌─────────────────┐
│ Preflight │ → │ Render/review │ → │ Apply/handoff │ → │ Validate evidence │
└───────────┘   └───────────────┘   └───────────────┘   └─────────────────┘

When to Activate

APM, adding AlwaysOn Profiling, discovering workloads, or reverting operator-managed instrumentation.

Scope

Follow the documented read-only or render-first path whenever it is available.

This skill does not imply permission to mutate live systems. Require explicit

apply flags, protected credentials, and operator review for state changes.

Examples

Inspect the supported setup modes before selecting one:

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/setup.sh --help

Expected output: usage, supported modes, and required arguments are displayed

without changing the target environment.

Inspect validation modes before running completion checks:

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/validate.sh --help

Expected output: offline, live, and completion options are displayed when the

skill supports them; help exits without mutation.

Troubleshooting

| Issue | Cause | Resolution |

|---|---|---|

| Preflight fails | A required tool or access path is missing | Resolve it before rendering or applying |

| Rendered assets are incomplete | Required non-secret inputs are absent | Complete intake and render again |

| Apply is blocked | Review, credentials, or explicit acceptance is missing | Use the documented handoff |

| Validation is incomplete | Live evidence is unavailable | Record the gap and keep completion open |

This skill configures operator-driven, zero-code application auto-instrumentation for Kubernetes workloads that send traces, metrics, and profiling to Splunk Observability Cloud.

It is an overlay on top of splunk-observability-otel-collector-setup. That skill installs the Splunk OTel Collector chart, which in turn installs the OpenTelemetry Operator, the Instrumentation / OpenTelemetryCollector CRDs, and (optionally) a chart-managed default Instrumentation custom resource. This skill takes over from there: it renders one or more fully-configured Instrumentation custom resources per language, writes workload annotation patches that the operator mutating webhook reacts to, and drives the full lifecycle (apply, verify, uninstall).

What it renders

Safety Rules

Primary Workflow

  1. Confirm the base collector + operator are installed. If not, run splunk-observability-otel-collector-setup first. The rendered handoff-collector.sh carries the exact command.
  1. (Optional) Discover candidate workloads. This is read-only; no cluster mutation:

```bash

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/setup.sh \

--discover-workloads \

--realm us0 \

--cluster-name prod-cluster

```

Then edit splunk-observability-k8s-auto-instrumentation-rendered/discovery/workloads.yaml to mark each workload with its language.

  1. Render the overlay assets:

The CLI-only path is the default; template.example is loaded only when

explicitly passed with --spec. This prevents example workloads or policy

settings from contaminating an operator's CLI render.

```bash

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/setup.sh \

--render \

--realm us0 \

--cluster-name prod-cluster \

--deployment-environment prod \

--languages java,nodejs,python \

--profiling-enabled \

--runtime-metrics-enabled \

--annotate-workload Deployment/prod/payments-api=java \

--annotate-workload Deployment/prod/checkout-web=nodejs \

--annotate-workload Deployment/prod/fraud-score=python

```

  1. Review splunk-observability-k8s-auto-instrumentation-rendered/:
  1. Apply the Instrumentation CR(s) first:

```bash

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/setup.sh \

--apply-instrumentation \

--accept-auto-instrumentation \

--kube-context prod-cluster-admin

```

  1. Apply annotations + rollout restart:

```bash

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/setup.sh \

--apply-annotations \

--accept-auto-instrumentation \

--kube-context prod-cluster-admin \

--target-all

```

  1. Verify injection:

```bash

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/validate.sh \

--check-injection \

--kube-context prod-cluster-admin

```

Annotation Model

The OpenTelemetry Operator reacts to pod annotations placed at spec.template.metadata.annotations on Deployment / StatefulSet / DaemonSet objects (or at the namespace level). This skill writes strategic-merge patches that target only spec.template.metadata.annotations; it never touches top-level metadata.annotations.

Supported annotations:

See references/annotation-catalog.md for the full surface, references/annotation-surgery.md for the patching mechanics, and references/instrumentation-cr-reference.md for CR field semantics.

Namespace-level live contract

For each rendered namespace target, live validation requires the Namespace's

managed annotations to match metadata exactly. Every non-terminating pod whose

phase is not Succeeded or Failed remains in scope and must be Running,

Ready, and carry the expected language evidence. A pod-level

inject-<language>: "false" is the only exclusion and is itself audited for

stale injection artifacts. A pod-level explicit CR value remains in scope and

is validated against that rendered CR. Terminal and deleting pods are reported

as excluded. A namespace with no active pods fails closed because it provides

no production evidence.

namespace-annotations.yaml is declarative input for GitOps or a separately

reviewed kubectl apply; the imperative apply-annotations.sh target selector

continues to mutate only explicitly rendered workloads.

OBI Behavior

--enable-obi emits an owned ServiceAccount and Splunk OpenTelemetry Zero-code (OBI) DaemonSet with privileged: true, hostPath mounts for /sys/kernel/security and /sys/fs/cgroup, Linux-node selection, and a kernel-≥5.8 requirement. OBI is eBPF-based and instruments compiled binaries (Go, C, Rust) without code or annotation changes. Apply requires --accept-obi-privileged. Because this repository has no audited default for the standalone OBI container contract, render also requires --obi-image ...@sha256:<digest>; tag-only --obi-version input fails closed. On OpenShift, openshift-scc-obi.yaml renders automatically. --check-obi proves the exact digest/config, controller rollout, one Ready OBI pod on every supported Ready schedulable Linux node, and a bounded 10-minute/200-line fatal-rule log window. uninstall.sh --purge-obi verifies exact ownership/config before deleting DaemonSet, optional SCC, then ServiceAccount.

See references/obi-ebpf.md.

Multi-CR / Multi-Environment

When the spec lists more than one Instrumentation CR (e.g. different samplers for dev vs prod), each workload annotation binds to a specific CR via cr=<ns>/<crname>. The OpenTelemetry Operator supports distinct named resources; this overlay does not claim or mutate a separate chart feature gate. Multiple language rows for one workload are intentionally merged into one manifest; duplicate workload/language rows or conflicting shared annotations fail closed.

This skill always renders an explicit <namespace>/<crname> value, including

for the default CR, so cross-namespace workloads never depend on the ambiguous

bare "true" lookup. --namespace overrides every rendered CR namespace;

--instrumentation-cr-name is accepted only for a single-CR render.

Instrumentation image policy

Java, Node.js, Python, .NET, Go, and Apache HTTPD defaults are immutable

@sha256 pins copied from the base Collector skill's chart-0.158.0 audited

image ledger. Custom image overrides must also be digest-pinned. This

repository has no audited Nginx default image, so Nginx fails closed until the

operator supplies a reviewed --nginx-image ...@sha256:<digest> override.

Hand-offs

Out of scope

Validation

bash skills/splunk-observability-k8s-auto-instrumentation-setup/scripts/validate.sh

Static checks cover:

injection contract exactly matches instrumentation-cr.yaml.

metadata contract exactly matches the rendered ServiceAccount/DaemonSet/SCC.

--live --check-apm <service> runs the complete production gate. It enables

webhook, Instrumentation CR, injection, backup, optional OBI, and scoped APM checks. A caller

may explicitly omit only the APM or backup gate with --skip-apm-check or

--skip-backup-check; those named skips are valid only with --live. Individual

--check-* flags remain available as narrow diagnostics.

Service and ready 9443/TCP EndpointSlice (with a legacy Endpoints fallback

only when EndpointSlice is unavailable or empty), Ready Operator pods, and recent webhook

error log scan. This proves Kubernetes routing state but does not synthesize

an admission request or perform a separate TLS handshake.

Every requested live check is fail-closed: a missing tool, credential,

resource, injected pod, backup, API response, or exact APM service is a

validation failure. The composed AWS/EKS/O11y staging gate is documented in

CODE0.

See reference.md for the full CLI flag reference and the thirteen references/*.md annexes for deep topical documentation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.