avatar
文章
177
标签
97
分类
45

首页
归档
标签
分类
友链
关于
广告
IT老男孩
搜索
首页
归档
标签
分类
友链
关于
广告
Decrypt the longhorn volume and read the data
发表:2026-02-18|更新:2026-02-18
本文永久链接: https://www.xtplayer.cn/longhorn/decrypt-the-longhorn-volume-and-read-the-data/ 1,需要将 pvc 对应的工作负载缩减为 0,不然可能会提示卷已经被挂载。在 pod 缩减为 0 之后,在 Attached Node & Endpoint:中无法看到挂载的主机路径。鼠标放在右侧 replicas 上,会显示卷原始的镜像保存路径,如下图。每个卷的每个副本都是以 img 镜像形式保存在主机上,pod 挂载卷的时候会将此 img 挂载到主机上,然后再挂载到 pod 中。 2,进入卷镜像保存路径,可以看到如下信息 root@rancher-1:/var/lib/longhorn/replicas/pvc-f1611c3c-0250-4f17-b603-87b1dcc59b6b-ca483219# lltotal 250136drwx------ 2 root root 4096 Aug 13 16:00 ./drwxr-xr-x 6 root root 4096 ...
阅读全文
自定义 Rancher Webhook 配置
发表:2026-01-22|更新:2026-01-22|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/customizing-rancher-webhook-configuration/ Rancher-Webhook 是 Rancher 的重要组件,它与 Kubernetes 结合使用,用于增强安全性并为 Rancher 管理的集群启用关键功能。 如 Kubernetes 文档中所述,它与 Kubernetes 的可扩展准入控制器集成,允许 Rancher-Webhook 检查发送到 Kubernetes API Server 的特定请求,添加自定义和 Rancher 相关的验证,以及 Rancher 相关请求的变化。Rancher-Webhook 使用 rancher.cattle.io ValidatingWebhookConfiguration 和 rancher.cattle.io MutatingWebhookConfiguration 管理要验证的资源,并覆盖任何手动编辑。 Rancher 将 Rancher-Webhook 作为单独的 deployment 和服务部署在 local 和下游 ...
阅读全文
rke2 Maximum failure threshold exceeded for plan with checksum
发表:2026-01-06|更新:2026-01-19|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/maximum-failure-threshold-exceeded-for-plan-with-checksum/ 问题描述在 Rancher UI 中发现 master node 显示错误状态,提示: Error applying plan -- check rancher-system-agent.service logs on node for more information 但执行 kubectl get node 命令显示该节点状态正常。 通过查看 rancher-system-agent 日志发现以下错误: rancher-system-agent[3419230]: time="2026-01-06T15:09:38+08:00" level=error msg="[K8s] Maximum failure threshold exceeded for plan with checksum value of b53110a4c92ea7e89cc08a8a77d ...
阅读全文
在 prometheus 中丢失 kube_node_labels 指标数据
发表:2025-12-31|更新:2026-01-06|分类:prometheus
本文永久链接: https://www.xtplayer.cn/prometheus/missing-kube-node-labels-in-prometheus/ 从 kube-state-metrics 2.0.0 开始,默认不再自动导出所有资源的标签数据,比如 pod 标签和 node 标签。 如果要搜集相关资源的标签数据,可以在 rancher ui 编辑 kube-state-metrics deployment,在命令中添加 --metric-labels-allowlist=nodes=[*],pods=[*] ,多个资源以逗号隔开。或者在集群工具中编辑 Monitoring App 的 YAML,在 kube-state-metrics 层级下添加 metricLabelsAllowlist ,配置示例如下: kube-state-metrics: metricLabelsAllowlist: - nodes=[*] - pods=[*] namespaceOverride: '' prometheus: monitor ...
阅读全文
RKE2-k8s 集群中设置容器日志 limit 大小
发表:2025-12-08|更新:2025-12-31|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/how-to-set-container-log-rotation-with-rke2/ 在基于 docker runtime 的 k8s 集群中,可以通过在 /etc/docker/daemon.json 配置文件中添加如下配置实现容器标准输出日志大小的限制。 "log-driver": "json-file","log-opts": {"max-size": "100m","max-file": "3"} 而在 rke2-k8s 环境中,已使用 containerd runtime 替换了 docker runtime,容器的日志已由 kubelet 负责管理。此功能自 k8s 1.10 开始支持,参考 PR https://github.com/kubernetes/kubernetes/pull/59898 。 在 rke2-k8s 环境中,默 ...
阅读全文
查询进程打开的目录或者文件
发表:2025-11-17|更新:2025-12-08|分类:linux
本文永久链接: https://www.xtplayer.cn/linux/query-dir-used-by-process/ 在容器环境中,有时候可能发现某个容器占用了很大的磁盘空间。如果在特定的目录中没有看到占用空间的文件或者目录,那么可能进程还打开了其他的文件或者目录。 以 rancher 进程为例,在主机上执行以下脚本可以查询到 rancher 进程打开的目录和文件 #!/bin/bash# 查看指定进程占用的所有目录PID=$(pgrep rancher)if [ -z "$PID" ]; then echo "Usage: $0 <PID>" exit 1fiecho "进程 $PID 的目录信息:"echo "===================="# 工作目录echo -n "工作目录: "readlink /proc/$PID/cwdecho -e "\n打开的文件和目录:"lsof -p $PID | grep -E ...
阅读全文
查询容器中进程名称和 Pid 对应关系
发表:2025-11-17|更新:2025-12-08|分类:linux
本文永久链接: https://www.xtplayer.cn/linux/query-process-and-pid/ 现在很多容器都做了深度精简,其中可能都没有 ps 命令。排查问题时,有时候需要知道容器中有哪些进程,或者说进程与进程 pid 的对应关系。如果没有 ps 命令,可以使用以下脚本在容器 shell 中查询。 for pid in $(ls -1 /proc | grep -E '^[0-9]+$'); do echo -n "$pid: "; cat /proc/$pid/cmdline 2>/dev/null; echo; done
阅读全文
rke2 /run 目录报 no space left on device
发表:2025-11-04|更新:2025-11-11|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/rke2-run-dir-no-space-left-on-device/ 当 containerd 作为 runtime 时,容器运行的相关文件( merger 层等)都保存在 /run/k3s/containerd/ 目录。rke2-containerd 默认配置下 containerd state 目录为/run/k3s/containerd,可以通过在主机上执行 cat /var/lib/rancher/rke2/agent/etc/containerd/config.toml 查看 rke2-containerd 配置。当容器镜像越大、容器产生临时文件越多,就会导致 /run/k3s/containerd/io.containerd.runtime.v2.task/k8s.io 下的子目录使用越来越大,最终导致 /run 目录被耗尽。具体请参考 issue https://github.com/k3s-io/k3s/issues/4327 的说明。 处 ...
阅读全文
Neuvector 与 Rancher RBAC 集成
发表:2025-10-24|更新:2025-11-11|分类:neuvector
本文永久链接: https://www.xtplayer.cn/neuvector/rancher-neuvector-sso-rbac/ 创建角色模板将以下的角色模板导入 local 集群, administrative: falseapiVersion: management.cattle.io/v3builtin: falseclusterCreatorDefault: falsecontext: clusterdisplayName: Neuvector UI Proxyexternal: falsehidden: falsekind: RoleTemplatelocked: falsemetadata: annotations: cleanup.cattle.io/rtUpgradeCluster: 'true' lifecycle.cattle.io/create.mgmt-auth-roletemplate-lifecycle: 'true' finalizers: - controller.cattle.i ...
阅读全文
普通用户在 rancher-ui 查看 pod 监控图表的权限设置
发表:2025-10-22|更新:2025-10-22|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/rancher-ui-pod-metrics-permission/ 1,将以下 yaml 导入 local 集群创建项目角色。 apiVersion: management.cattle.io/v3builtin: falsecontext: projectdescription: Members can only view the metrics of resources inside the Project.displayName: Monitoring Viewexternal: falsehidden: falsekind: RoleTemplatemetadata: annotations: cleanup.cattle.io/rtUpgradeCluster: 'true' lifecycle.cattle.io/create.mgmt-auth-roletemplate-lifecycle: 'true' finalizers: ...
阅读全文
rancher-rke2 集群 kube-proxy 切换为 ipvs 模式
发表:2025-10-18|更新:2025-10-22|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/rancher-rke2-kubeproxy-switch-to-ipvs/ 在 rancher RKE2 中切换 kube-proxy 从默认的 iptables 模式到 IPVS 模式需要进行一些配置修改。以下是详细步骤: 检查必要的内核模块确保节点上加载了 IPVS 所需的内核模块: # 检查已加载的模块lsmod | grep ip_vs# 如果需要手动加载sudo modprobe ip_vssudo modprobe ip_vs_rrsudo modprobe ip_vs_wrrsudo modprobe ip_vs_shsudo modprobe nf_conntrack 手动安装 rke2 集群创建或者编辑已有的 RKE2 配置文件sudo mkdir -p /etc/rancher/rke2/sudo vim /etc/rancher/rke2/config.yaml 配置 kube-proxy 使用 IPVS在配置文件中添加以下内容: kube-proxy-arg:- "pro ...
阅读全文
Rancher RKE2 自定义集群字段说明
发表:2025-10-16|更新:2025-10-16|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/rancher-rke2-custom-cluster-field-description/ apiVersion: provisioning.cattle.io/v1kind: Clustermetadata: name: rke2-test annotations: {} # key: string labels: {} # key: string namespace: fleet-defaultspec:# 自定义 cluster agent deployment 的一些配置参数,一般不需要自定义配置参数。一些特殊情况下可能需要用到,比如节点都打了 Taint,需要添加自定义 Toleration pod 才能在节点运行。 clusterAgentDeploymentCustomization: appendTolerations:# - effect: string# key: string ...
阅读全文
k8s Tolerations 模糊匹配
发表:2025-10-16|更新:2025-11-11|分类:kubernetes
本文永久链接: https://www.xtplayer.cn/kubernetes/tolerations-fuzzy-matching/ 在 Kubernetes 中,Tolerations(容忍) 是 Pod 的一个属性,允许(但并不要求)Pod 被调度到具有相应 Taints(污点) 的节点上。 Toleration 的匹配规则不仅仅是“完全相等”,它提供了几种灵活的匹配方式,这也就是所说的 “模糊匹配”。核心的模糊匹配体现在对 operator 和 effect 字段的运用上。 Toleration 的核心结构一个典型的 Toleration 定义如下: tolerations:- key: "key1" operator: "Equal" value: "value1" effect: "NoSchedule" tolerationSeconds: 3600 # 仅对 `NoExecute` 效果有效 关键字段: key: 污点的键。 operator: 匹配操作符,这是实现“模 ...
阅读全文
监控 RKE2 集群证书有效期
发表:2025-09-25|更新:2025-09-25|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/monitor-rke2-cluster-certificates-validity/ 根据 rke2 官方文档说明 https://docs.rke2.io/reference/metrics ,rke2 目前支持一些指标的输出,比如 rke2_certificate_expiration_seconds。通过 rke2_certificate_expiration_seconds 指标,可以查询 rke2 集群各组件的有效期。并可以通过配置集群监控告警来对证书有效时间进行提醒。 启用 rke2 Metrics 功能rke2 Metrics 功能默认没有启用,需要在 /etc/rancher/rke2/config.yaml 配置中添加 supervisor-metrics: true 来启用。 通过 rke2 安装脚本或者 rke2 二进制文件部署 rke2 集群如果是通过 rke2 安装脚本或者 rke2 二进制文件部署的集群,需要在每个 server 节点上创建或者修改 /etc/rancher/rke ...
阅读全文
k8s 测试集群 pod 网络连通性
发表:2025-06-11|更新:2025-06-11|分类:kubernetes
本文永久链接: https://www.xtplayer.cn/kubernetes/test-cluster-network-connectivity/ 使用 busybox 镜像通过以下命令创建 DaemonSet 类型的测试应用, kubectl create deploy net-test --image=registry.cn-hangzhou.aliyuncs.com/rancher/busybox \--dry-run=client -o yaml | \sed '/null\|{}\|replicas/d;/status/,$d;s/Deployment/DaemonSet/g' | \sed '/image: .*/a \ stdin: true\n tty: true' | \kubectl apply -f - 等 DaemonSet pod 创建完成后,使用以下脚本去交叉测试跨节点 pod 与 pod 之间的网络连通性。 #!/bin/bash# 获取所有 Pod 名称和 ...
阅读全文
rke2 部署 terway 驱动 kubelet 报: dial unix var/run/eni/eni.socket: connect: no such file or directory 错误
发表:2025-05-20|更新:2025-05-22|分类:rke2
本文永久链接: https://www.xtplayer.cn/rke2/kubelet-error-dial-unix-var-run-eni-eni-socket-connect-no-such-file-or-directory/ 根据 terway 文档进行部署 https://github.com/AliyunContainerService/terway/blob/main/docs/terway-with-cilium.md ,部署完成后在执行 tail -f /var/lib/rancher/rke2/agent/logs/kubelet.log 可以看到如下的错误: E0514 10:59:01.271853 1314 kuberuntime_manager.go:705] "killPodWithSyncResult failed" err="failed to \"KillPodSandbox\" for \"ebba0c90-bf0d-400e-b90d-f46e0f86dad3\" ...
阅读全文
为什么通过 rke 或 Rancher v2.x 配置的集群中执行集群证书轮换后,kubelet 日志仍然显示证书过期?
发表:2025-04-11|更新:2026-01-19|分类:kubernetes
本文永久链接: https://www.xtplayer.cn/kubernetes/kubelet-cert-expired/ 问题现象 有时间可能会出现节点状态不正常,然后查看 kubelet 容器日志时,会看到如上图的证书过期的错误信息。 问题排查 如果你是 rke1 版本创建的 local 集群或者下游自定义集群,可以使用以下命令查询证书有效期: printf '\n%-16s %-16s %-14s %s\n' "开始时间" "过期时间" "剩余天数" "证书路径"echo "----------------------------------------------------------------------------"current_timestamp=$(date +%s)for crt in $(ls /etc/kubernetes/ssl/*.pem | grep -v '\-key\.'); do # 获取开 ...
阅读全文
admission webhook "rancher.cattle.io.namespaces" denied the request Unauthorized
发表:2025-03-15|更新:2025-03-15|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/admission-webhook-rancher-cattle-io-namespaces-denied-the-request-unauthorized/ 目前 admission webhook “rancher.cattle.io.namespaces” denied the request Unauthorized 这个报错,已知的在 tigera-operator 和 NeuVector controller 中出现过,主要原因是缺少了某些权限。可以根据实际使用,拷贝以下 yaml 导入集群添加对应的权限。 tigera-operator apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata: name: tigera-operator-psarules:- apiGroups: - management.cattle.io resources: - projects verbs: - updatep ...
阅读全文
rancher logging v2 collect rke1-k8s logs
发表:2024-09-11|更新:2025-05-22|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/rancher-logging-v2-collect-rke1-k8s-logs/ 问题背景rke1 创建的 k8s 集群,k8s 系统基础组件(比如 kubelet、etcd、kube-scheduler等)都是以 docker 容器方式部署。在使用 rancher v2.6+ 版本,建议升级 rancher logging 到 v2 版本。rancher logging 基于开源的 logging operator,对应的 git repo:https://github.com/kube-logging/logging-operator 和文档地址:https://kube-logging.dev/docs/ 。 logging operator 默认只针对 k8s pod 日志和 k8s events,对于主机上 docker run 运行的容器日志不是很友好。因此针对这个问题,rancher 在原有的 logging operator 基础上增加了 rancher-logging-rke-agg ...
阅读全文
etcd snapshots showing 0kB size in the Rancher UI
发表:2024-08-28|更新:2025-05-22|分类:rancher
本文永久链接: https://www.xtplayer.cn/rancher/etcd-snapshots-showing-0kb-size-in-the-rancher-ui/ 在 rancher 2.6.x 和 2.7.x 版本中,创建的下游集群可能存在集群 etcd 备份大小为 0 kb 的情况。根据 suse 知识库文档 https://www.suse.com/support/kb/doc/?id=000021447 说明,这个问题主要是 rke2 和 rke2-etcd、k3s 和 k3s-etcd 租约的租约持有者不匹配导致。 对于 rke2 集群,可以使用以下命令去修复。 kubectl -n kube-system get cm rke2-etcd-snapshots -oyaml > rke2-etcd-snapshots-cm-bak.yamlkubectl -n kube-system patch cm --type=json -p='[{"op": "remove", "path ...
阅读全文
couldn't get resource list for external.metrics.k8s.io/v1beta1
发表:2024-08-24|更新:2024-08-28|分类:kubernetes
如上图,有时候在执行 kubectl 命令时候会提示 "memcache.go:255] couldn't get resource list for external.metrics.k8s.io/v1beta1: the server is currently unable to handle the request" 错误。或者在某些系统组件的日志中也可以看到类似 couldn't get resource list for xxx.xxx.k8s.io/v1beta1 这样的错误。 根据以上信息可以知道此问题与 external.metrics.k8s.io/v1beta1 相关,从报错现象看是无法连接到 external metrics server 获取相关信息。 分析rancher\rke\rke2 默认不会部署与 external.metrics 相关的资源,因此如果 k8s 提示 external.metrics.k8s.io/v1beta1 相关信息,那么可以说明集群中有人为部署 external.metrics 相 ...
阅读全文
12…9下一页
avatar
IT老男孩
IT老男孩 - 分享 IT 相关技术文章,分享工作中的最佳实践。
文章
177
标签
97
分类
45
Follow Me
公告
我的博客
最新文章
Decrypt the longhorn volume and read the data2026-02-18
自定义 Rancher Webhook 配置2026-01-22
rke2 Maximum failure threshold exceeded for plan with checksum2026-01-06
在 prometheus 中丢失 kube_node_labels 指标数据2025-12-31
RKE2-k8s 集群中设置容器日志 limit 大小2025-12-08
查询进程打开的目录或者文件2025-11-17
查询容器中进程名称和 Pid 对应关系2025-11-17
rke2 /run 目录报 no space left on device2025-11-04
分类
  • calico2
  • cicd1
  • cilium1
  • containerd1
  • coredns4
  • csdn1
  • devops1
  • docker1
  • etcd5
  • f51
  • git2
  • hci1
  • ingress2
  • k3d1
  • k3s1
标签
corednscoredns 最佳实践coreDNS 加速外部域名解析containerdCSDNdevopsDevOps自动化dockeretcdPrometheusBGPcalicoF5GitOpsHCIHarvesterk3deBPFsysstatLonghorn ARMlonghornmacOS Big Surmacosmds_storesmdworkermdscicdkubernetesserviceaccountTaintBasedEvictionsterminatedingress弹性伸缩KubernetesEvictedFaileddevice or resource busypodflannel
归档
  • 二月 20261
  • 一月 20262
  • 十二月 20252
  • 十一月 20253
  • 十月 20255
  • 九月 20251
  • 六月 20251
  • 五月 20251
  • 四月 20251
  • 三月 20251
  • 九月 20241
  • 八月 20242
网站资讯
文章数目 :
177
已运行时间 :
本站总字数 :
235.2k
本站访客数 :
本站总访问量 :
最后更新时间 :
©2020 - 2026 By IT老男孩
框架 Hexo|主题 Butterfly
icp蜀ICP备20023095号-1 川公网安备51010702002006号
本地搜索