Prometheus Adapter 安装
本文永久链接: https://www.xtplayer.cn/prometheus/prometheus-adapter/ Prometheus 准备从 Rancher v2.4.8-ent(监控 chart 版本 0.1.2000)开始,只能通过应用商店跳转的链接访问 Prometheus,直接通过 Pod IP 、svc 或者 Nodeport 无法访问。如果想通过 Nodeport 或者 Ingress 代理访问 Prometheus ,配置方法请访问 通过 Nodeport 或者 Ingress 访问 Prometheus。 对于集群监控 chart 版本高于 0.1.4001 的环境,在集群监控配置页添加应答 prometheus.serviceNodePort = true,将会自动创建一个 Nodeport svc,通过 Nodeport 端口即可访问。 Prometheus Adapter 安装Prometheus Adapter chart 地址:https://github.com/prometheus-community/helm-charts/tree/ma ...
阅读全文自定义集群监控参数
本文永久链接: https://www.xtplayer.cn/prometheus/custom-parameter/ 默认的集群监控配置可能不适用于所有的环境,比如内存 limit 大小,需要根据实际需求进行参数的调整。 调整组件内存有时候可能会发现 prometheus-cluster-monitoring-0 Pod 中的 prometheus 容器在反复重启,在 promethues 容器日志中并未发现异常错误。类似的错误还在 prometheus-agent、prometheus-proxy 都可能会出现。 如果出现以上现象,说明很有可能是容器内存超过了限制值,容器进程被强制 kill ,导致容器频繁重启。 调整 prometheus 内存 在 集群|工具|监控 配置页面中,可以看到如图的限制配置,可以适当的调整,比如 Prometheus CPU 限制 设置为 4000,Prometheus 内存限制设置为 8192,Node Exporter CPU 限制设置为 500,Node Exporter 内存限制设置为 500。 调整其他组件 在高级选项中添加以下应答 ...
阅读全文全新论坛启用,Rancher 中文社区迈入新阶段
本文永久链接: https://www.xtplayer.cn/rancher/rancher-new-forums/ 伴随着 Rancher 旗下各种开源产品的快速发展,Rancher 中文社区群体日益壮大。统计微信群和 QQ 群等主要聚集地,社区群体数量已达数万人之众。为了能够更好地发挥社区互助的力量,Rancher 中文社区 (https://forums.rancher.cn) 正式启用新的论坛,并于今日正式对外开放。 写在前面在社区发展的过程中,微信社交软件拥有不可磨灭的贡献,Rancher 社区通过各种市场活动,吸纳技术群体加入到微信群进行交流,相互切磋。然而,随着社区群体的急速壮大,以微信群为主的社区治理模式逐渐遇到发展瓶颈。其最大的痛点在于知识传递障碍。早期成立的微信群中,经过多轮打磨,其成员普遍技艺精湛。而相对成立较晚的微信群,很多还在挣扎于很基础的安装部署。同时,社区的管理人员需要付出大量精力在割裂的群体中传递这些知识。其次,微信在本质上并不是适合社区交流的通信工具,其内容无法被有效的索引到搜索引擎,每个群500人的限制可能无法找到合适的交流对象,并且会干扰工作 ...
阅读全文coreDNS 加速外部域名解析
本文永久链接: https://www.xtplayer.cn/coredns/accelerate-external-domain-resolution/ 问题背景有时候业务可能对 DNS 解析有很高要求,通过以下脚本循环去访问一个域名,时而会出现解析到过 1s 的错误提示。 for i in `seq 1 500`;do curl -LSs -I api.mch.weixin.qq.com --connect-timeout 1 | grep HTTP/1.1done 问题分析在 coredns 配置中添加 log 参数可以打印详细的请求日志。 .:53 { log errors health { lameduck 5s } ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } tem ...
阅读全文AI at the Edge with K3s and NVIDIA Jetson Nano: Object Detection and Real-Time Video Analytics
本文永久链接: https://www.xtplayer.cn/longhorn/ai-at-the-edge-with-k3s-nvidia-jetson-nano-object-detection-real-time-video-analytics-src/ With the advent of new and powerful GPU-capable devices, the possible use cases that we can execute at the edge are expanding. The edge is growing in size and getting more efficient as technology advances. NVIDIA, with its industry-leading GPUs, and Arm, the leading technology provider of processor IP, are making significant innovations and investments in the edge ...
阅读全文MountVolume.WaitForAttach failed for volume with “structure needs cleaning”
本文永久链接: https://www.xtplayer.cn/kubernetes/mountvolume-waitforattach-failed-for-volume-with-structure-needs-cleaning/ 问题MountVolume.WaitForAttach failed for volume with “structure needs cleaning” 2:02:45 PM Warning Failed MountMountVolume.WaitForAttach failed for volume "pvc-62c6563e-8cac-11e9-bba9-005056b0bf31" : Heuristic determination of mount point failed:stat /var/lib/origin/openshift.local.volumes/plugins/kubernetes.io/iscsi/iface-default/XX.XX.XX.XX:3260-iqn.2016-12.org.gluster ...
阅读全文记一次 controller manager and scheduler unavailable 问题分析
本文永久链接: https://www.xtplayer.cn/kubernetes/controller-manager-and-scheduler-unavailable/ 问题背景用户反馈经常收到告警提示: controller manager and scheduler unavailable。 问题分析 controller manager 和 scheduler 都是通过连接 API SERVER 去读写数据,假如 API SERVER 出现异常无法访问,将会影响 controller manager 和 scheduler 运行。 API SERVER 运行依赖 ETCD 服务,如果 ETCD 不可访问或者不可读写,那么 API SERVER 也无法向 controller manager 和 scheduler 或者其他连接 API SERVER 的应用提供服务。 有很多因素导致 ETCD 服务不可访问或者不可读写,比如: 网络断开或者网络闪断; 三个 ETCD 节点丢失三个,最后一个节点将变成只读模式; 多个 ETCD 实例之间会通过 2380 端口通信 ...
阅读全文变更 Rancher Server IP 或域名
本文永久链接: https://www.xtplayer.cn/rancher/replace-ip-domain/ 准备全部集群的直连 kubeconfig 配置文件默认情况,在 Rancher UI 上复制的 kubeconfig 是通过 cluster agent 代理连接到 K8S 集群的。在变更 SSL 证书后,因为一些参数发送变化,需要通过 kubectl 命令行去修改配置。在变更 SSL 证书后会导致 cluster agent 无法连接 Rancher server,从而导致 kubectl 无法使用 Rancher UI 上复制的 kubeconfig 去操作 K8S 集群。因此,建议在做域名或 IP 变更之前,准备好所有集群的直连 kubeconfig 配置文件。具体可参考:恢复 kubectl 配置文件 提示 2.1.x 以前的版本,可在 Master 节点的 /etc/kubernetes/.tmp 路径下找到 kubecfg-kube-admin.yml,这个是具有集群管理员权限的直连 kubeconfig 配置文件; 操作之前备份 Rancher S ...
阅读全文记一次镜像仓库凭证相关问题分析
本文永久链接: https://www.xtplayer.cn/kubernetes/docker-credentials-secret/ 问题现象用户反馈说在 Rancher UI 部署应用时, 在以下几种凭证均未使用的情况下,也依然可以下载私有仓库中的镜像。 即使未配置集群镜像仓库 也没有配置项目中的镜像仓库凭证 主机上也执行了 docker logout xxxx 退出了所有已登录的镜像仓库。 问题分析Dcoker 本身是 server/client 架构,根据 Docker 私有镜像仓库拉取镜像时的认证机制,client 需要先登录仓库,然后在拉取镜像时传递认证 token 去鉴权。 通过 Rancher UI 部署应用时,容器创建大概有以下几个步骤: Rancher server 发送指令给 Rancher agent; Rancher agent 再通过 K8S API 接口发送给 API SERVER; API SERVER 经过处理后再把请求发送给 kubelet; kubelet 再通过 Docker API 发送指令给 Docker; 最后 D ...
阅读全文重磅出击: Rancher 2.4.x 迁移自定义 k8s 集群
本文永久链接: https://www.xtplayer.cn/rancher/Rancher2.x-migrate-custom-k8s-cluster/ 注意事项 在做操作前,先检查所有 Rancher 环境(源 Rancher 环境和目标 Rancher 环境)中节点的时间是不是已同步(重要)。 对于 Rancher 低于 v2.3.x 并且自定义 k8s 集群版本低于 v1.16 的环境,因为 K8S 集群 API 版本变化,迁移过去后会提示 API 版本不匹配,以及其他权限问题。在迁移之前,需要升级源 Rancher 环境和目标 Rancher 环境到 v2.4.x 及以上版本,并升级自定义 k8s 集群到 v1.16 及以上版本,然后再进行迁移。 不支持降级迁移。 集群导入到目标 Rancher 环境后,在没有确认集群迁移完全正常之前,保留源 Rancher 环境,以便集群回退。 在将 Rancher 低版本环境自定义 k8s 集群迁移到 Rancher 高版本环境时,会触发 k8s 集群自动 更新/升级,请确定好窗口期以免影响业务。 基础配置(可选) 对于 ...
阅读全文Introduction to k3d: Run K3s in Docker
本文永久链接: https://www.xtplayer.cn/k3d/introduction-k3d-run-k3s-docker-src/ In this blog post, we’re going to talk about k3d, a tool that allows you to run throwaway Kubernetes clusters anywhere you have Docker installed. I’ve anticipated your questions — so let’s go! What is k3d?k3d is a small program made for running a K3s cluster in Docker. K3s is a lightweight, CNCF-certified Kubernetes distribution and Sandbox project. Designed for low-resource environments, K3s is distributed as a single bin ...
阅读全文Kubernetes 自动弹性伸缩
本文永久链接: https://www.xtplayer.cn/kubernetes/k8s-automatic-elastic-expansion/ Kubernetes 自动弹性伸缩可以根据业务流量,自动增加或减少服务。这一功能在实际的业务场景中十分重要。在本文中,我们将了解 Kubernetes 如何针对应用产生的自定义指标实现自动伸缩。 为什么需要自定义指标?应用程序的 CPU 或 RAM 的消耗并不一定能够正确表明是否需要进行扩展。例如,如果你有一个消息队列 consumer,它每秒可以处理 500 条消息而不会导致崩溃。一旦该 consumer 的单个实例每秒处理接近 500 条消息,你可能希望将应用程序扩展到两个实例,以便将负载分布在两个实例上。测量 CPU 或 RAM 对于扩展这样的应用程序来说有点矫枉过正了,你需要寻找一个与应用程序性质更为密切相关的指标。一个实例在特定时间点处理的消息数量能更贴切地反映该应用的实际负载。同样,可能有一些应用的其他指标更有意义。这些可以使用 Kubernetes 中的自定义指标进行定义。 Metrics 流水线Metrics Serv ...
阅读全文创建一个成熟的 GitOps 流水线需要做哪些决定?
本文永久链接: https://www.xtplayer.cn/cicd/create-a-full-fledged-gitops-pipeline/ 在软件交付领域,GitOps 是近期的热门趋势,它沿袭并扩展了 DevOps、基础架构即代码和 CI/CD 等趋势。我们此前发布了许多关于 GitOps 的入门文章,您可以在公众号后台回复【Git 文章】获取 GitOps 文章合集。 GitOps 的优势可以简单地归纳如下: 自由地审计更改 持续集成和交付 更好地控制更改管理 然而,现实情况却是构建 GitOps 流水线并非易事,它涉及到许多大大小小的决定,而这些决定会给实施工作带来许多麻烦。我们将这些决定称为“GitOps 架构”,它可能会导致实施过程中面临许多挑战。 好的方面是只要有一定的规划和经验,就可以大大减少过渡到 GitOps 交付模式的痛苦。 在本文中,我将通过一家公司的故事来解释其中的一些挑战。这家公司从一个零散的小创业公司采用 GitOps,成长为一家规范的跨国企业。虽然这种加速成长的情况很少见,但它确实反映了大型组织中的许多团队从概念验证,到最小可行 ...
阅读全文Understanding the Kubernetes Node
本文永久链接: https://www.xtplayer.cn/kubernetes/understanding-the-kubernetes-node/ IntroductionWith over 48,000 stars on GitHub, more than 75,000 commits, and with major contributors like Google and Red Hat, Kubernetes has rapidly taken over the container ecosystem to become the true leader of container orchestration platforms. Kubernetes offers great features like rolling and rollback of deployments, container health checks, automatic container recovery, container auto-scaling based on metrics, ser ...
阅读全文Kubernetes: Tackling Resource Consumption
本文永久链接: https://www.xtplayer.cn/kubernetes/kubernetes-tackling-resource-consumption/ This is the third of a series of three articles focusing on Kubernetes security: the outside attack, the inside attack, and dealing with resource consumption or noisy neighbors. A concern for many administrators setting up a multi-tenant Kubernetes cluster is how to prevent a co-tenant from becoming a “noisy neighbor,” one who monopolizes CPU, memory, storage and other resources. As a result, this noisy neighbo ...
阅读全文Announcing Harvester - Open Source Hyperconverged Infrastructure (HCI) Software
本文永久链接: https://www.xtplayer.cn/hci/announcing-harvester-open-source-hyperconverged-infrastructure-hci-software/ Today, I am excited to announce project Harvester, open source hyperconverged infrastructure (HCI) software built using Kubernetes. Harvester provides fully integrated virtualization and storage capabilities on bare-metal servers. No Kubernetes knowledge is required to use Harvester. Why Harvester?In the past few years, we’ve seen many attempts to bring VM management into container ...
阅读全文Using Hybrid and Multi-Cloud Service Mesh Based Applications for Distributed Deployments
本文永久链接: https://www.xtplayer.cn/service-mesh/using-hybrid-and-multi-cloud-service-mesh-based-applications-for-distributed-deployments/ Service Mesh is an emerging architecture pattern gaining traction today. Along with Kubernetes, Service Mesh can form a powerful platform which addresses the technical requirements that arise in a highly distributed environment typically found on a microservices cluster and/or service infrastructure. A Service Mesh is a dedicated infrastructure layer for ...
阅读全文Set up K3s in High Availability using k3d
本文永久链接: https://www.xtplayer.cn/k3s/set-up-k3s-in-high-availability-using-k3d/ Have you ever wanted to try K3s high availability cluster “mode,” and you either did not have the minimum three “spare nodes” or the time required to set up the same amount of VMs? Then you are in for a good treat: meet k3d! If you’re not familiar with k3d, its name gives you a hint to what it’s all about: K3s in Docker. k3d is a lightweight wrapper to run K3s (a lightweight, single <40MB binary, certified Kuber ...
阅读全文Compute Confidently at the Edge with Rancher and Longhorn
本文永久链接: https://www.xtplayer.cn/rancher/compute-confidently-at-the-edge-with-rancher-and-longhorn-1-1/ Today’s announcement of Longhorn 1.1, a Cloud Native Computing Foundation (CNCF) Sandbox project, is exciting news for users of Rancher, SUSE’s Kubernetes management platform, and the Kubernetes community. Longhorn is an enterprise-grade, cloud native container storage solution that went GA in June 2020. Since then, adoption has increased by 235 percent. Now Longhorn is the first cloud nativ ...
阅读全文Kubernetes 规范中标签的重要性
本文永久链接: https://www.xtplayer.cn/kubernetes/autoscaling/ Kubernetes的核心是资源管理和编排工具。可以集中精力进行第一天的操作,以探索和试用其很酷的功能来部署,监视和控制 Pod。但是,您还需要考虑第二天的操作。您需要关注以下问题: 我将如何扩展 Pod 和应用程序? 如何保持容器健康运行并高效运行? 随着代码和用户工作量的不断变化,我该如何应对这些变化? 我在这篇文章中提供了 Kubernetes 内部不同可伸缩性机制的高级概述,以及使它们满足您的需求的最佳方法。请记住,要真正掌握 Kubernetes,您需要掌握不同的方法来管理集群资源的规模,这是 Kubernetes 承诺的核心。 配置 Kubernetes 集群以平衡资源和性能可能是一项挑战,并且需要具备 Kubernetes 内部运作的专业知识。仅仅因为您的应用程序或服务的工作负载不是恒定的,而是整天(甚至不是整小时)都会波动。将其视为一段旅程和一个持续的过程。 Kubernetes 自动扩展构建基块有效的kubernetes自动缩放需要两层可缩放性之间的协 ...
阅读全文Kubernetes 资源请求和限制
本文永久链接: https://www.xtplayer.cn/kubernetes/resource-requests-and-limits/ 资源调度是 Kubernetes 的核心功能之一。Kubernetes 调度程序确保容器获得足够的资源以正确执行。此过程由调度策略控制。在深入研究调度程序的工作原理之前,我们确保我们了解 Kubernetes 集群内部资源定义,分配和限制的基本结构。 资源类型Kubernetes 只有两个内置的可管理资源:CPU和内存。CPU 基本单元是核心,内存以字节为单位,这两种资源在调度器如何将 Pods 分配给节点方面起着关键作用。您将控制您的集群请求,分配和使用内存和 CPU,始终设置正确的 CPU 和内存值,这将确保运行异常的应用程序不会影响群集中其他 Pod 的可用资源容量。 资源请求和限制Kubernetes 使用请求(requests)和限制(limits)结构来控制 CPU 和内存等资源。 requests: 请求是保证容器预期需要分配的资源大小,可以理解为所需的最小资源。如果容器配置了 requests,Kubernetes 将仅在 ...
阅读全文