Home

Awesome

<p align="center"> <a href="https://kwatch.dev"> <img src="./assets/logo.png" width="30%"/> </a> <br /> <a href="https://kwatch.dev"> <img src="https://img.shields.io/badge/%F0%9F%92%A1%20kwatch-website-00ACD7.svg" /> </a> <a href="https://godoc.org/github.com/abahmed/kwatch"> <img src="https://godoc.org/github.com/abahmed/kwatch?status.png" /> </a> <a href="https://github.com/abahmed/kwatch/actions/workflows/check.yaml"> <img src="https://github.com/abahmed/kwatch/workflows/Check/badge.svg?branch=main" /> </a> <a href="https://goreportcard.com/report/github.com/abahmed/kwatch"> <img src="https://goreportcard.com/badge/github.com/abahmed/kwatch" /> </a> <a href="https://codecov.io/gh/abahmed/kwatch"> <img src="https://codecov.io/gh/abahmed/kwatch/branch/main/graph/badge.svg?token=ZMCU75JJO7"/> </a> <a href="https://github.com/abahmed/kwatch/releases/latest"> <img src="https://img.shields.io/github/v/release/abahmed/kwatch?label=kwatch" /> </a> <a href="https://discord.gg/kzJszdKmJ7"> <img src="https://img.shields.io/discord/911647396918870036?label=Discord&logo=discord"> </a> </p>

kwatch helps you monitor all changes in your Kubernetes(K8s) cluster, detects crashes in your running apps in realtime, and publishes notifications to your channels (Slack, Discord, etc.) instantly

⚡️ Getting Started

Install

Using Helm

helm repo add kwatch https://kwatch.dev/charts
helm install [RELEASE_NAME] kwatch/kwatch --namespace kwatch --create-namespace --version 0.10.1

To get more details, please check chart's configuration

Using kubectl

You need to get config template to add your configs

curl  -L https://raw.githubusercontent.com/abahmed/kwatch/v0.10.1/deploy/config.yaml -o config.yaml

Then edit config.yaml file and apply your configuration

kubectl apply -f config.yaml

To deploy kwatch, execute following command:

kubectl apply -f https://raw.githubusercontent.com/abahmed/kwatch/v0.10.1/deploy/deploy.yaml

High Level Architecture

<p> <img src="./assets/highlevelarchitecture.png" width="70%"/> </p>
PointURL
4.1https://github.com/abahmed/kwatch/blob/main/main.go#L18
5.1.https://github.com/abahmed/kwatch/blob/main/main.go#L21 / 24
6.1.https://github.com/abahmed/kwatch/blob/main/main.go#L36
7.0.https://github.com/abahmed/kwatch/blob/main/main.go#L40
7.1.https://github.com/abahmed/kwatch/blob/main/upgrader/upgrader.go#L16
8.1.&8.2https://github.com/abahmed/kwatch/blob/main/main.go#L46 / 52
8.3.https://github.com/abahmed/kwatch/blob/main/main.go#L53
9.0.https://github.com/abahmed/kwatch/blob/main/main.go#L58
9.1.https://github.com/abahmed/kwatch/blob/main/controller/start.go#L20
9.2.https://github.com/abahmed/kwatch/blob/main/controller/controller.go#L37
9.3.https://github.com/abahmed/kwatch/blob/main/controller/controller.go
9.4.https://github.com/abahmed/kwatch/tree/main/provider

Configuration

General

ParameterDescription
maxRecentLogLinesOptional Max tail log lines in messages, if it's not provided it will get all log lines
namespacesOptional list of namespaces that you want to watch or forbid, if it's not provided it will watch all namespaces. If you want to forbid a namespace, configure it with !<namespace name>. You can either set forbidden namespaces or allowed, not both.
reasonsOptional list of reasons that you want to watch or forbid, if it's not provided it will watch all reasons. If you want to forbid a reason, configure it with !<reason>. You can either set forbidden reasons or allowed, not both.
ignoreFailedGracefulShutdownIf set to true, containers which are forcefully killed during shutdown (as their graceful shutdown failed) are not reported as error
ignoreContainerNamesOptional list of container names to ignore
ignorePodNamesOptional list of pod name regexp patterns to ignore
IgnoreLogPatternsOptional list of regexp patterns of logs to ignore

App

ParameterDescription
app.proxyURLused in outgoing http(s) requests except Kubernetes requests to cluster optionally
app.clusterNameused in notifications to indicate which cluster has issue
app.disableStartupMessageIf set to true, welcome message will not be sent to notification channels
app.logFormatterused for setting custom formatter when app prints logs: text, json (default: text)

Upgrader

ParameterDescription
upgrader.disableUpdateCheckIf set to true, does not check for and notify about kwatch updates

PVC Monitor

ParameterDescription
pvcMonitor.enabledto enable or disable this module (default: true)
pvcMonitor.intervalthe frequency (in minutes) to check pvc usage in the cluster (default: 15)
pvcMonitor.thresholdthe percentage of accepted pvc usage. if current usage exceeds this value, it will send a notification (default: 80)

Node Monitor

ParameterDescription
nodeMonitor.enabledto enable or disable node monitoring (default: true)

Alerts

Slack

<p> <img src="./assets/slack.png" width="30%"/> </p>

If you want to enable Slack, provide the webhook with optional text and title

ParameterDescription
alert.slack.webhookSlack webhook URL
alert.slack.channelUsed by legacy webhooks to send messages to specific channel instead of default one
alert.slack.titleCustomized title in slack message
alert.slack.textCustomized text in slack message

Discord

<p> <img src="./assets/discord.png" width="30%"/> </p>

If you want to enable Discord, provide the webhook with optional text and title

ParameterDescription
alert.discord.webhookDiscord webhook URL
alert.discord.titleCustomized title in discord message
alert.discord.textCustomized text in discord message

Email

<p> <img src="./assets/email.png" width="50%"/> </p>

If you want to enable Email, provide the from and to emails with host and the port

ParameterDescription
alert.email.fromFrom email
alert.email.passwordFrom email Password
alert.email.hostprovide the host
alert.email.portprovide the port
alert.email.tothe receiver email

PagerDuty

<p> <img src="./assets/pagerduty.png" width="50%"/> </p>

If you want to enable PagerDuty, provide the integration key

ParameterDescription
alert.pagerduty.integrationKeyPagerDuty integration key more info

Telegram

<p> <img src="./assets/telegram.png" width="50%"/> </p>

If you want to enable Telegram, provide a valid token and the chat Id.

ParameterDescription
alert.telegram.tokenTelegram token
alert.telegram.chatIdTelegram chat id

Microsoft Teams

<p> <img src="./assets/teams.png" width="50%"/> </p>

If you want to enable Microsoft Teams, provide the channel webhook.

ParameterDescription
alert.teams.webhookwebhook Microsoft team
alert.teams.titleCustomized title in Microsoft teams message
alert.teams.textCustomized title in Microsoft teams message

Rocket Chat

<p> <img src="./assets/rocketchat.png" width="50%"/> </p>

If you want to enable Rocket Chat, provide the webhook with optional text

ParameterDescription
alert.rocketchat.webhookRocket Chat webhook URL
alert.rocketchat.textCustomized text in rocket chat message

Mattermost

<p> <img src="./assets/mattermost.png" width="45%"/> </p>

If you want to enable Mattermost, provide the webhook with optional text and title

ParameterDescription
alert.mattermost.webhookMattermost webhook URL
alert.mattermost.titleCustomized title in Mattermost message
alert.mattermost.textCustomized text in Mattermost message

Opsgenie

<p> <img src="./assets/opsgenie.png" width="45%"/> </p>

If you want to enable Opsgenie, provide the API key with optional text and title

ParameterDescription
alert.opsgenie.apiKeyOpsgenie API Key
alert.opsgenie.titleCustomized title in Opsgenie message
alert.opsgenie.textCustomized text in Opsgenie message

Matrix

<p> <img src="./assets/matrix.png" width="45%"/> </p>

If you want to enable Matrix, provide homeServer, accessToken and internalRoomID with optional text and title

ParameterDescription
alert.matrix.homeServerHomeServer URL
alert.matrix.accessTokenAccount access token
alert.matrix.internalRoomIDInternal room ID
alert.matrix.titleCustomized title in message
alert.matrix.textCustomized text in message

DingTalk

If you want to enable DingTalk, provide accessToken with optional secret and title

ParameterDescription
alert.dingtalk.accessTokenChat access token
alert.dingtalk.secretOptional secret used to sign requests
alert.dingtalk.titleCustomized title in message

FeiShu

<p> <img src="./assets/feishu.png" width="45%"/> </p> If you want to enable FeiShu, provide accessToken with optional secret and title
ParameterDescription
alert.feishu.webhookFeiShu bot webhook URL
alert.feishu.titleCustomized title in message

Zenduty

<p> <img src="./assets/zenduty.png" width="45%"/> </p> If you want to enable Zenduty, provide IntegrationKey with optional alert type
ParameterDescription
alert.zenduty.integrationKeyZenduty integration Key
alert.zenduty.alertTypeOptional alert type of incident: critical, acknowledged, resolved, error, warning, info (default: critical)

Google Chat

<p> <img src="./assets/googlechat.png" width="50%"/> </p>

If you want to enable Rocket Chat, provide the webhook with optional text

ParameterDescription
alert.googlechat.webhookGoogle Chat webhook URL
alert.rocketchat.textCustomized text in Google Chat message

Custom webhook

If you want to enable custom webhook, provide url with optional headers and basic auth

ParameterDescription
alert.webhook.urlWebhook URL
alert.webhook.headersoptional list of name and value
alert.webhook.basicAuthoptional username and password

Cleanup

kubectl delete -f https://raw.githubusercontent.com/abahmed/kwatch/v0.10.1/deploy/config.yaml
kubectl delete -f https://raw.githubusercontent.com/abahmed/kwatch/v0.10.1/deploy/deploy.yaml

👍 Contribute & Support

🚀 Who uses kwatch?

kwatch is being used by multiple entities including, but not limited to

<img src="./assets/users/trella.png"/> <img src="./assets/users/ibec-systems.svg" width="50%"/> <img src="./assets/users/justwatch.png" width="50%"/>

If you want to add your entity, open issue to add it

💻 Contributors

<a href="https://github.com/abahmed/kwatch/graphs/contributors"> <img src="https://contributors-img.firebaseapp.com/image?repo=abahmed/kwatch" /> </a>

⭐️ Stargazers

<img src="https://starchart.cc/abahmed/kwatch.svg" alt="Stargazers over time" style="max-width: 100%">

👋 Get in touch

Feel free to chat with us on Discord if you have questions, or suggestions

⚠️ License

kwatch is licensed under MIT License