k8s-watcher

by Komodor

Helm chartv1.18.17App 0.2.79Verified publisher

Watches and sends kubernetes resource-related events

About this chart

Komodor.io


:rotating_light: k8s-watcher Helm Chart Deprecation

We want to inform our users that the k8s-watcher Helm Chart will be deprecated in the near future. This decision has been made to streamline our Helm Chart offerings and provide a more unified and enhanced user experience.

We will be replacing k8s-watcher with a new Helm chart named komodor-agent. The komodor-agent chart is designed with common best practices, enhanced scalability, and easier configuration in mind. We encourage all users to transition to the komodor-agent Helm chart at their earliest convenience to benefit from these improvements.

Further details regarding the transition process, including the migration guide, will be shared shortly. In the meantime, feel free to reach out to our support team if you have any questions or need assistance with the migration.

Thank you for your understanding and cooperation.


TL;DR;

helm repo add komodorio https://helm-charts.komodor.io
helm repo update
helm upgrade --install k8s-watcher komodorio/k8s-watcher --set apiKey=YOUR_API_KEY_HERE --set watcher.clusterName=CLUSTER_NAME --set watcher.allowReadingPodLogs=true --set watcher.enableAgentTaskExecution=true --set watcher.enableAgentTaskExecutionV2=true --set watcher.enableHelm=true  --set helm.enableActions=true --wait --timeout=90s

In case of error try contact us for assistance via intercom at: https://app.komodor.com Or run:

  1. Logs of k8s-watcher
kubectl logs --tail=10 deployment/k8s-watcher  -n komodor
  1. Helm status
helm status k8s-watcher
  1. Reinstall
helm uninstall helm-k8s-watcher

Introduction

This chart bootstraps a Kubernetes Resources/Event Watcher deployment on a Kubernetes cluster using the Helm package manager.

Supported architectures

  • [x] linux/amd64
  • [x] linux/arm64

Prerequisites

  • Kubernetes 1.19+ (older versions not officially supported)
  • Helm 2/3

Installing the Chart

To install the chart with the release name k8s-watcher:

helm upgrade --install k8s-watcher komodorio/k8s-watcher --create-namespace --set apiKey=YOUR_API_KEY_HERE --set watcher.clusterName=CLUSTER_NAME

The command deploys the Komodor K8S-Watcher on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Api Key

The Komodor kubernetes api key can be provided in the helm upgrade command, in the values.yaml file or can be taken from an existing kubernetes secret resource. When using an existing kubernetes secret resource, specify the secret name in existingSecret and store the api key under the name 'apiKey'.

Uninstalling the Chart

To uninstall/delete the k8s-watcher deployment:

Helm 3:

helm uninstall k8s-watcher

Helm 2:

helm delete --purge k8s-watcher

The command removes all the Kubernetes components associated with the chart and deletes the release.

Alternative: Install without Helm

To install the chart directly with kubectl, use the manifests located in ./kube-install.

  1. Make sure to set the apiKey (as base 64) secret value in ./kube-install/k8s-watcher/templates/secret-credentials.yaml
    • KOMOKW_APIKEY=YOUR_APIKEY sed -i "s/YOUR_APIKEY_AS_BASE_64/$(echo $KOMOKW_APIKEY | base64)/g" kube-install/k8s-watcher/templates/secret-credentials.yaml
  2. Make sure to set the cluster name in ./kube-install/k8s-watcher/templates/*.yaml
    • CLUSTER_NAME=YOUR_CLUSTER_NAME sed -i "s/YOUR_CLUSTER_NAME/$CLUSTER_NAME/g" kube-install/k8s-watcher/templates/*.yaml
  3. Then just apply everything in order:
    • kubectl apply -f ./kube-install/k8s-watcher/templates/namespace.yaml
    • kubectl apply -f ./kube-install/k8s-watcher/templates

Configuration

The following table lists the configurable parameters of the chart and their default values.

ParameterDescriptionDefault
apiKeyKomodor kubernetes api key (required if existingSecret not specified)``
existingSecretExisting kubernetes secret resource containing Komodor kubernetes apiKey (required if apiKey not specified)``
tagsTags the agent in order to identify it based on key:value properties separated by semicolon (;) - example: --set tags="env:staging;team:product-a" --- Can also be set in the values under watcher.tags as a dictionary of key:value strings``
enableRWCacheMounts a ReadWrite cache volume for the kubernetes api cachetrue
watcher.actions.basicEnables basic actions (Delete pods. Scale and restart deployments, statefulsets, replicasets. Restart and trigger jobs)false
watcher.actions.advancedEnables advanced actions (Update, Create and Delete resources)false
watcher.actions.podExecEnables executing arbitrary commands in pod containersfalse
watcher.actions.portforwardEnables port-forwarding for podsfalse
watcher.redactList of regular expressions. Config values for keys that matches one of these expressions will show up at Komodor as "REDACTED:<SHA of config value>"[]
watcher.redactLogsList of regular expressions. Patterns in Logs that matches one of these expressions will show up at Komodor as <REDACTED>[]
watcher.enableHelmEnables reporting of unredacted secrets of type "helm.sh/release.v1" containing helm releases datatrue
watcher.clusterNameCluster name to be displayed in the komodor web application (required)``
watcher.watchNamespaceWatch a specific namespace, or all namespaces ("", "all")all
watcher.namespacesDenylistExclude specific namespaces (list)[]
watcher.logsNamespacesDenylistExclude the ability to fetch container logs from specific namespaces (list)[]
watcher.logsNamespacesAllowlistInclude the ability to fetch container logs for specific namespaces only (list)[]
watcher.nameDenylistExclude specific resource names that contains any of these strings (list) - example: watcher.nameDenylist=["dont-watch"] --> `pod/backend-dont-watch` wont be collected[]
watcher.collectHistoryOn startup collect existing cluster resources in addition to watching new resources (true / false)true
watcher.collectHistoryFromAllows configuring specific resources to list on startup instead of everything (default). []string - example: watcher.collectHistoryFrom=["deployment","daemonset","statefulset"] or KOMOKW_COLLECT_HISTORY_FROM="deployment daemonset statefulset"""
watcher.monitoringFQDNIf you have custom FQDN for you monitoring tool (e.x. Prometheus)https:/www.myPrometheusServer.com
watcher.sinks.webhook.headersHeaders to attach to the webhooks{}
watcher.resources.eventEnables watching Eventtrue
watcher.resources.deploymentEnables watching Deploymentstrue
watcher.resources.replicationControllerEnables watching ReplicationControllerstrue
watcher.resources.replicaSetEnables watching ReplicaSetstrue
watcher.resources.daemonSetEnables watching DaemonSetstrue
watcher.resources.statefulSetEnables wat

Deploy k8s-watcher with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has k8s-watcher on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartk8s-watcher is pinned at v1.18.17 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply