Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Kubernetes resource observation tool

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the Kubernetes resource observation tool, which is very detailed and has a certain reference value. Friends who are interested must finish it!

Preface

This time, we will introduce a Kubernetes resource observation tool that monitors the creation, update and deletion of various resources in the Kubernetes cluster in real time, and notifies various collaborative / chat software in real time. Currently, the notification channels supported are:

Slack

Hipchat

Mattermost

Flock

Webhook

I have developed a nailing notification channel, but the contribution request made in the upstream ISSUE#198 has not been answered, so this side can only fork the code, and then develop it myself to support nailing notification.

Installation

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=true

If you want to use nail notification, you can pull my code on GitHub, which contains the helm chart package, which can be installed directly

Git clone https://github.com/sunny0826/kubewatch-chat.gitcd kubewatch-chathelm install kubewatch kubewatch\-set dingtalk.sign= "XXX"\-set dingtalk.token= "XXXX-XXXX-XXXX" nail configuration

Create a smart group assistant in the nail, and then

Get token

Https://oapi.dingtalk.com/robot/send?access_token={YOUR_TOKEN}, {YOUR_TOKEN} in the copied webhook is the token to be filled.

Security settin

The pin intelligent group assistant has added security settings after the update, which provides three verification methods to customize the IP address (segment) for custom keywords. It is recommended to use the IP address (segment). You can enter the exit IP of the Kubernetes cluster directly into the setting. It also provides a way to add the signature, copy the secret key and fill it into the dingtalk.sign.

Project configuration

Edit kubewatch/value.yaml, modify 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:#-myRegistryKeySecretNameslack: 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 watchresourcesToWatch: deployment: true replicationcontroller: false replicaset: false daemonset: false services: false pod: true job: false persistentvolume: falseimage: 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: trueserviceAccount: # 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: 1

Install using value.yaml

Git clone https://github.com/sunny0826/kubewatch-chat.gitcd kubewatch-chathelm install my-release-f kubewatch/values.yamlSlack configuration

Slack is the default notification software for kubewatch. Here we will not introduce the installation and registration of Slack, but start with the creation of APP.

Create an APP

Go in and create an APP page

Select App Name and Development Slack Workspace

Add Bot user

Add App to Workspace

Get Bot-token

Notification effect

In Slack, create update deletions represented by green, yellow, and red, respectively

In the nails, I have carried out Sinicization.

Conclusion

For kubewatch, we are mainly used to monitor the timing trigger status of various CronJob, and the status changes of ConfigMap and Secrets. At the same time, we can also observe the status of auto scaling triggered by HPA. It is a good gadget to observe the arrival of business peak in real time.

The above is all the contents of the article "how to use the Kubernetes Resource observation tool". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report