k8s-watcher
by Komodor
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:
- Logs of k8s-watcher
kubectl logs --tail=10 deployment/k8s-watcher -n komodor
- Helm status
helm status k8s-watcher
- 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.
- Make sure to set the apiKey (as base 64) secret value in
./kube-install/k8s-watcher/templates/secret-credentials.yamlKOMOKW_APIKEY=YOUR_APIKEY sed -i "s/YOUR_APIKEY_AS_BASE_64/$(echo $KOMOKW_APIKEY | base64)/g" kube-install/k8s-watcher/templates/secret-credentials.yaml
- Make sure to set the cluster name in
./kube-install/k8s-watcher/templates/*.yamlCLUSTER_NAME=YOUR_CLUSTER_NAME sed -i "s/YOUR_CLUSTER_NAME/$CLUSTER_NAME/g" kube-install/k8s-watcher/templates/*.yaml
- Then just apply everything in order:
kubectl apply -f ./kube-install/k8s-watcher/templates/namespace.yamlkubectl apply -f ./kube-install/k8s-watcher/templates
Configuration
The following table lists the configurable parameters of the chart and their default values.
| Parameter | Description | Default |
|---|---|---|
apiKey | Komodor kubernetes api key (required if existingSecret not specified) | `` |
existingSecret | Existing kubernetes secret resource containing Komodor kubernetes apiKey (required if apiKey not specified) | `` |
tags | Tags 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 | `` |
enableRWCache | Mounts a ReadWrite cache volume for the kubernetes api cache | true |
watcher.actions.basic | Enables basic actions (Delete pods. Scale and restart deployments, statefulsets, replicasets. Restart and trigger jobs) | false |
watcher.actions.advanced | Enables advanced actions (Update, Create and Delete resources) | false |
watcher.actions.podExec | Enables executing arbitrary commands in pod containers | false |
watcher.actions.portforward | Enables port-forwarding for pods | false |
watcher.redact | List 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.redactLogs | List of regular expressions. Patterns in Logs that matches one of these expressions will show up at Komodor as <REDACTED> | [] |
watcher.enableHelm | Enables reporting of unredacted secrets of type "helm.sh/release.v1" containing helm releases data | true |
watcher.clusterName | Cluster name to be displayed in the komodor web application (required) | `` |
watcher.watchNamespace | Watch a specific namespace, or all namespaces ("", "all") | all |
watcher.namespacesDenylist | Exclude specific namespaces (list) | [] |
watcher.logsNamespacesDenylist | Exclude the ability to fetch container logs from specific namespaces (list) | [] |
watcher.logsNamespacesAllowlist | Include the ability to fetch container logs for specific namespaces only (list) | [] |
watcher.nameDenylist | Exclude specific resource names that contains any of these strings (list) - example: watcher.nameDenylist=["dont-watch"] --> `pod/backend-dont-watch` wont be collected | [] |
watcher.collectHistory | On startup collect existing cluster resources in addition to watching new resources (true / false) | true |
watcher.collectHistoryFrom | Allows 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.monitoringFQDN | If you have custom FQDN for you monitoring tool (e.x. Prometheus) | https:/www.myPrometheusServer.com |
watcher.sinks.webhook.headers | Headers to attach to the webhooks | {} |
watcher.resources.event | Enables watching Event | true |
watcher.resources.deployment | Enables watching Deployments | true |
watcher.resources.replicationController | Enables watching ReplicationControllers | true |
watcher.resources.replicaSet | Enables watching ReplicaSets | true |
watcher.resources.daemonSet | Enables watching DaemonSets | true |
watcher.resources.statefulSet | Enables 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartk8s-watcher is pinned at v1.18.17 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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