Posts
descheduler 二次调度让 Kubernetes 负载更均衡
· ☕ 4 分钟
1. 为什么需要二次调度 Kubernetes 调度器的作用是将 Pod 绑定到某一个最佳的节点。为了实现这一功能,调度器会需要进行一系列的筛选和打分。 Kubernetes 的调度是基于 Request,但是每个 Pod 的实际使用值是动态变化的。经过一段时间的运行之后,节点的负载并不均衡。一些节点负载

如何更新 Kubernetes 证书
· ☕ 1 分钟
在默认情况下,Kubernetes 的证书每隔一年需要 renew 一次,下面是记录的一次证书更新过程。 1. 查看证书 在 Master 节点上查看证书过期时间: 1 2 3 4 5 6 7 8 9 10 11 12 13 kubeadm certs check-expiration CERTIFICATE EXPIRES RESIDUAL TIME CERTIFICATE AUTHORITY EXTERNALLY MANAGED admin.conf Apr 02, 2023 09:53 UTC 296d no apiserver Apr 02, 2023 09:53 UTC 296d ca no apiserver-kubelet-client Apr 02, 2023 09:53 UTC 296d ca no controller-manager.conf Apr 02, 2023 09:53 UTC

如何查看 Tekton 的流水线指标
· ☕ 3 分钟
1. 抓取 Tekton Metrics 新增 ConfigMap 配置文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 cat <<EOF | kubectl apply -f - apiVersion: v1 kind: ConfigMap metadata: name: config-observability namespace: tekton-pipelines labels: app.kubernetes.io/instance: default app.kubernetes.io/part-of: tekton-pipelines data: metrics.backend-destination: prometheus metrics.taskrun.level: "task" metrics.taskrun.duration-type: "histogram" metrics.pipelinerun.level: "pipeline" metrics.pipelinerun.duration-type: "histogram" EOF 修改 data 中的配置,会改变上报指标的粒度,甚至会严重影响 Prometheus 的性能,需要谨慎修改。 重启 Tekton 1 kubectl -n tekton-pipelines rollout restart deployment tekton-pipelines-controller [可选] 将 tekton-pipelines-controller 设置为 NodePort

如何采集 Kubernetes 对象的 labels 和 annotations
· ☕ 2 分钟
1. 为什么需要 kube-status-metrics Kubernetes 的监控主要关注两类指标: 基础性能指标 CPU、内存、磁盘、网络等指标,可以通过 DaemonSet 部署 node-exporter,由 Prometheus 抓取相关指标。 资源对象指标 Deployment 的副本数量、Pod 的运行状态等。这些指标需要 kube-status-metrics 轮询 Kubernetes 的 API 查询,并暴露给 Prometheus 才能够看到

等价域名
· ☕ 1 分钟
1. 含义 如果一个服务有多个域名入口,通过这些入口访问得到的内容一样,那么称这些域名为等价域名。 比如,通过等价域名,可以提供 3 个一模一样的文件或者接口服务。 https://server.chenshaowen.com/static/index.html https://server-peer-a.chenshaowen.com/static/index.html https://server-peer-b.chenshaowen.com/static/index.html 2. 用途 2.1 增加浏览器并发上限 浏览器通常会限制对单个域名最大并发数量不超过 6 个/秒。通