Sidecar Container Scanner¶
Directory Context
This document is part of the Scanner Types Directory. See the Scanner Types Directory Inventory for related resources.
Overview¶
The sidecar-scanner
chart implements the Sidecar Container Approach for universal container scanning in Kubernetes. This chart builds on the common-scanner
and scanner-infrastructure
charts, adding specialized components for scanning using process namespace sharing.
The Sidecar Container Approach deploys a scanner container alongside the target container in the same pod, using Kubernetes shared process namespace feature to access the target container's filesystem and processes.
Components¶
Key Resources Created¶
- Test Pod (Optional)
- Demo pod with target and scanner containers
- Demonstrates sidecar scanning approach
-
Shows process namespace sharing configuration
-
ConfigMap: Profiles
- CINC Auditor profiles for container scanning
-
Pre-packaged compliance profiles
-
ConfigMap: Thresholds
- Compliance threshold configurations
- Custom threshold settings for the sidecar approach
This chart primarily relies on components from its dependencies:
common-scanner
: Scanning scripts and SAF CLI integrationscanner-infrastructure
: Core RBAC, service accounts, and security model
Features¶
Sidecar Container Scanning¶
The Sidecar Container Approach provides these capabilities:
- Universal Container Support: Works with both standard and distroless containers
- Process Namespace Sharing: Access to target container processes and filesystem
- Pre-Deployment Integration: Sidecar is deployed with the target container
- Immediate Scanning: Can scan immediately after container startup
- Result Persistence: Can store results in shared volumes
Security Considerations¶
- Increased Attack Surface: Persistent sidecar container increases the attack surface
- Process Namespace Breach: Violates process isolation between containers
- Resource Overhead: Additional container in every pod adds resource overhead
- One Process Per Container: Violates the Docker best practice of "one process per container"
Installation Options¶
Basic Installation (Local Development)¶
Production Installation¶
Installation with Custom Scanner Image¶
Configuration Reference¶
Core Configuration¶
Parameter | Description | Default | Required |
---|---|---|---|
common-scanner.scanner-infrastructure.targetNamespace |
Target namespace | inspec-test |
Yes |
common-scanner.scanner-infrastructure.serviceAccount.name |
Service account name | inspec-scanner |
No |
Test Pod Configuration¶
Parameter | Description | Default | Required |
---|---|---|---|
testPod.deploy |
Deploy test pod | false |
No |
testPod.name |
Test pod name | sidecar-target |
No |
testPod.targetImage |
Target container image | nginx:latest |
No |
testPod.shareProcessNamespace |
Enable process namespace sharing | true |
Yes |
Scanner Configuration¶
Parameter | Description | Default | Required |
---|---|---|---|
scanner.image |
Scanner container image | chef/inspec:5.18.14 |
No |
scanner.command |
Scanner container command | null |
No |
scanner.args |
Scanner container arguments | null |
No |
scanner.resources.requests.cpu |
CPU request | 100m |
No |
scanner.resources.requests.memory |
Memory request | 256Mi |
No |
scanner.resources.limits.cpu |
CPU limit | 200m |
No |
scanner.resources.limits.memory |
Memory limit | 512Mi |
No |
Profile Configuration¶
Parameter | Description | Default | Required |
---|---|---|---|
profiles.default.enabled |
Enable default profile | true |
No |
profiles.default.path |
Default profile path | /profiles/container-baseline |
No |
profiles.custom |
Custom profile configuration | [] |
No |
Results Configuration¶
Parameter | Description | Default | Required |
---|---|---|---|
results.directory |
Results directory in scanner | /results |
No |
results.format |
Results output format | json |
No |
results.thresholdEnabled |
Enable threshold validation | true |
No |
Usage Examples¶
Local Testing with Test Pod¶
After installing with the test pod enabled:
Using with Existing Applications¶
For scanning existing applications, you would typically add the sidecar container to your application pod specification:
Alternatively, use the scan script:
Limitations¶
- Security Boundary Violation: Process namespace sharing breaks container isolation
- Resource Overhead: Additional container per pod increases resource consumption
- Deployment Changes: Requires modifications to application deployment manifests
- Shared Lifecycle: Scanner container lifecycle tied to target container