速看:世界最高海中大桥成功合龙
原标题:世界最高海中大桥成功合龙工人日报-中工网记者张翀通讯员王鑫洲杜才良李冕4月28日,广东省交通集团
在 Kubernetes 上,从部署 Deployment 到正常提供服务,整个流程可能会出现各种各样问题,有兴趣的可以浏览Kubernetes Deployment 的故障排查可视化指南(2021 中文版)[1]。从可视化指南也可能看出这些问题实际上都是有迹可循,根据错误信息基本很容易找到解决方法。随着 ChatGPT 的流行,基于 LLM 的文本生成项目不断涌现,k8sgpt[2]便是其中之一。
(资料图片仅供参考)
k8sgpt 是一个扫描 Kubernetes 集群、诊断和分类问题的工具。它将 SRE 经验编入其分析器,并通过 AI 帮助提取并丰富相关的信息。
其内置了大量的分析器:
podAnalyzerpvcAnalyzerrsAnalyzerserviceAnalyzereventAnalyzeringressAnalyzerstatefulSetAnalyzerdeploymentAnalyzercronJobAnalyzernodeAnalyzerhpaAnalyzer(可选)pdbAnalyzer(可选)networkPolicyAnalyzer(可选)k8sgpt 的能力是通过 CLI 来提供的,通过 CLI 可以对集群中的错误进行快速的诊断。
k8sgpt analyze --explain --filter=Pod --namespace=default --output=json{ "status": "ProblemDetected", "problems": 1, "results": [ { "kind": "Pod", "name": "default/test", "error": [ { "Text": "Back-off pulling image \"flomesh/pipy2\"", "Sensitive": [] } ], "details": "The Kubernetes system is experiencing difficulty pulling the requested image named \"flomesh/pipy2\". \n\nThe solution may be to check that the image is correctly spelled or to verify that it exists in the specified container registry. Additionally, ensure that the networking infrastructure that connects the container registry and Kubernetes system is working properly. Finally, check if there are any access restrictions or credentials required to pull the image and ensure they are provided correctly.", "parentObject": "test" } ]}
但是,每次进行诊断都要执行命令,有点繁琐且限制较多。我想大家想要的肯定是能够监控到问题并自动诊断。这就有了今天要介绍的k8sgpt-operator[3]
介绍简单来说 k8sgpt-operator 可以在集群中开启自动化的 k8sgpt。它提供了两个 CRD:K8sGPT和Result。前者可以用来设置 k8sgpt 及其行为;而后者则是用来展示问题资源的诊断结果。
apiVersion: core.k8sgpt.ai/v1alpha1kind: K8sGPTmetadata: name: k8sgpt-sample namespace: kube-systemspec: model: gpt-3.5-turbo backend: openai noCache: false version: v0.2.7 enableAI: true secret: name: k8sgpt-sample-secret key: openai-api-key
演示实验环境使用 k3s 集群。
export INSTALL_K3S_VERSION=v1.23.8+k3s2curl -sfL https://get.k3s.io | sh -s - --disable traefik --disable local-storage --disable servicelb --write-kubeconfig-mode 644 --write-kubeconfig ~/.kube/config
安装 k8sgpt-operatorhelm repo add k8sgpt https://charts.k8sgpt.ai/helm repo updatehelm install release k8sgpt/k8sgpt-operator -n openai --create-namespace
安装完成后,可以看到随 operator 安装的两个 CRD:k8sgpts和results。
kubectl api-resources | grep -i gptk8sgpts core.k8sgpt.ai/v1alpha1 true K8sGPTresults core.k8sgpt.ai/v1alpha1 true Result
在开始之前,需要先生成一个OpenAI 的 key[4],并保存到 secret 中。
OPENAI_TOKEN=xxxxkubectl create secret generic k8sgpt-sample-secret --from-literal=openai-api-key=$OPENAI_TOKEN -n openai
接下来创建 K8sGPT 资源。
kubectl apply -n openai -f - << EOFapiVersion: core.k8sgpt.ai/v1alpha1kind: K8sGPTmetadata: name: k8sgpt-samplespec: model: gpt-3.5-turbo backend: openai noCache: false version: v0.2.7 enableAI: true secret: name: k8sgpt-sample-secret key: openai-api-keyEOF
执行完上面的命令后在openai命名空间下会自动创建Deploymentk8sgpt-deployment。
测试使用一个不存在的镜像创建 pod。
kubectl run test --image flomesh/pipy2 -n default
然后在openai命名空间下会看到一个名为defaulttest的资源。
kubectl get result -n openaiNAME AGEdefaulttest 5m7s
详细信息中可以看到诊断内容以及出现问题的资源。
kubectl get result -n openai defaulttest -o yamlapiVersion: core.k8sgpt.ai/v1alpha1kind: Resultmetadata: creationTimestamp: "2023-05-02T09:00:32Z" generation: 1 name: defaulttest namespace: openai resourceVersion: "1466" uid: 2ee27c26-61c1-4ef5-ae27-e1301a40cd56spec: details: "The error message is indicating that Kubernetes is having trouble pulling the image \"flomesh/pipy2\" and is therefore backing off from trying to do so. \n\nThe solution to this issue would be to check that the image exists and that the spelling and syntax of the image name is correct. Additionally, check that the image is accessible from the Kubernetes cluster and that any required authentication or authorization is in place. If the issue persists, it may be necessary to troubleshoot the network connectivity between the Kubernetes cluster and the image repository." error: - text: Back-off pulling image "flomesh/pipy2" kind: Pod name: default/test parentObject: test
参考资料[1]Kubernetes Deployment 的故障排查可视化指南(2021 中文版):https://atbug.com/troubleshooting-kubernetes-deployment-zh-v2/
[2]k8sgpt:https://github.com/k8sgpt-ai/k8sgpt
[3]k8sgpt-operator:https://github.com/k8sgpt-ai/k8sgpt-operator
[4]OpenAI 的 key:https://platform.openai.com/account/api-keys
关键词:
原标题:世界最高海中大桥成功合龙工人日报-中工网记者张翀通讯员王鑫洲杜才良李冕4月28日,广东省交通集团
App5月3日消息,英飞凌公司正推动其碳化硅(SiC)供应商体系多元化,并与中国碳化硅材料供应商北京天科合达
周三,英镑 日元下跌0 13%至169 890附近。英镑方面,劳埃德银行第一季度法定税前利润22 6亿英镑,预估20 4
智通财经APP获悉,香港联交所最新资料显示,4月27日,贝莱德增持赣锋锂业234 22万股,每股作价52 0542港元
华测导航近期披露投资者关系活动记录表显示,公司攻坚SWAS广域增强系统核心算法和打造全球星地一体增强网络
电力行业2022年报及2023年一季报总结:火电复苏超预期新能源高增将至
德赛西威作为横跨新能源和计算机两大主题的个股在市场中有一定的稀缺性。总结来看,机构的调研方向开始逐渐
1、前言来款小巧玲珑的绿豆饼,酥松饼皮,表面不留油渍,饱满内馅,美味细腻的口感!闻之有淡淡的面点香气
版权保护:本网登载的内容(包括文字、图片、多媒体资讯等)版权属中国日报网(中报国际文化传媒(北京)有
熟悉的感觉又回来啦!!!“五一”小长假如约而至各地游客纷至沓来而在黄龙县白马滩镇同样开启了游客不一样
夫妻同心坚守“五一”---节日期间,武汉市中心医院杨春湖院区的建设工地上,来自四川的詹金凤、王磊夫妇坚
AMDR5-5600采用7nm制程、Zen3架构和AM4接口,拥有6核心12线程,基础频率3 6GHz,最大频率4 4GHz,相比5500
欢迎观看本篇文章,小勉来为大家解答以上问题。微信号怎么修改,如何修改微信号很多人还不知道,现在让我们
南宁市人才市场电话服务中心电话,南宁市人才市场电话这个很多人还不知道,现在让我们一起来看看吧!1、南宁
1、1号瓶:容量:750mlwinebottle;高:315mm;底直径:70mm。2、瓶口外直径:29mm;瓶口内直径
Copyright 2015-2022 华东双创网 版权所有 备案号:京ICP备2022016840号-41 联系邮箱:2 913 236 @qq.com
随着全光网络越织越密 如何进一步增强消费者和产业界的“获得感”?
近年来,在5G和宽带双千兆牵引下,新项目、新试点、新应用层出不穷。随着全光网络越织越密,如何进一步增强消费者和产业界的获得感?湖北日
致敬老将!热爱可抵岁月漫长
<script src="http: tv people com cn img player v js">< script><script>showPlayer({id:" pvservice xml 202
微视频|字里藏情迎元宵
<script src="http: tv people com cn img player v js">< script><script>showPlayer({id:" pvservice xml 202