Kubernetes
Kubernetes
Kubernetes
The supported fields for Kubernetes (block name = "kubernetes) are:
Field Name | Description |
---|---|
kubeconfigFile | The name of the kubeconfig file to use |
namespaces | An explicit list of which namespaces to scan for resources |
excludeAnnotations | User specified annotations that will skip the discovery of a resource if found |
excludeLabels | User specified labels that will skip the discovery of a resource if found |
For the "kubeconfig" field you need to copy that file into the shared directory and the field value is just the name of that file.
The "namespaces" field should only be needed in cases of limited privilege where the credentials in the kubeconfig file don't have privileges to list all the available namespaces, but do have privileges to access resources in certain namespaces, but you need to already know the names of the namespaces. So this is a mechanism for specifying this explicit list of namespaces.
Kubernetes Context Level of Detail Configuration
The level of detail (LOD) for namespaces in Kubernetes clusters determines how much information is indexed and processed for each namespace.
The Level of Detail Annotations can also be used to specify namespace Level of Detail, which are useful when you want to avoid updating the workspaceInfo.yaml for explicit opt-in discovery. This setting overrides all settings below.
Order of Precedence
Annotation on the Namespace
Any
config.runwhen.com/lod
annotation found on the namespace takes precedence over all other configured LODs.
Cluster Default Namespace LOD (
defaultNamespaceLOD
)If a namespace LOD is not explicitly found in an annotation, the cluster-level
defaultNamespaceLOD
is used (if it exists).Example:
CODEkubernetes: contexts: - name: aks-cl-1 defaultNamespaceLOD: basic
This ensures that all namespaces within a cluster default to the specified LOD if no finer-grained settings exist.
Global Default LOD (
defaultLOD
) (Lowest Priority)If no context-specific
defaultNamespaceLOD
is set, the globaldefaultLOD
is applied.Example:
CODEdefaultLOD: none
This applies only when no other settings define the LOD.
Example Configuration
workspaceName: "my-workspace"
defaultLOD: none
cloudConfig:
kubernetes:
kubeconfigFile: /shared/kubeconfig
contexts:
sandbox-cluster-1:
defaultNamespaceLOD: basic
In the example above, all namespaces within the sandbox-cluster-1
context will be discovered with a basic
LOD.
Discovery Exclusions
In order to exclude resources from discovery, the following Kubernetes labels or annotations can be applied to the object:
Annotation:
config.runwhen.com/ignore: "true"
Label:
runwhen-local: "ignore"
Additionally, users may add custom annotations or labels into the workspaceInfo configuration file using the excludeAnnotations
or excludeLabels
options, such as:
cloudConfig:
kubernetes:
excludeAnnotations:
config.runwhen.com/discovery: "exclude"
excludeLabels:
runwhen: "exclude"
Level of Detail Annotations
The following annotations can be applied to Kubernetes namespaces to specify the Level of Detail applied during discovery. This setting will override the Level of Detail configuration in the workspaceInfo file.
config.runwhen.com/lod: [none, basic, detailed]
Resource Owner Annotations
The owner of a resource can also be annotated on a Kubernetes object, allowing for easier synamic assignment of SLX owners:
config.runwhen.com/owner: "owner@here.com"