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

k8s kubelet 10250监控端口访问配置

一、修改kubelet的config.yaml文件

修改成:

二、找到证书<本文使用的pem证书>

三、测试

# curl -k --cert /etc/kubernetes/pki/ca.pem --key /etc/kubernetes/pki/ca-key.pem https://192.168.4.24:10250/pods

# curl -k --cert /etc/kubernetes/pki/ca.pem --key /etc/kubernetes/pki/ca-key.pem https://192.168.4.24:10250/metrics

五、prometheus配置

5.1 metrics配置

5.2 pem文件转crt

pem转pem编码CRT,保留abse64格式

# openssl x509 -in ca.pem -out ca.crt

pem转DER编码CRT(二进制格式),若目标系统要求crt文件为二进制DER格式:

# openssl x509 -outform der -in ca.pem -out ca.crt

5.3 token生成

创建ServiceAccount和RABC# prometheus-rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:name: prometheusnamespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: prometheus
rules:
- apiGroups: [""]resources:- nodes- nodes/proxy- services- endpoints- podsverbs: ["get", "list", "watch"]
- apiGroups:- extensionsresources:- ingressesverbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics"]verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: prometheus
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: prometheus
subjects:
- kind: ServiceAccountname: prometheusnamespace: monitoring为prometheus创建专用的kubelet访问token:
# prometheus-kubelet-token.yaml
apiVersion: v1
kind: Secret
metadata:name: prometheus-kubelet-tokennamespace: monitoringannotations:kubernetes.io/service-account.name: prometheus
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:name: prometheus-kubelet-access
rules:
- apiGroups: [""]resources: ["nodes", "nodes/proxy", "nodes/metrics"]verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics", "/metrics/cadvisor", "/metrics/probes"]verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: prometheus-kubelet-access
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: prometheus-kubelet-access
subjects:
- kind: ServiceAccountname: prometheusnamespace: monitoring检查kuelet服务状态;
# systemctl status kubelet检查防火墙规则:
# iptables -L |grep 10250    #iptables关闭则忽略验证:
#  kubectl describe secrets -n monitoring prometheus-kubelet-token检查RABC权限;
# kubectl auth can-i get nodes --as=system:serviceaccount:monitoring:prometheus查看证书有效期:
openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -datestoken转base64:
# kubectl get secret -n monitoring prometheus-kubelet-token -o jsonpath='{.data.token}' | base64 --decode

http://www.dtcms.com/a/423460.html

相关文章:

  • 十二、伪分布式配置
  • VScode通过跳板机连接内网服务器
  • wordpress小说下载站建设银行网站如何下载u盾
  • 餐饮行业做微信网站有什么好处网站上图怎么用ps做
  • 设计的网站都有哪些功能辛集哪做网站
  • PostgreSQL的逻辑复制spill溢出案例和启停库逻辑
  • OpenMQTTGateway 技术全解:统一多协议到 MQTT 的开源网关
  • 数据结构——二叉树学习
  • 动规:回文串问题
  • PostgreSQL WAL 日志发展史 - pg7
  • 商丘企业网站建设团队网站设计的内容以及步骤
  • 网站域名所有人wordpress 子域名
  • ListenHub:AI播客平台,一句话生成播客
  • 知名的媒体发稿代理有哪些
  • PyTorch nn.Linear 终极详解:从零理解线性层的一切(含可视化+完整代码)
  • 大型企业级金融信贷平台需求报告
  • 【算法】小点:List.remove
  • 文件扩展名.js .jsx .ts .tsx区别(JavaScript扩展名、React扩展名、TypeScript扩展名)
  • MySQL 在金融系统中的应用:强一致性与高可用架构实战
  • 销售型网站营销目标查网址是否安全
  • 媒体发稿平台如何选
  • 靠谱的综合门户媒体发稿如何选
  • 学习:uniapp全栈微信小程序vue3后台(29)
  • 装修设计网站排名新浪短网址链接
  • kali 01——安装及简要介绍
  • 宁夏政务网站建设标准wordpress是瀑布流吗
  • 烟台 网站建设中国广告在国外投放案例
  • OpenAI秘密测试ChatGPT安全路由,情感对话触发GPT-5严格审查
  • 赋能制造新质生产力:制造业专用低代码平台选型指南(2025)
  • 智慧工地系统:建筑行业数字化转型的核心趋势,集成云计算、物联网、大数据等技术,构建覆盖施工全周期的智能化管理体系。