preface
This time to introduce a Kubernetes resource observation tool, real-time monitoring Kubernetes cluster of all kinds of new resources, update and delete, and real-time notification to a variety of collaboration software/chat software, currently support notification channels have:
slack
hipchat
mattermost
flock
webhook
My side developed the nail notification channel, but the contribution request made in ISSUE#198 upstream did not get a response, so they had to fork the code and develop it themselves to support the nail notification.
The installation
You are advised to use the HELM for rapid deployment
helm install kubewatch stable/kubewatch \
--set rbac.create=true \
--set slack.channel='#YOUR_CHANNEL' \
--set slack.token='xoxb-YOUR_TOKEN' \
--set resourcesToWatch.pod=true \
--set resourcesToWatch.daemonset=trueCopy the code
If you want to use pin notifications, you can pull up my code on GitHub, which contains the Helm Chart package, and install it directly
git clone https://github.com/sunny0826/kubewatch-chat.git
cd kubewatch-chat
helm install kubewatch kubewatch \
--set dingtalk.sign="XXX" \
--set dingtalk.token="XXXX-XXXX-XXXX"Copy the code
Nailing configuration
Create smart swarm assistant in pin, and then
Access token
Copying the webhook https://oapi.dingtalk.com/robot/send?access_token= {YOUR_TOKEN}, {YOUR_TOKEN} is to fill in the token.
Security Settings
Smart group assistant in the update after the addition of security Settings, to provide three kinds of authentication methods to customize the keyword signed IP address (segment), here recommend the use of IP address (segment), directly Kubernetes cluster export IP fill in the Settings. It also provides the option of signing a copy of the key into dingtalk.sign.
Project configuration
Edit kubewatch/value.yaml to modify the configuration
## Global Docker image parameters ## Please, note that this will override the image parameters, including dependencies, configured to use the global value ## Current available global Docker image parameters: imageRegistry and imagePullSecrets ## # global: # imageRegistry: myRegistryName # imagePullSecrets: # - myRegistryKeySecretName slack: enabled: false channel: "" token: "xoxb" hipchat: enabled: false # room: "" # token: "" # url: "" mattermost: enabled: false # channel: "" # url: "" # username: "" flock: enabled: false # url: "" webhook: enabled: false # url: "" dingtalk: enabled: true token: "" sign: "" # namespace to watch, leave it empty for watching all. namespaceToWatch: "" # Resources to watch resourcesToWatch: deployment: true replicationcontroller: false replicaset: false daemonset: false services: false pod: true job: false persistentvolume: false image: registry: docker.io # repository: bitnami/kubewatch repository: Guoxudongdocker/kubewatch - chart # tag: 0.0.4 debian - 9 - r405 tag: latest pullPolicy: Always ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ ## # pullSecrets: # - myRegistryKeySecretName ## String to partially override kubewatch.fullname template (will maintain the release name) ## # nameOverride: ## String to fully override kubewatch.fullname template ## # fullnameOverride: rbac: # If true, create & use RBAC resources # create: true serviceAccount: # Specifies whether a ServiceAccount should be created create: true # The name of the ServiceAccount to use. # If not set and create is true, a name is generated using the fullname template name: resources: {} # limits: # cpu: 100m # memory: 300Mi # requests: # cpu: 100m # memory: 300Mi # Affinity for pod assignment # Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity # affinity: {} # Tolerations for pod assignment # Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ tolerations: [] # Node labels for pod assignment # Ref: https://kubernetes.io/docs/user-guide/node-selection/ nodeSelector: {} podAnnotations: {} podLabels: {} replicaCount: 1Copy the code
Install using value.yaml
git clone https://github.com/sunny0826/kubewatch-chat.git
cd kubewatch-chat
helm install my-release -f kubewatch/values.yamlCopy the code
Slack configuration
Slack is the default notification software for Kubewatch. This article will not introduce the installation and registration of Slack
Create an APP
Go to the create APP page
Select App Name and Development Slack Workspace
Adding a Bot User
Add App to Workspace
Get the Bot – token
Notify the effect
In Slack, creating updates and deletions are represented in green, yellow, and red
In Dingding, I carried out the Chinese
conclusion
As for Kubewatch, we mainly use it to monitor the timing triggering state of various cronjobs, including the state changes of ConfigMap and Secrets, as well as observe the elastic scaling state triggered by HPA, so as to observe the arrival of business peak in real time. It is a good small tool.