IMVEEDev Portal

Kubernetes DaemonSet

The Satellite Agent can be deployed as a DaemonSet in Kubernetes, so that one agent instance runs automatically on every node of the cluster.


Dockerfile.k8s

The repository contains a dedicated Dockerfile for Kubernetes deployment (Dockerfile.k8s in the repo root).

Multi-stage build:

# Stage 1: Build — golang:1.24.3-alpine3.21
FROM golang:1.24.3-alpine3.21 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Builds for the native platform (no GOARCH hardcoded).
# For amd64 CI: set --platform=linux/amd64 explicitly.
RUN CGO_ENABLED=0 GOOS=linux go build \
    -ldflags="-w -s" \
    -o satellite-agent \
    ./cmd/agent

# Stage 2: Runtime — alpine:3.21 with non-root user
FROM alpine:3.21
RUN apk --no-cache add ca-certificates=20250911-r0 && \
    addgroup -g 1001 agent && \
    adduser -D -u 1001 -G agent agent
COPY --from=builder /app/satellite-agent /usr/local/bin/satellite-agent
# Port 8888: /status + /health | Port 8889: /metrics
EXPOSE 8888 8889
# Default non-root; DaemonSet overrides to root
USER agent
ENTRYPOINT ["/usr/local/bin/satellite-agent"]

:::info [Platform note] On Apple Silicon (arm64) Dockerfile.k8s builds natively without Rosetta. In CI/CD pipelines (amd64) specify --platform=linux/amd64 explicitly with docker build. :::


DaemonSet Deployment

A DaemonSet ensures that exactly one agent pod instance runs on every Kubernetes node — including when new nodes are added to the cluster.

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: imvee-satellite
  namespace: imvee-system
spec:
  selector:
    matchLabels:
      app: imvee-satellite
  template:
    metadata:
      labels:
        app: imvee-satellite
    spec:
      containers:
        - name: satellite
          image: <REGISTRY>/imvee-satellite-agent:<VERSION>
          env:
            - name: IMVEE_API_KEY
              valueFrom:
                secretKeyRef:
                  name: imvee-satellite-secret
                  key: api-key
            - name: API_URL
              value: "https://socsuite.dev.imvee.de/api/v1"
            - name: OPENSEARCH_URL
              value: "https://siem.dev.imvee.de"
          volumeMounts:
            - name: varlib
              mountPath: /var/lib/imvee-satellite
      volumes:
        - name: varlib
          hostPath:
            path: /var/lib/imvee-satellite
            type: DirectoryOrCreate

:::warn [hostPath volume] The hostPath volume for /var/lib/imvee-satellite is important so that agent.id and agent.key are stored persistently on the node. Without it, a new enrollment would be triggered on every pod restart and a duplicate asset entry would be created in SOCSuite. :::


Configuration via Environment Variables

In DaemonSet operation all configuration is done via environment variables. The enrollment token mechanism is replaced by directly providing IMVEE_API_KEY (via Kubernetes Secret).

# Create secret
kubectl create secret generic imvee-satellite-secret \
  --from-literal=api-key=<IMVEE_API_KEY> \
  -n imvee-system

All available environment variables are described on the Configuration page.

:::info [IMVEE_API_KEY instead of agent.key] In Kubernetes deployments IMVEE_API_KEY is injected as an environment variable. The file-based agent.key encryption (machine-specific, AES-256-GCM) is not suitable for container deployments because containers have no stable machine ID. IMVEE_API_KEY therefore has higher priority. :::


K8s Collector

In Kubernetes operation the agent automatically activates the K8s Collector, which gathers cluster metadata:

ResourceCollected Data
PodsName, namespace, status, container images, labels
NodesName, status, capacity, allocatable resources
DeploymentsName, namespace, replicas, status
PVCsName, namespace, status, StorageClass, capacity

The K8s Collector interval is configurable (see Configuration).

:::info [RBAC for K8s Collector] The agent requires Kubernetes RBAC permissions to query the resources above. A ServiceAccount with appropriate ClusterRole bindings is required for production.

# Example ClusterRole (minimal permissions)
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: imvee-satellite-reader
rules:
  - apiGroups: [""]
    resources: ["pods", "nodes", "persistentvolumeclaims"]
    verbs: ["get", "list", "watch"]
  - apiGroups: ["apps"]
    resources: ["deployments"]
    verbs: ["get", "list", "watch"]

:::


See Also

On this page