"Set it and forget it" container security for Kubernetes
Automatically protect your Kubernetes workloads against vulnerabilities with zero human intervention. SecuredContainer is an intelligent Kubernetes operator that continuously monitors, patches, and secures your container images while you focus on building features.
SecuredContainer works silently in the background:
- π Automatic Detection: Discovers vulnerable containers in your cluster
- π‘οΈ Intelligent Patching: Applies security fixes without breaking your apps
- π Continuous Protection: Keeps your containers secure 24/7
- π Real-time Insights: Shows your security posture in Grafana
# That's it - just apply this and forget about vulnerabilities
apiVersion: security.securedcontainer.io/v1alpha1
kind: ContainerSecurity
metadata:
name: auto-secure
spec:
selector:
matchLabels:
secure: "true" # Label the workloads you want to protect
scanInterval: 24 # Check every 24 hours
autoPatch: true # Automatically fix vulnerabilities- Zero-Touch Operation: No manual intervention needed
- Smart Vulnerability Detection: Powered by Trivy
- Automatic Security Patching: Self-healing container images
- Non-Intrusive Updates: Rolling updates without downtime
- Selective Protection: Choose what to secure with labels
- Rich Monitoring: Built-in Prometheus/Grafana dashboards
- Enterprise Ready: Full Kubernetes-native implementation
- Kubernetes cluster 1.19+
- Helm 3.x
- Buildah (for image rebuilding)
- Container registry credentials
# Add the Helm repository
helm repo add securedcontainer https://texano00.github.io/securedcontainer/charts
helm repo update
# Install the latest stable version
helm install securedcontainer securedcontainer/securedcontainer
# Or install a specific version
helm install securedcontainer securedcontainer/securedcontainer --version 1.0.0
# Or using kubectl
kubectl apply -f https://raw.githubusercontent.com/texano00/securedcontainer/main/config/install.yamlWhen SecuredContainer detects a vulnerable container image, it performs the following steps:
-
Vulnerability Scanning:
- Uses Trivy to perform a deep scan of the container image
- Identifies CVEs, vulnerabilities, and outdated packages
- Generates a detailed vulnerability report
-
Local Image Rebuilding:
- Creates a temporary Dockerfile based on the original image
- Automatically detects the base OS (Alpine, Debian/Ubuntu, or RHEL/CentOS)
- Applies appropriate update commands:
# For Alpine Linux RUN apk update && apk upgrade --no-cache # For Debian/Ubuntu RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y # For RHEL/CentOS RUN yum update -y && yum upgrade -y
- Uses Docker's BuildKit for efficient, layer-optimized builds
- Maintains original image metadata and labels
-
Image Verification:
- Runs a second Trivy scan on the rebuilt image
- Compares vulnerability counts before/after
- Generates a patch report
-
Registry Integration:
- Uses the configured
imagePushSecretfor authentication - Pushes the patched image with the configured suffix
- Maintains a history of patched images for rollback
- Uses the configured
The operator requires the following tools to be available in its environment:
-
Trivy: For vulnerability scanning
- Version: Latest stable
- Used for both initial and verification scans
- Supports multiple vulnerability databases
-
Docker: For image rebuilding
- Version: 20.10+
- BuildKit enabled for efficient builds
- Required permissions:
- Access to Docker daemon
- Read/Write to local image store
- Network access for pulling/pushing images
-
Container Registry Access:
- Push access to target registries
- Authentication via:
- Kubernetes secrets
- Docker config.json
- Registry-specific credentials
# Example authentication secret for registry access
apiVersion: v1
kind: Secret
metadata:
name: registry-credentials
namespace: default
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: <base64-encoded-docker-config>
---
# SecuredContainer configuration- Create a SecuredContainer resource:
apiVersion: security.securedcontainer.io/v1alpha1
kind: ContainerSecurity
metadata:
name: example-security
namespace: default
spec:
selector:
matchLabels:
secure: "true"
scanInterval: 24
autoPatch: true
tagSuffix: "-sc"
imagePushSecret: "registry-credentials"- Label your workloads:
kubectl label deployment/my-app secure=trueThe operator will:
- Detect workloads matching the selector
- Scan container images for vulnerabilities using Trivy
- Create patched versions of vulnerable images
- Update workloads to use the secured images
- Monitor for new vulnerabilities continuously
SecuredContainer operates as a Kubernetes operator that:
- Watches for ContainerSecurity resources
- Monitors labeled Deployments and StatefulSets
- Scans images using Trivy
- Creates and pushes patched images
- Updates workload specifications
- Exports metrics for monitoring
SecuredContainer follows Semantic Versioning. Version numbers are in the format MAJOR.MINOR.PATCH:
- MAJOR: Incompatible API changes
- MINOR: New features (backward-compatible)
- PATCH: Bug fixes (backward-compatible)
- Release versions:
v1.2.3 - Development builds:
v1.2.3-dev.commit - Feature builds:
v1.2.3-develop.commit
All artifacts are published to GitHub Container Registry (ghcr.io):
- Container Images:
ghcr.io/texano00/securedcontainer:$VERSION - Helm Charts:
oci://ghcr.io/texano00/charts/securedcontainer:$VERSION
Please refer to our Contributing Guide for:
- Development workflow
- Branch strategy
- Release process
- Coding standards
- Testing requirements
# Clone the repository
git clone https://github.com/texano00/securedcontainer
cd securedcontainer
# Create a feature branch
git checkout develop
git checkout -b feature/my-feature
# Make your changes and test
make test
# Submit a PR to the develop branchWe welcome contributions! Please see our Contributing Guide for details.
For security concerns, please email security@securedcontainer.io or use GitHub Security Advisories.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- SecuredContainer runs as an operator in your Kubernetes cluster.
- It reads a configuration defining what workloads to watch and how often.
- For each matched deployment/statefulset:
- Retrieves the container image.
- Scans it using Trivy.
- Rebuilds the image with patched OS packages.
- Scans again to show improvements.
- Pushes the secured image (
-sc{datetime}tag). - Updates the deployment to use the new image.
- Sends telemetry to a local database for Grafana visualization.