Skip to content

KubePattern Smells

The KubePattern analysis results are represented as Smells, which are structured findings that indicate potential issues, anti-patterns, or areas for improvement in your Kubernetes manifests. Each Smell is associated with a specific pattern from the Pattern Registry.

Retrieving Results

Using kubectl

bash
# List all patterns across all namespaces
kubectl get patterns.kubepattern.dev -A

# Short form
kubectl get smells -A

# View details of specific pattern
kubectl describe smells <smell-name> -n <namespace>

# Get as YAML
kubectl get smells <smell-name> -n <namespace> -o yaml

# Filter by field, e.g. severity (requires label)
kubectl get smells -n pattern-analysis-ns --field-selector spec.severity=CRITICAL

KubePattern Smell Custom Resource Definition

Analysis results are stored as Kubernetes Custom Resources:

PropertyDescription
apiVersionAPI version of the Smell CRD (e.g., kubepattern.dev/v1)
kindAlways Smell
metadataStandard Kubernetes metadata (name, namespace, labels, annotations)
metadata.nameUnique name of the smell, typically generated based on the pattern and target resource
metadata.namespaceNamespace where the smell is stored, usually the same as the target resource's namespace
metadata.labels.lastScanUUID of the last scan during which the smell was detected (e.g., lastScan: abc123)
specCore specification of the smell, containing detection logic and relationships
spec.suppressboolean
spec.targetDetails about the target resource that triggered the smell (apiVersion, kind, name, namespace, uid)
spec.patternInformation about the pattern that generated the smell (name, version)
spec.referenceLink to documentation for the smell and its remediation
spec.messageCustom message describing the smell
spec.severitySeverity level of the smell (LOW, MEDIUM, HIGH, CRITICAL)
spec.categoryCategory of the smell (e.g., Security, Performance, Maintainability)
spec.nameName of the smell (e.g., "Exposed Service")

INFO

If metadata.labels.lastScan is missing or is out of date, it means the smell has been detected in a previous scan and has not been updated in the current scan. This could indicate that the smell is no longer relevant (e.g., the underlying issue has been resolved) or that it is an old finding that needs to be reviewed. KubePattern automatically removes smells that are no longer relevant.