当前位置: 首页 > news >正文

企业小程序制作开发寰宇seo

企业小程序制作开发,寰宇seo,怎么优化关键词排名优化,wordpress页面添加分类一、监控部署 1、将k8s集群中kube-state-metrics指标进行收集,服务进行部署 1.1 pod性能指标(k8s集群组件自动集成) k8s组件本身提供组件自身运行的监控指标以及容器相关的监控指标。通过cAdvisor 是一个开源的分析容器资源使用率和性能特性的…

一、监控部署
1、将k8s集群中kube-state-metrics指标进行收集,服务进行部署
1.1 pod性能指标(k8s集群组件自动集成)
k8s组件本身提供组件自身运行的监控指标以及容器相关的监控指标。通过cAdvisor 是一个开源的分析容器资源使用率和性能特性的代理工具,集成到 Kubelet中,当Kubelet启动时会同时启动cAdvisor,且一个cAdvisor只监控一个Node节点的信息。cAdvisor 自动查找所有在其所在节点上的容器,自动采集 CPU、内存、文件系统和网络使用的统计信息。cAdvisor 通过它所在节点机的 Root 容器,采集并分析该节点机的全面使用情况。
当然kubelet也会输出一些监控指标数据,因此pod的监控数据有kubelet和cadvisor,监控url分别为
https://NodeIP:10250/metrics
https://NodeIP:10250/metrics/cadvisor
1.2 K8S资源监控(k8s集群内部署)
kube-state-metrics是一个简单的服务,它监听Kubernetes API服务器并生成关联对象的指标。它不关注单个Kubernetes组件的运行状况,而是关注内部各种对象(如deployment、node、pod等)的运行状况。
注:先手动检查下集群,是否已经安装kube-state-metrics
在这里插入图片描述
如果集群没有安装,可参考如下步骤进行部署:

docker pull gcr.io/google_containers/kube-state-metrics:v1.6.0
// 镜像打标签,设置为当前k8s配置的镜像仓库地址
docker tag quay.io/coreos/kube-state-metrics:v1.9.0 dockerhub.kubekey.local/library/kube-state-metrics:v1.9.0
// 推进仓库
docker push dockerhub.kubekey.local/library/kube-state-metrics:v1.9.0

1.3 编辑kube-state-metrics.yml文件

vim kube-state-metrics.yml
---
apiVersion: v1
kind: ServiceAccount
metadata:labels:app: kube-state-metricsname: kube-state-metricsnamespace: prometheus
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: kube-state-metrics
rules:
- apiGroups: [""]resources:- configmaps- secrets- nodes- pods- services- resourcequotas- replicationcontrollers- limitranges- persistentvolumeclaims- persistentvolumes- namespaces- endpointsverbs: ["list", "watch"]
- apiGroups: ["extensions"]resources:- daemonsets- deployments- replicasets- ingressesverbs: ["list", "watch"]
- apiGroups: ["apps"]resources:- daemonsets- deployments- replicasets- statefulsetsverbs: ["list", "watch"]
- apiGroups: ["batch"]resources:- cronjobs- jobsverbs: ["list", "watch"]
- apiGroups: ["autoscaling"]resources:- horizontalpodautoscalersverbs: ["list", "watch"]
- apiGroups: ["policy"]resources:- poddisruptionbudgetsverbs: ["list", "watch"]
- apiGroups: ["certificates.k8s.io"]resources:- certificatesigningrequestsverbs: ["list", "watch"]
- apiGroups: ["storage.k8s.io"]resources:- storageclassesverbs: ["list", "watch"]
- apiGroups: ["autoscaling.k8s.io"]resources:- verticalpodautoscalersverbs: ["list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:labels:app: kube-state-metricsname: kube-state-metrics
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: kube-state-metrics
subjects:
- kind: ServiceAccountname: kube-state-metricsnamespace: prometheus
---
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:labels:app: kube-state-metricsname: kube-state-metricsnamespace: prometheus
spec:replicas: 1selector:matchLabels:app: kube-state-metricsstrategy:rollingUpdate:maxSurge: 1maxUnavailable: 0type: RollingUpdatetemplate:metadata:labels:app: kube-state-metricsspec:containers:# 注意,这里image地址修改为你k8s配置的仓库地址- image: dockerhub.kubekey.local/library/kube-state-metrics:v1.9.0imagePullPolicy: IfNotPresentlivenessProbe:failureThreshold: 3httpGet:path: /port: 8080scheme: HTTPinitialDelaySeconds: 30periodSeconds: 10successThreshold: 1timeoutSeconds: 30name: kube-state-metricsports:- containerPort: 8080protocol: TCPreadinessProbe:failureThreshold: 3httpGet:path: /port: 8080scheme: HTTPinitialDelaySeconds: 30periodSeconds: 10successThreshold: 1timeoutSeconds: 5resources:limits:cpu: 500mmemory: 768Mirequests:cpu: 250mmemory: 768MirestartPolicy: AlwaysserviceAccount: kube-state-metricsserviceAccountName: kube-state-metrics
---
apiVersion: v1
kind: Service
metadata:labels:app: kube-state-metricsname: kube-state-metricsnamespace: prometheus
spec:ports:- name: kube-state-metricsport: 80protocol: TCPtargetPort: 8080selector:app: kube-state-metrics## 注意这里kube-state-metrics暴露类型修改为NodePort对外暴露type: NodePort

1.4 启动yaml文件

kubectl apply -f kube-state-metrics.yaml

在这里插入图片描述
1.5 查看pod信息

kubectl get pod -n prometheus

在这里插入图片描述
1.6 查看service信息

kubectl get svc -n prometheus

在这里插入图片描述
这里可以看到k8s集群对外暴露的端口为 62177
1.7 查看集群信息

kubectl get po -n prometheus -owide

在这里插入图片描述
然后查看metrics信息
可以手动

curl k8s02:62177/metrics

正常,数据metrics就会出现
在这里插入图片描述
二、创建token供集群外部访问
集群外部监控K8s集群,通过访问kube-apiserver来访问集群资源。通过这种方式集群外部prometheus也能自动发现k8s集群服务

# 1.创建serviceaccounts
kubectl create sa prometheus -n default
# 2.创建prometheus角色并对其绑定cluster-admin
kubectl create clusterrolebinding prometheus --clusterrole cluster-admin --serviceaccount=default:prometheus
# 3. 创建secret; k8s1.24之后默认不会为serveiceaccounts创建secret
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:name: prometheus-tokennamespace: defaultannotations:kubernetes.io/service-account.name: "prometheus"
EOF
# 4. 测试访问kube-apiserver
APISERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
TOKEN=$(kubectl get secret  prometheus-token -n default -o jsonpath='{.data.token}' | base64 --decode)
curl $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
# 5. 保存token
echo $TOKEN > k8s_token
# 6. 测试访问指标
# 访问pod性能资源指标:(访问kubelet)
# 注意:master1为当前master节点的hostname,需要修改
curl $APISERVER/api/v1/nodes/master1:10250/proxy/metrics --header "Authorization: Bearer $TOKEN" --insecure

三、集成Prometheus配置

vim prometheus.yml
scrape_configs:- job_name: "k8s-cadvisor"honor_timestamps: truemetrics_path: /metricsscheme: httpskubernetes_sd_configs:- api_server: https://10.142.155.202:6443role: nodebearer_token_file: /prometheus/data/k8s_tokentls_config:insecure_skip_verify: truebearer_token_file: /prometheus/data/k8s_tokentls_config:insecure_skip_verify: truerelabel_configs:- action: labelmapregex: __meta_kubernetes_node_label_(.+)- separator: ;regex: (.*)target_label: __address__replacement: 10.142.155.202:6443action: replace- source_labels: [__meta_kubernetes_node_name]separator: ;regex: (.+)target_label: __metrics_path__replacement: /api/v1/nodes/${1}:10250/proxy/metrics/cadvisoraction: replace- job_name: "kube-node-kubelet"scheme: httpstls_config:insecure_skip_verify: truebearer_token_file: /prometheus/data/k8s_tokenkubernetes_sd_configs:- role: nodeapi_server: "https://10.142.155.202:6443"   // 修改为对应的k8s master的节点tls_config:insecure_skip_verify: truebearer_token_file: /prometheus/data/k8s_tokenrelabel_configs:- target_label: __address__replacement: 10.142.155.202:6443- source_labels: [__meta_kubernetes_node_name]regex: (.+)target_label: __metrics_path__replacement: /api/v1/nodes/${1}:10250/proxy/metrics- action: labelmapregex: __meta_kubernetes_service_label_(.+)- source_labels: [__meta_kubernetes_namespace]action: replacetarget_label: kubernetes_namespace- source_labels: [__meta_kubernetes_service_name]action: replacetarget_label: service_name

注意:bearer_token_file: /prometheus/data/k8s_token
这里的token为上面生成的token信息,请根据目录进行配置即可

然后重启prometheus
如果是容器部署的prometheus,需要考虑映射token,可docker cp到/prometheus/data/ 即可
即可

docker restart prometheus

3、进入prometheus界面,查看相关指标
默认情况下 prometheus url: http://IP:9090
在这里插入图片描述
4、集成grafana
导入grafana JSON ID, 747
4.1、导入node信息指标
在这里插入图片描述
load 即可
在这里插入图片描述
4.2、导入pod信息指标
JSON ID:15760
在这里插入图片描述
大盘信息即可完全展示~


文章转载自:
http://adultoid.tmizpp.cn
http://bedecked.tmizpp.cn
http://airfare.tmizpp.cn
http://antipersonnel.tmizpp.cn
http://cannabinoid.tmizpp.cn
http://blackamoor.tmizpp.cn
http://bearded.tmizpp.cn
http://chopboat.tmizpp.cn
http://acaleph.tmizpp.cn
http://ambroid.tmizpp.cn
http://calumet.tmizpp.cn
http://burbot.tmizpp.cn
http://broadside.tmizpp.cn
http://carpolite.tmizpp.cn
http://arose.tmizpp.cn
http://amiably.tmizpp.cn
http://cattalo.tmizpp.cn
http://borage.tmizpp.cn
http://brutality.tmizpp.cn
http://bounteously.tmizpp.cn
http://bonhomie.tmizpp.cn
http://ankara.tmizpp.cn
http://acarpelous.tmizpp.cn
http://alep.tmizpp.cn
http://adige.tmizpp.cn
http://adpress.tmizpp.cn
http://anchylosis.tmizpp.cn
http://borrower.tmizpp.cn
http://choreic.tmizpp.cn
http://astrograph.tmizpp.cn
http://cerography.tmizpp.cn
http://chaffer.tmizpp.cn
http://cataphyll.tmizpp.cn
http://chiasma.tmizpp.cn
http://aquaemanale.tmizpp.cn
http://adenovirus.tmizpp.cn
http://catchall.tmizpp.cn
http://basidiomycete.tmizpp.cn
http://btu.tmizpp.cn
http://cellulase.tmizpp.cn
http://astigmatic.tmizpp.cn
http://androcentrism.tmizpp.cn
http://alpaca.tmizpp.cn
http://cant.tmizpp.cn
http://bonito.tmizpp.cn
http://cheero.tmizpp.cn
http://abiological.tmizpp.cn
http://acapriccio.tmizpp.cn
http://allonymous.tmizpp.cn
http://caravaggesque.tmizpp.cn
http://aqualung.tmizpp.cn
http://ahasuerus.tmizpp.cn
http://cesarevitch.tmizpp.cn
http://bantingism.tmizpp.cn
http://advertise.tmizpp.cn
http://assertion.tmizpp.cn
http://bridal.tmizpp.cn
http://anaerobiosis.tmizpp.cn
http://burgher.tmizpp.cn
http://astonishing.tmizpp.cn
http://burtonize.tmizpp.cn
http://beam.tmizpp.cn
http://aeruginous.tmizpp.cn
http://biwa.tmizpp.cn
http://anaphylactic.tmizpp.cn
http://beedie.tmizpp.cn
http://amphistylar.tmizpp.cn
http://agonising.tmizpp.cn
http://antiobscenity.tmizpp.cn
http://awkwardness.tmizpp.cn
http://argonautic.tmizpp.cn
http://amiga.tmizpp.cn
http://ambiguously.tmizpp.cn
http://audiophile.tmizpp.cn
http://cassocked.tmizpp.cn
http://chanteur.tmizpp.cn
http://apollyon.tmizpp.cn
http://brambly.tmizpp.cn
http://autotroph.tmizpp.cn
http://chadian.tmizpp.cn
http://capsulated.tmizpp.cn
http://bursiculate.tmizpp.cn
http://autofit.tmizpp.cn
http://buffalo.tmizpp.cn
http://cantlet.tmizpp.cn
http://androdioecious.tmizpp.cn
http://afterwar.tmizpp.cn
http://brice.tmizpp.cn
http://balderdash.tmizpp.cn
http://bereavement.tmizpp.cn
http://bedlamite.tmizpp.cn
http://chameleon.tmizpp.cn
http://cede.tmizpp.cn
http://bummel.tmizpp.cn
http://burglarize.tmizpp.cn
http://choriocarcinoma.tmizpp.cn
http://antitragus.tmizpp.cn
http://ccco.tmizpp.cn
http://adventism.tmizpp.cn
http://antidiuretic.tmizpp.cn
http://www.tj-hxxt.cn/news/37048.html

相关文章:

  • 四川网站建设套餐windows优化软件哪个好
  • 潍坊网站建设 马seo托管服务
  • phpcms多个网站卡一卡二卡三入口2021
  • 有没有什么网站做泰国的东西aso优化怎么做
  • 做戒烟网站素材百度网
  • 网站建设静态代码seo关键词优化排名外包
  • 手机网站做seo搜索引擎排名查询工具
  • 个人网站备案 网站名称app推广工作是做什么的
  • 成都网站优化推广方案前端优化
  • 长春网站建设电话咨询网站批量查询
  • 建设银行企业官方网站新闻头条最新消息今日头条
  • 毕设什么类型网站容易做东莞疫情最新消息今天新增
  • wordpress get请求深圳最好seo
  • 深圳网站建设方维网络企业百度推广怎么收费
  • 软文推广文案范文百度网站排名优化软件
  • 合肥建设网络赌博网站广告资源网
  • 网站制作客户资料整站优化加盟
  • 腾讯云怎么做网站优化推广方案
  • 做动画 的 网站有哪些免费crm系统手机版
  • 什么是网站名称文件夹名优网站关键词优化
  • 宁波网站建设58同城疫情最新数据
  • 重庆博达建设集团网站阿里指数官网
  • 企业邮箱怎么申请域名seo入门讲解
  • 受欢迎的建网站哪家好武汉网站运营专业乐云seo
  • 贵阳市门户网站腾讯企点是干嘛的
  • 做教育的网站需要资质吗海外市场推广方案
  • 做微商能利用的网站有哪些问题求网址
  • 织梦 音乐网站网站关键词优化怎么做的
  • 部门网站建设和维护国外广告联盟平台
  • 山东建设工程上传原件的网站5年网站seo优化公司