Kubescape ist eine Open-Source-Kubernetes-Sicherheits-Posture-Management-Plattform von ARMO (CNCF-Inkubationsprojekt). Sie bietet Risikoanalyse, Compliance-Scanning, Misconfiguration-Erkennung und Schwachstellen-Scanning über IDE, CI/CD-Pipelines und laufende Cluster hinweg.
| Befehl | Beschreibung |
|---|
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | bash | Installiere neueste Version (macOS/Linux) |
brew install kubescape | Installation über Homebrew (macOS) |
scoop install kubescape | Installation über Scoop (Windows) |
docker run -it kubescape/kubescape:latest kubescape --help | Führe Kubescape in Docker aus |
kubescape version | Zeige installierte Version |
kubescape download | Lade Frameworks und Policies herunter |
kubescape download --frameworks | Lade alle Frameworks herunter |
| Befehl | Beschreibung |
|---|
kubescape scan | Scanne aktuellen Cluster mit kubeconfig |
kubescape scan --kubeconfig /path/to/kubeconfig | Scanne Cluster mit spezifischem kubeconfig |
kubescape scan -f manifest.yaml | Scanne YAML-Manifestdatei |
kubescape scan -f *.yaml | Scanne mehrere Manifestdateien |
kubescape scan -d ./k8s-configs/ | Scanne alle Manifeste in Verzeichnis |
kubescape scan --helm /path/to/chart | Scanne Helm-Chart vor Deployment |
kubescape scan --include-namespaces default,kube-system | Scanne nur spezifische Namespaces |
kubescape scan --exclude-namespaces kube-node-lease | Schließe Namespaces aus Scan aus |
kubescape scan --severity high,critical | Zeige nur high/critical Schweregrad-Probleme |
kubescape scan --pod-runtime containerd | Spezifiziere Container-Runtime (docker, containerd, cri-o) |
| Befehl | Beschreibung |
|---|
kubescape scan framework nsa | Scanne gegen NSA-CISA Kubernetes-Hardening-Anleitung |
kubescape scan framework cis | Scanne gegen CIS Kubernetes-Benchmark |
kubescape scan framework mitre | Scanne gegen MITRE ATT&CK-Framework |
kubescape scan framework pci-dss | Scanne gegen PCI-DSS-Compliance |
kubescape scan framework soc2 | Scanne gegen SOC2-Compliance |
kubescape scan framework hipaa | Scanne gegen HIPAA-Compliance |
kubescape scan -f manifest.yaml -f nsa,cis,mitre | Scanne Manifest gegen mehrere Frameworks |
kubescape scan --list-frameworks | Liste alle verfügbaren Frameworks auf |
| Befehl | Beschreibung |
|---|
kubescape scan image gcr.io/project/image:tag | Scanne Container-Image auf Schwachstellen |
kubescape scan image --image-scan-concurrency 5 image1 image2 | Scanne mehrere Images gleichzeitig |
kubescape scan -f manifest.yaml --include-image-scanning | Scanne Manifeste und alle referenzierten Images |
kubescape scan image --severity critical --only-vulnerabilities | Zeige nur kritische Schwachstellen |
kubescape scan image --image-registry-credentials user:pass@registry:5000 | Scanne Private-Registry-Images |
kubescape scan -f manifest.yaml --image-scan-cache | Cache Image-Scans für wiederholte Runs |
| Befehl | Beschreibung |
|---|
kubescape scan -o json > report.json | Gebe Ergebnisse als JSON aus |
kubescape scan -o pdf > report.pdf | Generiere PDF-Bericht |
kubescape scan -o html > report.html | Generiere HTML-Bericht |
kubescape scan -o sarif > report.sarif | Gebe im SARIF-Format aus (für CI/CD-Tools) |
kubescape scan -o pretty-json | Pretty-gedruckter JSON-Output |
kubescape scan --output-file report.json -o json | Speichere Output in Datei |
kubescape scan -o json | jq '.results[] | select(.severity=="critical")' | Filtere JSON-Ergebnisse mit jq |
| Befehl | Beschreibung |
|---|
kubescape scan --fail-threshold 80 | Fehlgeschlagene Pipeline, wenn Risk-Score unter 80 |
kubescape scan --fail-threshold 70 --severity critical | Gate Pipeline bei kritischen Befunden |
kubescape scan -f manifest.yaml --fail-threshold 85 -o sarif | Generiere SARIF + Gate in GitHub Actions |
kubescape scan --fail-on-compliance-failure | Fehl, wenn Compliance-Frameworks fehlschlagen |
kubescape scan -o json --format-by-severity | Output gruppiert nach Schweregrad |
- name: Run Kubescape security scan
uses: kubescape/github-action@v2
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
frameworks: nsa,cis
fail-threshold: 80
output-format: sarif
output-file: kubescape-report.sarif
- name: Upload SARIF to GitHub Security
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: kubescape-report.sarif
kubescape_scan:
stage: security
image: kubescape/kubescape:latest
script:
- kubescape scan framework nsa --fail-threshold 80 -o sarif > report.sarif
- kubescape scan framework cis --fail-threshold 75 -o json > cis-report.json
artifacts:
reports:
sast: report.sarif
paths:
- cis-report.json
stage('Security: Kubescape') {
steps {
sh '''
kubescape scan -f k8s-manifests/ \
--fail-threshold 80 \
-o sarif > kubescape-report.sarif \
-o json > kubescape-report.json
'''
archiveArtifacts artifacts: '*-report.*'
}
}
| Befehl | Beschreibung |
|---|
kubescape download --output-dir ./offline-data | Lade alle Frameworks in lokales Verzeichnis |
kubescape download --frameworks nsa,cis --output-dir ./fw | Lade spezifische Frameworks offline |
kubescape scan -f manifest.yaml --offline --frameworks-dir ./offline-data | Scanne mit heruntergeladenen Frameworks |
kubescape scan -d manifests/ --offline --frameworks-dir ./offline-data | Offline-Verzeichnis-Scan |
| Befehl | Beschreibung |
|---|
kubescape config | Zeige aktuelle Konfiguration |
kubescape config set <key> <value> | Setze Konfigurationswert |
kubescape config get <key> | Hole Konfigurationswert |
kubescape config -p ~/.kubescape/config | Verwende benutzerdefinierten Config-Pfad |
kubescape scan -c ./custom-config.yaml | Scanne mit benutzerdefinierter Konfiguration |
| Befehl | Beschreibung |
|---|
kubescape operator install | Installiere Kubescape-Operator im Cluster |
kubescape operator install --namespace kubescape | Installiere Operator in spezifischem Namespace |
kubescape operator uninstall | Entferne Kubescape-Operator |
kubectl get deployment -n kubescape | Verifiziere Operator-Installation |
kubectl logs -n kubescape -l app=kubescape-operator | Zeige Operator-Logs |
kubescape operator status | Prüfe Operator-Status |
| Befehl | Beschreibung |
|---|
kubescape scan --exceptions exceptions.json | Wende Ausnahmeregelns an |
kubescape scan --enable-controls <control-id> | Aktiviere spezifische Controls |
kubescape scan --disable-controls <control-id> | Deaktiviere spezifische Controls |
kubescape scan --controls <id1>,<id2> | Führe nur angegebene Controls aus |
kubescape scan --list-controls | Liste alle verfügbaren Controls auf |
kubescape scan --list-controls --framework nsa | Liste NSA-Framework-Controls auf |
{
"exceptions": [
{
"ruleID": "C-0001",
"namespace": "test-namespace",
"resources": ["deployment/test-app"],
"justification": "Development environment exemption"
}
]
}
| Befehl | Beschreibung |
|---|
kubescape scan --verbose | Zeige detaillierte Debug-Output |
kubescape scan --log-level debug | Setze Logging-Stufe (debug, info, warn, error) |
kubescape scan --submit | Sende Scan-Ergebnisse an Kubescape Cloud |
kubescape scan --account <account-id> | Sende an spezifisches Cloud-Account |
kubescape scan --keep-local | Scanne ohne an Cloud zu senden |
kubescape scan --max-workers 10 | Steuere parallele Verarbeitungs-Worker |
kubescape scan --timeout 300 | Setze Timeout in Sekunden |
| Praktische Maßnahme | Beschreibung |
|---|
| Version Control Manifests | Versionskontrolle für Kubernetes-Manifeste verwenden; vor Deployment scannen |
| Gate on Risk Score | --fail-threshold in CI/CD setzen; 75-85 je nach Org-Risikotoleranz |
| Multi-Framework Scanning | NSA + CIS + MITRE verwenden; Priorität auf höchste Befunde setzen |
| Regular Image Scanning | Container-Images in Supply Chain scannen; CVEs früh erkennen |
| Namespace Isolation | --include-namespaces verwenden um Scans zu fokussieren; System-Namespaces ausschließen |
| Offline in Secure Envs | Frameworks offline herunterladen für Air-Gapped-Cluster |
| Monitor Over Time | Risk-Scores über Scans hinweg verfolgen; Regressionen untersuchen |
| Exception Justification | Ausnahmen dokumentieren; regelmäßig auf Entfernung überprüfen |
| Helm Pre-Deployment | kubescape scan --helm auf Charts vor Helm install ausführen |
| Enable RBAC | Verifiziere ServiceAccount hat minimale erforderliche Berechtigungen |
| Use SARIF Output | SARIF-Berichte in IDE, GitHub und SIEM-Systeme integrieren |
| Review Control Details | kubescape scan --list-controls verwenden um jeden Control zu verstehen |