<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Kubernetes on Zayn's Blog</title><link>https://blog.treesir.pub/tags/kubernetes/</link><description>Recent content in Kubernetes on Zayn's Blog</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><managingEditor>yangzun@treesir.pub (Zayn)</managingEditor><webMaster>yangzun@treesir.pub (Zayn)</webMaster><copyright>2021-2026 Zayn</copyright><lastBuildDate>Sun, 15 Mar 2026 21:24:00 +0800</lastBuildDate><atom:link href="https://blog.treesir.pub/tags/kubernetes/index.xml" rel="self" type="application/rss+xml"/><item><title>Istio in Action 学习笔记</title><link>https://blog.treesir.pub/posts/istio-in-action-study/</link><pubDate>Sun, 15 Mar 2026 21:24:00 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/istio-in-action-study/</guid><description>&lt;h2 class="relative group">Istio in Action 学习笔记
&lt;div id="istio-in-action-学习笔记" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#istio-in-action-%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>Istio 是当下最流行的 Service Mesh（服务网格）方案之一，本文是学习《Istio in Action》书籍的详细笔记，涵盖从入门到进阶的核心知识点。&lt;/p>&lt;/blockquote>
&lt;h2 class="relative group">1. Istio 解决的问题
&lt;div id="1-istio-解决的问题" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#1-istio-%e8%a7%a3%e5%86%b3%e7%9a%84%e9%97%ae%e9%a2%98" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>在微服务架构中，网络问题往往是最大的挑战之一：&lt;/p></description></item><item><title>使用 Kubernetes CronJob 自动备份 MySQL 数据到 MinIO</title><link>https://blog.treesir.pub/posts/k8s-cronjob-backup-mysql/</link><pubDate>Mon, 24 Jul 2023 16:14:42 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/k8s-cronjob-backup-mysql/</guid><description>&lt;p>随着 Kubernetes 在生产环境中的广泛应用，越来越多的有状态应用（如 MySQL 数据库）也开始部署在 K8s 集群中。数据安全是生产环境的重中之重，本文将详细介绍如何使用 Kubernetes CronJob 实现 MySQL 数据库的自动化备份，并将备份文件安全地存储到 MinIO 对象存储中。&lt;/p>
&lt;h2 class="relative group">方案概述
&lt;div id="方案概述" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e6%96%b9%e6%a1%88%e6%a6%82%e8%bf%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h3 class="relative group">备份架构
&lt;div id="备份架构" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e5%a4%87%e4%bb%bd%e6%9e%b6%e6%9e%84" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;div class="mermaid" align="center">
&lt;pre>
flowchart LR
MySQL[MySQL Pod&lt;br/>Database] -->|导出数据| CronJob[CronJob Pod&lt;br/>mysqldump]
CronJob -->|上传备份| MinIO[MinIO Server&lt;br/>Bucket]
&lt;/pre>
&lt;/div>
&lt;h3 class="relative group">方案优势
&lt;div id="方案优势" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e6%96%b9%e6%a1%88%e4%bc%98%e5%8a%bf" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>自动化&lt;/strong>: 使用 CronJob 实现定时自动备份，无需人工干预&lt;/li>
&lt;li>&lt;strong>可靠性&lt;/strong>: 备份文件存储在独立的对象存储中，提高数据安全性&lt;/li>
&lt;li>&lt;strong>可扩展&lt;/strong>: 支持多数据库实例的备份，易于扩展&lt;/li>
&lt;li>&lt;strong>监控友好&lt;/strong>: 可以通过 Kubernetes 原生监控查看备份任务状态&lt;/li>
&lt;li>&lt;strong>成本效益&lt;/strong>: 使用开源的 MinIO 作为存储后端，降低成本&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">环境准备
&lt;div id="环境准备" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e7%8e%af%e5%a2%83%e5%87%86%e5%a4%87" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h3 class="relative group">前置条件
&lt;div id="前置条件" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e5%89%8d%e7%bd%ae%e6%9d%a1%e4%bb%b6" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>组件&lt;/th>
&lt;th>版本要求&lt;/th>
&lt;th>说明&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Kubernetes&lt;/td>
&lt;td>v1.18+&lt;/td>
&lt;td>支持 CronJob v1 API&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>MySQL&lt;/td>
&lt;td>5.7+ / 8.0+&lt;/td>
&lt;td>运行在 K8s 集群中&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>MinIO&lt;/td>
&lt;td>任意版本&lt;/td>
&lt;td>对象存储服务&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>网络连通性&lt;/td>
&lt;td>-&lt;/td>
&lt;td>CronJob Pod 能访问 MySQL 和 MinIO&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 class="relative group">自定义镜像
&lt;div id="自定义镜像" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e8%87%aa%e5%ae%9a%e4%b9%89%e9%95%9c%e5%83%8f" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h3>
&lt;p>本方案使用了专门构建的备份镜像，包含了 mysqldump 和 MinIO 客户端工具。&lt;/p></description></item><item><title>Kubernetes VPA 垂直 Pod 自动伸缩完整指南</title><link>https://blog.treesir.pub/posts/k8s-vpa/</link><pubDate>Thu, 08 Jul 2021 14:41:34 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/k8s-vpa/</guid><description>&lt;h2 class="relative group">VPA 简介
&lt;div id="vpa-简介" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#vpa-%e7%ae%80%e4%bb%8b" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">什么是 VPA？
&lt;div id="什么是-vpa" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-vpa" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Vertical Pod Autoscaler（VPA，垂直 Pod 自动伸缩器）是 Kubernetes 的一个组件，它可以根据 Pod 的实际资源使用情况，自动调整 Pod 的 CPU 和内存请求值（requests）。&lt;/p></description></item><item><title>使用 Kaniko 在 Kubernetes 中构建 Docker 镜像</title><link>https://blog.treesir.pub/posts/kaniko-image-build/</link><pubDate>Tue, 15 Jun 2021 10:02:48 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/kaniko-image-build/</guid><description>&lt;p>在 Kubernetes 环境中构建 Docker 镜像一直是一个挑战，传统的 Docker-in-Docker 方案存在安全风险和复杂性问题。Kaniko 作为 Google 开源的容器镜像构建工具，提供了一个安全、高效的解决方案。&lt;/p>
&lt;h2 class="relative group">什么是 Kaniko
&lt;div id="什么是-kaniko" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-kaniko" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Kaniko 是由 Google 开发的开源工具，专门用于在容器或 Kubernetes 集群内构建容器镜像。它的核心优势包括：&lt;/p></description></item><item><title>快速删除 Rancher 中失败的 Pod 资源</title><link>https://blog.treesir.pub/posts/quick-delete-rancher-failed-pod/</link><pubDate>Thu, 27 May 2021 08:59:56 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/quick-delete-rancher-failed-pod/</guid><description>&lt;h2 class="relative group">问题描述
&lt;div id="问题描述" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e9%97%ae%e9%a2%98%e6%8f%8f%e8%bf%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>在 Rancher 管理的 Kubernetes 集群中，有时会出现副本集中的 Pod 部署失败的情况。如下图所示，失败的 Pod 数量可能达到上千个，手动逐一删除非常耗时。&lt;/p>
&lt;p>
&lt;figure>
&lt;img class="my-0 rounded-md" loading="lazy" alt="image-20210527085545254" src="https://cdn.treesir.pub/img/image-20210527085545254.png">
&lt;/figure>
&lt;/p>
&lt;h2 class="relative group">解决方案
&lt;div id="解决方案" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">批量删除失败的 Pod
&lt;div id="批量删除失败的-pod" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e6%89%b9%e9%87%8f%e5%88%a0%e9%99%a4%e5%a4%b1%e8%b4%a5%e7%9a%84-pod" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>使用 kubectl 命令批量删除状态为 &lt;code>MatchNodeSelector&lt;/code> 的失败 Pod：&lt;/p></description></item><item><title>在 Kubernetes 中部署 NFS 动态存储类完整指南</title><link>https://blog.treesir.pub/posts/k8s-nfs-strage-class/</link><pubDate>Tue, 19 Jan 2021 14:54:30 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/k8s-nfs-strage-class/</guid><description>&lt;p>在 Kubernetes 集群中，持久化存储是有状态应用的重要基础设施。NFS（Network File System）作为一种成熟的网络文件系统，可以为 Kubernetes 提供简单可靠的共享存储解决方案。本文将详细介绍如何部署 NFS StorageClass 实现动态存储供应。&lt;/p>
&lt;h2 class="relative group">什么是 StorageClass
&lt;div id="什么是-storageclass" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-storageclass" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>StorageClass 是 Kubernetes 中的一种资源对象，用于描述存储的&amp;quot;类别&amp;quot;。它的主要作用包括：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>动态供应&lt;/strong>: 自动创建 PersistentVolume（PV）&lt;/li>
&lt;li>&lt;strong>存储抽象&lt;/strong>: 为不同类型的存储提供统一接口&lt;/li>
&lt;li>&lt;strong>参数化配置&lt;/strong>: 支持不同的存储参数和策略&lt;/li>
&lt;li>&lt;strong>自动化管理&lt;/strong>: 减少手动创建 PV 的工作量&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">方案架构
&lt;div id="方案架构" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e6%96%b9%e6%a1%88%e6%9e%b6%e6%9e%84" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>本方案采用以下架构：&lt;/p></description></item><item><title>Kubernetes 部署企业级 Kafka 集群完整指南</title><link>https://blog.treesir.pub/posts/k8s-deploy-kafka-cluster/</link><pubDate>Tue, 19 Jan 2021 13:44:03 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/k8s-deploy-kafka-cluster/</guid><description>&lt;h2 class="relative group">Apache Kafka 简介
&lt;div id="apache-kafka-简介" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#apache-kafka-%e7%ae%80%e4%bb%8b" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">什么是 Apache Kafka
&lt;div id="什么是-apache-kafka" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-apache-kafka" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Apache Kafka 是一个开源的分布式事件流处理平台，由 LinkedIn 开发并贡献给 Apache 软件基金会。它被数千家公司用于高性能数据管道、流分析、数据集成和关键任务应用程序。&lt;/p></description></item><item><title>Traefik Ingress Controller 完整部署指南</title><link>https://blog.treesir.pub/posts/ingress-traefik/</link><pubDate>Sun, 17 Jan 2021 16:15:32 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/ingress-traefik/</guid><description>&lt;h2 class="relative group">Traefik 简介
&lt;div id="traefik-简介" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#traefik-%e7%ae%80%e4%bb%8b" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">什么是 Traefik？
&lt;div id="什么是-traefik" class="anchor">&lt;/div>
&lt;span
class="absolute top-0 w-6 transition-opacity opacity-0 ltr:-left-6 rtl:-right-6 not-prose group-hover:opacity-100">
&lt;a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700 !no-underline" href="#%e4%bb%80%e4%b9%88%e6%98%af-traefik" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>Traefik 是一个现代化的云原生反向代理和负载均衡器，专为微服务架构设计。它就像一个智能的&amp;quot;交通指挥员&amp;quot;，能够自动发现您的服务并为它们配置路由规则。&lt;/p></description></item></channel></rss>