這篇文章主要介紹Kubernetes資源觀測工具怎么用,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的運(yùn)河網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
這次要介紹一個(gè) Kubernetes 資源觀測工具,實(shí)時(shí)監(jiān)控 Kubernetes 集群中各種資源的新建、更新和刪除,并實(shí)時(shí)通知到各種協(xié)作軟件/聊天軟件,目前支持的通知渠道有:
slack
hipchat
mattermost
flock
webhook
我這邊開發(fā)了釘釘?shù)耐ㄖ溃窃谏嫌?ISSUE#198 中提出的貢獻(xiàn)請(qǐng)求并沒有得到回應(yīng),所以這邊只能 fork 了代碼,然后自己進(jìn)行了開發(fā),以支持釘釘通知。
這里推薦使用 helm 進(jìn)行安裝,快速部署
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
如果想使用釘釘通知,則可以在 GitHub 上拉取我的代碼,代碼中包含 helm chart 包,可直接進(jìn)行安裝
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"
在釘釘中創(chuàng)建 智能群助手 ,之后
復(fù)制的 webhook 中 https://oapi.dingtalk.com/robot/send?access_token={YOUR_TOKEN}, {YOUR_TOKEN} 就是要填入的 token。

釘釘智能群助手在更新后新增了安全設(shè)置,提供三種驗(yàn)證方式 自定義關(guān)鍵詞 加簽 IP地址(段),這里推薦使用 IP地址(段)的方式,直接將 Kubernetes 集群的出口 IP 填入設(shè)置即可。同時(shí)也提供了 加簽 的方式,拷貝秘鑰,將其填入 dingtalk.sign 中。

編輯 kubewatch/value.yaml ,修改配置
## 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: 1使用 value.yaml 安裝
git clone https://github.com/sunny0826/kubewatch-chat.git cd kubewatch-chat helm install my-release -f kubewatch/values.yaml
Slack 為 kubewatch 默認(rèn)的通知軟件,這里就不簡介 Slack 的安裝和注冊(cè),直接從創(chuàng)建 APP 開始
進(jìn)去創(chuàng)建 APP 頁面

選擇 App Name 和 Development Slack Workspace




在 Slack 中,創(chuàng)建 更新 刪除 分別以綠、黃和紅色代表

在釘釘中,我進(jìn)行了漢化


對(duì)于 kubewatch 我們這里主要用作監(jiān)控各種 CronJob 的定時(shí)觸發(fā)狀態(tài),已經(jīng) ConfigMap 和 Secrets 的狀態(tài)變化,同時(shí)也觀察 HPA 觸發(fā)的彈性伸縮的狀態(tài),可以實(shí)時(shí)觀測到業(yè)務(wù)高峰的到來,是一個(gè)不錯(cuò)的小工具。
以上是“Kubernetes資源觀測工具怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
當(dāng)前文章:Kubernetes資源觀測工具怎么用
本文鏈接:http://chinadenli.net/article2/gdgsoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、標(biāo)簽優(yōu)化、網(wǎng)站設(shè)計(jì)公司、建站公司、網(wǎng)頁設(shè)計(jì)公司、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)