Service Account Configuration¶
Directory Inventory
See the Service Accounts Directory Inventory for a complete listing of files and resources in this directory.
This guide covers the setup and management of service accounts for secure container scanning.
Basic Service Account Setup¶
Create a dedicated service account for InSpec scanning:
ServiceAccount Naming Conventions¶
Consider using a consistent naming convention for scanner service accounts:
- Dedicated namespace:
inspec-scanner
- CI/CD pipelines:
inspec-scanner-{pipeline-id}
- Team-specific:
inspec-scanner-{team-name}
Service Account Annotations¶
You can add annotations to service accounts for additional metadata:
Token-Related ServiceAccount Features¶
In Kubernetes 1.24+, service accounts no longer automatically get long-lived token secrets. You need to explicitly create tokens.
For Short-Lived Tokens (Recommended)¶
Use the Kubernetes API to create short-lived tokens:
This creates a token with a default expiration of 1 hour.
For Long-Lived Tokens (Use With Caution)¶
Create a token secret with an explicit reference to the service account:
Service Account Auditing¶
Regularly audit your service accounts:
Rotating Service Accounts¶
For enhanced security, rotate service accounts regularly:
Security Considerations¶
- Use dedicated service accounts - never reuse default accounts
- Limit the number of service accounts with scanning capabilities
- Regularly review and rotate service accounts
- Use namespaces to isolate service accounts by sensitivity level
- Consider using Kubernetes PodSecurityPolicies (or Pod Security Admission in 1.25+) to constrain service account usage