Zum Inhalt springen

Kubescape

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.

BefehlBeschreibung
curl -s https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | bashInstalliere neueste Version (macOS/Linux)
brew install kubescapeInstallation über Homebrew (macOS)
scoop install kubescapeInstallation über Scoop (Windows)
docker run -it kubescape/kubescape:latest kubescape --helpFühre Kubescape in Docker aus
kubescape versionZeige installierte Version
kubescape downloadLade Frameworks und Policies herunter
kubescape download --frameworksLade alle Frameworks herunter
BefehlBeschreibung
kubescape scanScanne aktuellen Cluster mit kubeconfig
kubescape scan --kubeconfig /path/to/kubeconfigScanne Cluster mit spezifischem kubeconfig
kubescape scan -f manifest.yamlScanne YAML-Manifestdatei
kubescape scan -f *.yamlScanne mehrere Manifestdateien
kubescape scan -d ./k8s-configs/Scanne alle Manifeste in Verzeichnis
kubescape scan --helm /path/to/chartScanne Helm-Chart vor Deployment
kubescape scan --include-namespaces default,kube-systemScanne nur spezifische Namespaces
kubescape scan --exclude-namespaces kube-node-leaseSchließe Namespaces aus Scan aus
kubescape scan --severity high,criticalZeige nur high/critical Schweregrad-Probleme
kubescape scan --pod-runtime containerdSpezifiziere Container-Runtime (docker, containerd, cri-o)
BefehlBeschreibung
kubescape scan framework nsaScanne gegen NSA-CISA Kubernetes-Hardening-Anleitung
kubescape scan framework cisScanne gegen CIS Kubernetes-Benchmark
kubescape scan framework mitreScanne gegen MITRE ATT&CK-Framework
kubescape scan framework pci-dssScanne gegen PCI-DSS-Compliance
kubescape scan framework soc2Scanne gegen SOC2-Compliance
kubescape scan framework hipaaScanne gegen HIPAA-Compliance
kubescape scan -f manifest.yaml -f nsa,cis,mitreScanne Manifest gegen mehrere Frameworks
kubescape scan --list-frameworksListe alle verfügbaren Frameworks auf
BefehlBeschreibung
kubescape scan image gcr.io/project/image:tagScanne Container-Image auf Schwachstellen
kubescape scan image --image-scan-concurrency 5 image1 image2Scanne mehrere Images gleichzeitig
kubescape scan -f manifest.yaml --include-image-scanningScanne Manifeste und alle referenzierten Images
kubescape scan image --severity critical --only-vulnerabilitiesZeige nur kritische Schwachstellen
kubescape scan image --image-registry-credentials user:pass@registry:5000Scanne Private-Registry-Images
kubescape scan -f manifest.yaml --image-scan-cacheCache Image-Scans für wiederholte Runs
BefehlBeschreibung
kubescape scan -o json > report.jsonGebe Ergebnisse als JSON aus
kubescape scan -o pdf > report.pdfGeneriere PDF-Bericht
kubescape scan -o html > report.htmlGeneriere HTML-Bericht
kubescape scan -o sarif > report.sarifGebe im SARIF-Format aus (für CI/CD-Tools)
kubescape scan -o pretty-jsonPretty-gedruckter JSON-Output
kubescape scan --output-file report.json -o jsonSpeichere Output in Datei
kubescape scan -o json | jq '.results[] | select(.severity=="critical")'Filtere JSON-Ergebnisse mit jq
BefehlBeschreibung
kubescape scan --fail-threshold 80Fehlgeschlagene Pipeline, wenn Risk-Score unter 80
kubescape scan --fail-threshold 70 --severity criticalGate Pipeline bei kritischen Befunden
kubescape scan -f manifest.yaml --fail-threshold 85 -o sarifGeneriere SARIF + Gate in GitHub Actions
kubescape scan --fail-on-compliance-failureFehl, wenn Compliance-Frameworks fehlschlagen
kubescape scan -o json --format-by-severityOutput 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.*'
    }
}
BefehlBeschreibung
kubescape download --output-dir ./offline-dataLade alle Frameworks in lokales Verzeichnis
kubescape download --frameworks nsa,cis --output-dir ./fwLade spezifische Frameworks offline
kubescape scan -f manifest.yaml --offline --frameworks-dir ./offline-dataScanne mit heruntergeladenen Frameworks
kubescape scan -d manifests/ --offline --frameworks-dir ./offline-dataOffline-Verzeichnis-Scan
BefehlBeschreibung
kubescape configZeige aktuelle Konfiguration
kubescape config set <key> <value>Setze Konfigurationswert
kubescape config get <key>Hole Konfigurationswert
kubescape config -p ~/.kubescape/configVerwende benutzerdefinierten Config-Pfad
kubescape scan -c ./custom-config.yamlScanne mit benutzerdefinierter Konfiguration
BefehlBeschreibung
kubescape operator installInstalliere Kubescape-Operator im Cluster
kubescape operator install --namespace kubescapeInstalliere Operator in spezifischem Namespace
kubescape operator uninstallEntferne Kubescape-Operator
kubectl get deployment -n kubescapeVerifiziere Operator-Installation
kubectl logs -n kubescape -l app=kubescape-operatorZeige Operator-Logs
kubescape operator statusPrüfe Operator-Status
BefehlBeschreibung
kubescape scan --exceptions exceptions.jsonWende 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-controlsListe alle verfügbaren Controls auf
kubescape scan --list-controls --framework nsaListe NSA-Framework-Controls auf
{
  "exceptions": [
    {
      "ruleID": "C-0001",
      "namespace": "test-namespace",
      "resources": ["deployment/test-app"],
      "justification": "Development environment exemption"
    }
  ]
}
BefehlBeschreibung
kubescape scan --verboseZeige detaillierte Debug-Output
kubescape scan --log-level debugSetze Logging-Stufe (debug, info, warn, error)
kubescape scan --submitSende Scan-Ergebnisse an Kubescape Cloud
kubescape scan --account <account-id>Sende an spezifisches Cloud-Account
kubescape scan --keep-localScanne ohne an Cloud zu senden
kubescape scan --max-workers 10Steuere parallele Verarbeitungs-Worker
kubescape scan --timeout 300Setze Timeout in Sekunden
Praktische MaßnahmeBeschreibung
Version Control ManifestsVersionskontrolle 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 ScanningNSA + CIS + MITRE verwenden; Priorität auf höchste Befunde setzen
Regular Image ScanningContainer-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 EnvsFrameworks offline herunterladen für Air-Gapped-Cluster
Monitor Over TimeRisk-Scores über Scans hinweg verfolgen; Regressionen untersuchen
Exception JustificationAusnahmen dokumentieren; regelmäßig auf Entfernung überprüfen
Helm Pre-Deploymentkubescape scan --helm auf Charts vor Helm install ausführen
Enable RBACVerifiziere ServiceAccount hat minimale erforderliche Berechtigungen
Use SARIF OutputSARIF-Berichte in IDE, GitHub und SIEM-Systeme integrieren
Review Control Detailskubescape scan --list-controls verwenden um jeden Control zu verstehen