Skip to main content

Kubernetes

The kubernetes config type scrapes the configurations of your Kubernetes resources as specified with the fields; namespace, selector, fieldSelector and more.

kubernetes:
- clusterName: local-kind-cluster
exclusions:
- Secret
- ReplicaSet
- APIService
- endpoints.discovery.k8s.io
- endpointslices.discovery.k8s.io
- leases.coordination.k8s.io
- podmetrics.metrics.k8s.io
- nodemetrics.metrics.k8s.io
- customresourcedefinition
- controllerrevision
- certificaterequest
- orders.acme.cert-manager.io
event:
exclusions:
- SuccessfulCreate
- Created
- DNSConfigForming
severityKeywords:
error:
- failed
- error
warn:
- backoff
- nodeoutofmemory

Scraper

FieldDescriptionSchemeRequired
logLevelSpecify the level of logging.stringfalse
scheduleSpecify the interval to scrape in cron format. Defaults to every 60 minutes.stringfalse
fullSet to true to extract changes from scraped configurations. Defaults to false.boolfalse
retentionSettings for retaining changes, analysis and scraped itemsRetention
kubernetesSpecifies the list of Kubernetes configurations to scrape.[]Kubernetesfalse

Kubernetes

FieldDescriptionSchemeRequired
idA static value or JSONPath expression to use as the ID for the resource.stringtrue
nameA static value or JSONPath expression to use as the Name for the resource. Default value is the id.stringfalse
itemsA JSONPath expression to use to extract individual items from the resourcestringfalse
typeA static value or JSONPath expression to use as the type for the resource.stringtrue
transformSpecify field to transform resultTransformfalse
formatFormat of config item, defaults to JSON, available options are JSONstringfalse
timestampFormatTimestampFormat is a Go time format string used to parse timestamps in createFields and DeletedFields. If not specified, the default is RFC3339.stringfalse
createFieldsCreateFields is a list of JSONPath expression used to identify the created time of the config. If multiple fields are specified, the first non-empty value will be used[]stringfalse
deleteFieldsDeleteFields is a JSONPath expression used to identify the deleted time of the config. If multiple fields are specified, the first non-empty value will be used[]stringfalse
clusterNameSpecify cluster namestring
namespaceSpecify namespace for scraping of Kubernetes resourcesstring
useCacheSpecify boolean value to toggle fetching results from Kube-apiserver or fetch response from etcdbool
allowIncompletebool
scopeSpecify scope for scrape. e.g cluster for scraping at Cluster levelstring
sinceSet time constraint for scraping resources within the set periodstring
selectorSpecify Kubernetes resource to scrape based on selector. e.g matchLabelsstring
fieldSelectorSpecify Kubernetes resource based on value of resource fields. e.g status.Phase=Runningstring
maxInflightSet value for maximum inflight requestsint64
exclusionsSpecify Kubernetes resources to be excluded from scraping[]string
kubeconfigSpecify kubeconfig for access to your Kubernetes Clusterkommons.EnvVaryes
eventSpecify configuration to handle Kubernetes events. See KubernetesEventKubernetesEventyes
relationshipsCreate relationships between kubernetes objects. See KubernetesRelationships[]KubernetesRelationshipsfalse

KubernetesEvent

Config DB maps Kubernetes Event objects to config changes unlike other objects that are mapped to config items. This configuration allows you to exclude or include the Kubernetes Event objects based on the reason.

In addition, you can also specify keywords used to identify the severity of the Kubernetes Event based on the reason.

FieldDescriptionSchemeRequired
exclusionsA list of keywords used to exclude event objects based on the reason[]stringfalse
severityKeywordsSpecify keywords used to identify the severity of the Kubernetes Event based on the reasonSeverityKeywordsfalse

SeverityKeywords

FieldDescriptionSchemeRequired
warnA list of keywords used to identify a warning severity from the reason. It could also be a match pattern: example "*" to match all or "!badword" to exclude "badword"[]stringfalse
errorSame as warn but used to map to error severity.[]stringfalse

KubernetesRelationships

You can create relationships between kubernetes objects on the basis of kind, name and labels. While relationships between node and pod, deployment and pod, namespace and deployment are created automatically, there are cases where we want to link objects on the basis of metadata (like linking resources created by a flux object to it).

We support static values, expressions and label lookups to find the parent

FieldDescriptionSchemeRequired
kindkind of Kubernetes ObjectKubernetesRelationshipLookuptrue
namename of Kubernetes ObjectKubernetesRelationshipLookuptrue
namespacenamespace of Kubernetes ObjectKubernetesRelationshipLookuptrue

KubernetesRelationshipLookup

FieldDescriptionSchemeRequired
valueStatic string value of the resourcestring
exprCEL Expression to evaluatestring
labelLabel key containing the value of the the resourcestring

Kubernetes Relationship Example

kubernetes:
- clusterName: 'eks'
...
relationships:
# If object has spec.claimRef field, use its kind, name and namespace
- kind:
expr: "has(spec.claimRef) ? spec.claimRef.kind : ''"
name:
expr: "has(spec.claimRef) ? spec.claimRef.name : ''"
namespace:
expr: "has(spec.claimRef) ? spec.claimRef.namespace : ''"

# If object flux kustomize labels, link it to the parent Kustomization object
- kind:
value: Kustomization
name:
label: kustomize.toolkit.fluxcd.io/name
namespace:
label: kustomize.toolkit.fluxcd.io/namespace

# If object helm kustomize labels, link it to the parent HelmRelease object
- kind:
value: HelmRelease
name:
label: helm.toolkit.fluxcd.io/name
namespace:
label: helm.toolkit.fluxcd.io/namespace