Agent Deployment
Deploy AICR as a Kubernetes Job to automatically capture cluster configuration snapshots.
Overview
The agent is a Kubernetes Job that captures system configuration and writes output to a ConfigMap.
Deployment: Use aicr snapshot to deploy and manage the Job programmatically.
What it does:
- Runs
aicr snapshot --namespace gpu-operator --output cm://gpu-operator/aicr-snapshoton a GPU node - Writes snapshot to ConfigMap via Kubernetes API (no PersistentVolume required)
- Exits after snapshot capture
What it does not do:
- Recipe generation (use
aicr recipeCLI or API server) - Bundle generation (use
aicr bundleCLI) - Continuous monitoring (use CronJob for periodic snapshots)
Use cases:
- Cluster auditing and compliance
- Multi-cluster configuration management
- Drift detection (compare snapshots over time)
- CI/CD integration (automated configuration validation)
ConfigMap storage
Agent uses ConfigMap URI scheme (cm://namespace/name) to write snapshots:
The agent’s namespaced Role grants ConfigMap write access only in its
deployment namespace (--namespace, default default). The cm:// target
namespace must match --namespace — otherwise the Job’s ServiceAccount has
no permission to create the ConfigMap and the snapshot write fails.
This creates:
Prerequisites
- Kubernetes cluster with GPU nodes
- aicr CLI installed
- GPU Operator installed (or appropriate namespace configured via
--namespace) - Cluster admin permissions (for RBAC setup)
Quick Start
1. Deploy Agent with Single Command
This single command:
- Creates RBAC resources (ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding)
- Deploys Job to capture snapshot
- Waits for Job completion (5m timeout by default)
- Retrieves snapshot from ConfigMap
- Writes snapshot to stdout (or specified output)
- Cleans up Job and RBAC resources (use
--no-cleanupto keep for debugging)
2. View Snapshot Output
Snapshot is written to specified output:
3. Customize Deployment
Target specific nodes and configure scheduling:
Available flags:
--kubeconfig: Custom kubeconfig path (default:~/.kube/configor$KUBECONFIG)--namespace: Deployment namespace (default:default)--image: Container image (default: matches the CLI version, e.g.ghcr.io/nvidia/aicr:v0.19.0; dev and snapshot builds use:latest)--image-pull-secret: Secret name for pulling the agent image from a private registry (repeatable)--job-name: Job name (default:aicr)--service-account-name: ServiceAccount name (default:aicr)--node-selector: Node selector (format:key=value, repeatable)--toleration: Toleration (format:key=value:effect, repeatable). Default: all taints are tolerated (usesoperator: Existswithout key). Only specify this flag if you want to restrict which taints the Job can tolerate.--timeout: Wait timeout (default:5m)--no-cleanup: Skip removal of Job and RBAC resources on completion. Warning: leaves theaicr-node-readerClusterRole and ClusterRoleBinding active. By default these grant only read access to nodes, pods, ClusterPolicy CRDs, Slinky Controller/NodeSet/LoginSet/RestApi/Accounting CRs, and official MariaDB CRs (not cluster-admin); however, when combined with--discover-networkthe retained ClusterRole also carries the cluster-scoped mutating discovery rules (CRD/namespace/DaemonSet create-delete,pods/exec,nodes/patch,NicClusterPolicypatch — see Security Considerations), so it is not read-only in that case.--privileged: Run agent in privileged mode (default: enabled; required for GPU/SystemD collectors). Set tofalsefor PSS-restricted namespaces.--require-gpu: Fail the snapshot if no GPU is found. In agent mode also requests annvidia.com/gpuresource for the pod (required in CDI environments).--runtime-class: SetruntimeClassNameon the agent pod fornvidia-smiaccess without consuming a GPU. Use with--node-selectorto target GPU nodes.--os: Node OS family (ubuntu,rhel,cos,amazonlinux,ol,talos). Selects the per-OS pod configuration and service collector backend.--requests/--limits: Override agent container resource requests/limits (comma-separatedname=quantitypairs).--cluster-config: Path to a pre-existing k8s-launch-kit cluster-config.yaml to ingest network topology (local agent mode only).--aks-gpu-pools: Path to anaz aks nodepool list -o jsondump, projected into theK8s.aks-gpu-pools.gpu-driverreading. Controller-side: works in agent Job mode too — the file never enters the pod; the CLI merges the projection into the returned snapshot.--discover-network: Enable live l8k discovery to populate the NetworkTopology measurement. Not read-only — writesnvidia.kubernetes-launch-kit.*node labels and may patchNicClusterPolicy.
4. Check Agent Logs (Debugging)
If something goes wrong, check Job logs:
Customization
Node Selection
Target specific GPU nodes using --node-selector:
Common node selectors:
Tolerations
By default, the agent Job tolerates all taints using the universal toleration (operator: Exists without a key). Only specify --toleration flags to restrict which taints are tolerated.
Common tolerations:
Image Version
Pin to a specific version:
Finding versions:
- GitHub Releases
- Container registry: ghcr.io/nvidia/aicr
Post-Deployment
Retrieve Snapshot
Generate Recipe from Snapshot
Complete Workflow
Integration Patterns
CI/CD Pipeline
Multi-Cluster Auditing
Drift Detection
Troubleshooting
Job Fails to Start
Check RBAC permissions:
Job Pending
Check node selectors and tolerations:
Job Completes but No Output
Check ConfigMap and container logs:
Permission Denied
Ensure RBAC is correctly deployed:
Security Considerations
RBAC Permissions
The agent requires these permissions (created automatically by the CLI):
- ClusterRole (
aicr-node-reader): Read access to nodes and pods;get/listaccess to ClusterPolicy CRDs (nvidia.com); cluster-widelistaccess to Slinky Controller, NodeSet, LoginSet, RestApi, and Accounting CRs (slinky.slurm.net); and cluster-widelistaccess to official MariaDB CRs (k8s.mariadb.com) - Role (
aicr): Create/update ConfigMaps and list pods in the deployment namespace
The baseline ClusterRole above is read-only (get/list only). Slinky
detection projects only allowlisted identity, association, and boolean fields;
it omits free-form configuration, status, pod templates, and Secret/ConfigMap
references or contents. MariaDB detection records only official API-group and
CR presence; it does not inspect database configuration, Services, operator
Deployments, pods, or external databases.
Additional privileges with --discover-network. When --discover-network
is set, the CLI appends a set of cluster-scoped mutating rules to the
ClusterRole so k8s-launch-kit’s live discovery can run. These grant far more
than read access:
apiextensions.k8s.ioCustomResourceDefinitions:get,list,create,update,patchnamespaces:get,create,delete(l8k creates and tears down a bootstrap namespace)apps/daemonsets:get,list,watch,create,deleteserviceaccounts,configmaps:get,create,deleterbac.authorization.k8s.ioroles, rolebindings:get,create,deletepods/exec:create(l8k exec’s into the discovery DaemonSet pods to read VPD / link state)nodes:patch(writesnvidia.kubernetes-launch-kit.*node labels)configuration.net.nvidia.comnicdevices:get,listmellanox.comnicclusterpolicies:get,patch
Use --discover-network only against clusters where this mutation and the
broader RBAC grant are acceptable.
Pod Security Context
The agent requires elevated privileges to collect system configuration from the host:
hostPID,hostNetwork,hostIPC: Required to read host system configurationprivileged+SYS_ADMIN: Required to access GPU configuration and kernel parameters/run/systemdmount: Required to query systemd service states
See Also
- CLI Reference - aicr CLI commands
- Installation Guide - Install CLI locally
- API Reference - REST API usage
- Kubernetes Deployment - API server deployment