Annotations

Fine-tuning the Kubewise Kubernetes Agent

You have the ability to customize the behavior of the Kubewise Kubernetes agent for each Kubernetes resource.

Note

Kubernetes only accepts string values for annotations, please make sure all values are quoted.

General Annotations

To modify the default behavior of the agent, you can set the following configurations as resource annotations in Kubernetes.

  • kubewise.io/watch: "<bool>" (optional - defaults to the K8s agent’s watchByDefault value, which is true by default). Indicates whether the resource needs to be watched by the Kubewise agent.
  • kubewise.io/crash-log: "<bool>" (optional - defaults to the K8s agent’s collectLogsOnWatchedPodsCrashes value, which is true by default). Indicates whether logs need to be collected when a crash occurs.
  • kubewise.io/crash-log-duration: "<golang_duration>" (optional - defaults to 5s). The duration of logs that should be collected in case of a crash. If set, the value must be in the Golang duration format. Valid units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.
  • kubewise.io/crash-log-length: "<int>" (optional - defaults to 10). The number of lines (from the last one) to be collected in case of a crash. If both crash-log-length and crash-log-duration are set, the agent will use the crash-log-duration value and ignore the crash-log-length value.

If any of these annotations fail to be parsed, the default value will be applied, and a warning message will be logged by the agent.

Although almost all Kubernetes resources can be annotated, the agent will ignore those annotations on nodes, horizontal pod autoscalers, network policies, storage classes, and namespaces.

If you want to restrict which namespaces are watched by the agent, please refer to the agent configuration.

Additionally, some Kubernetes resources will not be watched even if the watch annotation is set to true: ReplicaSets that are not managed by a Deployment, Jobs that are not triggered by a CronJob, and standalone Pods.

Pricing Annotations

If you plan to use Kubewise’s cluster cost breakdown tool, you will need to add the following annotations:

On nodes:

  • kubewise.io/price_hour: "<float>": The price per hour for the node. The value must not contain any currency sign, only a quoted numerical value (e.g., "0.12345"—for decimal values, use a point . and not a comma ,).

On storage classes:

  • kubewise.io/price_gb_hour: "<float>": The price per gibibyte (2^30 bytes) per hour for the storage class. The value must not contain any currency sign, only a quoted numerical value (e.g., "0.12345"—for decimal values, use a point . and not a comma ,).

Kubewise is planning on directly integrating with cloud providers billing API in the future, to give a more detailed break down.