<?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/categories/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/categories/kubernetes/index.xml" rel="self" type="application/rss+xml"/><item><title>在 Kubernetes 中使用 localPv 部署 Gitlab</title><link>https://blog.treesir.pub/posts/kubernetes-deploy-gitlab/</link><pubDate>Tue, 01 Jun 2021 10:13:29 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/kubernetes-deploy-gitlab/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>Kubernetes Version: &lt;code>v1.20.4&lt;/code>&lt;/li>
&lt;li>Postgres Version: &lt;code>12.7&lt;/code>&lt;/li>
&lt;li>Redis Version: &lt;code>5.0.9&lt;/code>&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>因在官方提供的 &lt;code>gitlab-ce&lt;/code> 镜像中，内置了 Postgres &amp;amp; Redis 的安装，在实际生产使用过程中，想让其连接使用外部统一的服务进行使用，来合理统一的管理，并有效降低对应资源使用率，这里使用 dokcer 非官方镜像: &lt;code>sameersbn/gitlab:13.12.1&lt;/code> 进行使用&lt;/p></description></item><item><title>Kind 部署本地k8s集群的使用记录</title><link>https://blog.treesir.pub/posts/first-kind/</link><pubDate>Sun, 15 Nov 2020 14:24:42 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/first-kind/</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="#%e5%8f%82%e8%80%83%e8%b5%84%e6%96%99" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>&lt;a
href="https://github.com/kubernetes-sigs/kind"
target="_blank"
>Github 地址&lt;/a>&lt;/li>
&lt;li>&lt;a
href="https://blog.tianfeiyu.com/2019/09/06/kind_deploy/"
target="_blank"
>参考博客&lt;/a>&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="#%e5%ae%89%e8%a3%85" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">curl -Lo ./kind &lt;span class="s2">&amp;#34;https://kind.sigs.k8s.io/dl/v0.9.0/kind-&lt;/span>&lt;span class="k">$(&lt;/span>uname&lt;span class="k">)&lt;/span>&lt;span class="s2">-amd64&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chmod +x ./kind
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mv ./kind /some-dir-in-your-PATH/kind
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&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="#%e5%90%af%e5%8a%a8%e9%9b%86%e7%be%a4" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>注意启动集群前 请确认 docker 服务是否启动&lt;/p></description></item><item><title>使用 Helm 配合 localPV 在 K8s 中部署 Mariadb 主程复制集群</title><link>https://blog.treesir.pub/posts/helm-k8s-deploy-mariadb/</link><pubDate>Tue, 25 May 2021 11:33:17 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/helm-k8s-deploy-mariadb/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>helm version: &lt;code>v3.3.1&lt;/code>&lt;/li>
&lt;li>kubernetes: &lt;code>v1.17.9&lt;/code>&lt;/li>
&lt;li>使用 helm chart: &lt;code>bitnami/mariadb&lt;/code>&lt;/li>
&lt;li>操作系统: &lt;code>CentOS 7.8.2003&lt;/code>&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">helm 部署 &lt;code>mariadb&lt;/code> 前的准备
&lt;div id="helm-部署-mariadb-前的准备" 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="#helm-%e9%83%a8%e7%bd%b2-mariadb-%e5%89%8d%e7%9a%84%e5%87%86%e5%a4%87" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">添加 helm 私服
&lt;div id="添加-helm-私服" 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%b7%bb%e5%8a%a0-helm-%e7%a7%81%e6%9c%8d" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">helm repo add bitnami https://charts.bitnami.com/bitnami
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">helm repo update &lt;span class="c1"># 更新仓库索引&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">helm search repo mariadb
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">bitnami/mariadb 9.3.12 10.5.10 Fast, reliable, scalable, and easy to use open-...
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;h2 class="relative group">对 chart 进行 定制更改优化
&lt;div id="对-chart-进行-定制更改优化" 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%af%b9-chart-%e8%bf%9b%e8%a1%8c-%e5%ae%9a%e5%88%b6%e6%9b%b4%e6%94%b9%e4%bc%98%e5%8c%96" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>&lt;strong>下载对应 chart 文件&lt;/strong>&lt;/p></description></item><item><title>使用 helm 在 Kubernetes 中部署 Nexus 私服</title><link>https://blog.treesir.pub/posts/helm-k8s-deploy-nexus/</link><pubDate>Sun, 23 May 2021 15:50:31 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/helm-k8s-deploy-nexus/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>helm version: &lt;code>v3.3.1&lt;/code>&lt;/li>
&lt;li>kubernetes: &lt;code>v1.17.9&lt;/code>&lt;/li>
&lt;li>nexus: &lt;code>3.29.0&lt;/code>&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="#%e9%83%a8%e7%bd%b2" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&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="#%e5%87%86%e5%a4%87-storageclass" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>非 &lt;code>必要&lt;/code> 操作，可以选择手动创建 pvc &amp;amp; pv，如果想部署 &lt;code>nfsStorageClass&lt;/code> 的话，请参考早期整理的 &lt;a
href="https://www.treesir.pub/post/k8s-nfs-strage-class/"
target="_blank"
>文档&lt;/a>。此篇文档实战部署步骤中基于 &lt;code>nfsStorageClass &lt;/code> 进行实现。如果是用于 &lt;code>生产环境&lt;/code> 的话，还是建议使用 ssd 或 iops 较高的 &lt;code>磁盘&lt;/code> 作为数据盘使用，数据盘管理方式可以使用 localPv or hostPath 绑定到对应节点进行运行。&lt;/p></description></item><item><title>部署 Nginx-Ingress 并配置暴露 kubernetes dashboard</title><link>https://blog.treesir.pub/posts/ingress-to-dashboard/</link><pubDate>Tue, 22 Dec 2020 09:24:55 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/ingress-to-dashboard/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;a
href="https://www.treesir.pub/post/kubeadm-deploy-k8s1.9/"
target="_blank"
>链接文档&lt;/a>&lt;/p>&lt;/blockquote>
&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%bd%af%e4%bb%b6%e7%89%88%e6%9c%ac%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>helm: &lt;a
href="https://github.com/helm/helm/tags"
target="_blank"
>v3.4.2&lt;/a>&lt;/li>
&lt;li>ingress: &lt;a
href="https://github.com/kubernetes/ingress-nginx/tags"
target="_blank"
>v3.16.1&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">Nginx Ingress
&lt;div id="nginx-ingress" 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="#nginx-ingress" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;a
href="https://kubernetes.github.io/ingress-nginx/"
target="_blank"
>参考文档&lt;/a>&lt;/p></description></item><item><title>使用 Cronjob 定时清理 ElasticSearch 中的日志索引</title><link>https://blog.treesir.pub/posts/cronjob-clean-es-index/</link><pubDate>Tue, 13 Jul 2021 11:45:00 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/cronjob-clean-es-index/</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="#%e8%83%8c%e6%99%af" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>在日常使用 &lt;code>efk&lt;/code> 日志系统的过程中，每天造成的日志索引量是巨大的，需要进行对相关的索引进行定期清理，来缓解后端储存的占用。如何实现在 kubernetes 中进行优雅的定期清理？本文将介绍使用 kubernetes 中的 &lt;code>Cronjob&lt;/code> 资源对象进行其需求的实现。&lt;/p>&lt;/blockquote>
&lt;p>&lt;strong>常规情况下清理 &lt;code>n&lt;/code> day 以前的数据&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">curl -XDELETE http://elasticsearch-logging.kube-system:9200/logstash-&lt;span class="sb">`&lt;/span>date -d&lt;span class="s2">&amp;#34;n days ago&amp;#34;&lt;/span> +&lt;span class="s2">&amp;#34;%Y.%m.%d&amp;#34;&lt;/span>&lt;span class="sb">`&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;blockquote>
&lt;p>这种方法，是网上比较常规的方式，如某一天忘记执行了，就会出现数据未清理干净的情况，有点不优雅，如何解决？&lt;/p></description></item><item><title>修复 Rancher 单机部署升级后 Docker 无法启动问题</title><link>https://blog.treesir.pub/posts/rancher-upgrade-docker/</link><pubDate>Sat, 16 Jan 2021 14:39:59 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rancher-upgrade-docker/</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="#%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>操作系统&lt;/strong>：CentOS 7.9.2009&lt;/li>
&lt;li>&lt;strong>Docker 版本&lt;/strong>：18.09.9&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="#%e9%97%ae%e9%a2%98%e5%a4%8d%e7%8e%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">安装 Rancher
&lt;div id="安装-rancher" 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%ae%89%e8%a3%85-rancher" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">docker pull rancher/rancher:v2.3.5
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">docker run -d &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--restart&lt;span class="o">=&lt;/span>unless-stopped &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--name rancher &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>-p 80:80 -p 443:443 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>--privileged &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span>rancher/rancher:v2.3.5
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>
&lt;figure>
&lt;img class="my-0 rounded-md" loading="lazy" alt="image-20210116134244336" src="https://cdn.treesir.pub/img/image-20210116134244336.png">
&lt;/figure>
&lt;/p></description></item><item><title>Kubernetes 集群控制平面组件频繁重启问题排查记录</title><link>https://blog.treesir.pub/posts/flannel-exclusion-records/</link><pubDate>Fri, 18 Dec 2020 16:24:43 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/flannel-exclusion-records/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Kubernetes 版本&lt;/strong>：v1.19.6&lt;/li>
&lt;li>&lt;strong>操作系统&lt;/strong>：CentOS 7.9.2009&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="#%e9%97%ae%e9%a2%98%e7%8e%b0%e8%b1%a1" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>最近在使用 Kubernetes 集群时，发现集群响应变慢。排查发现 Master 节点中 &lt;code>controller-manager&lt;/code> 及 &lt;code>scheduler&lt;/code> 组件频繁重启。&lt;/p></description></item><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>Rke 集群集成 Kube-Vip 实现 Loadbalance Service 资源的使用</title><link>https://blog.treesir.pub/posts/rke-kubevip-loadbalance/</link><pubDate>Tue, 12 Oct 2021 13:44:45 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rke-kubevip-loadbalance/</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="#%e8%83%8c%e6%99%af" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;code>Kube-Vip&lt;/code> 最初是为 Kubernetes 控制平面提供 HA 解决方案而创建的，随着时间的推移，它已经发展为将相同的功能合并到 Kubernetes 的 LoadBalancer 类型的 Service 中。Kube-Vip &lt;code>特点&lt;/code> 如下：&lt;/p>
&lt;ul>
&lt;li>VIP 地址可以是 IPv4 或 IPv6&lt;/li>
&lt;li>带有 ARP（第2层）或 BGP（第3层）的控制平面&lt;/li>
&lt;li>使用领导选举或 &lt;code>raft&lt;/code> 控制平面&lt;/li>
&lt;li>带有 kubeadm（静态 Pod）的控制平面 HA&lt;/li>
&lt;li>带有 K3s/和其他（DaemonSets）的控制平面 HA&lt;/li>
&lt;li>使用 ARP 领导者选举的 Service LoadBalancer（第 2 层）&lt;/li>
&lt;li>通过 BGP 使用多个节点的 Service LoadBalancer&lt;/li>
&lt;li>每个命名空间或全局的 Service LoadBalancer 地址池&lt;/li>
&lt;li>Service LoadBalancer 地址通过 UPNP 暴露给网关&lt;/li>
&lt;/ul>&lt;/blockquote>
&lt;p>集群 master 节点一般不会很多，kube-vip 只需在 k8s 中的控制平面部署。这里使用方法采用 &lt;code>静态 pod&lt;/code> + &lt;code>ARP &lt;/code>来简单实现。在大规模的场景下可以尝试使用 BGP ，这需要相应的 BGP 服务来做支撑。&lt;/p></description></item><item><title>记录一次 JupyterLab 插件打包问题的修复</title><link>https://blog.treesir.pub/posts/pipeline-jupyter-labextension-build-fix/</link><pubDate>Tue, 20 Jul 2021 17:04:26 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/pipeline-jupyter-labextension-build-fix/</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="#%e8%83%8c%e6%99%af" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>在所关联项目 的 jenkins pipeline ci 流水线中，开发告诉我 生成的 pip 包中未有生成相关的 &lt;code>labextension&lt;/code> 依赖文件夹，导致 pip 包虽然是安装成功了，但仍是一个不可用的状态。开发人员告诉我在 &lt;code>linux&lt;/code> &amp;amp; &lt;code>windows&lt;/code> 环境下 均是可以正常生成相关依赖文件夹的，问我是不是哪里配置有点问题，思索了一下 和他说会不会是 jenkins slave 使用的 是 &lt;code>容器&lt;/code> 的原因？给了他一个启动命令，测试在容器里面生成一下包看看，启动命令如下所示:&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>使用 Kube-VIP 部署高可用 Kubernetes 集群</title><link>https://blog.treesir.pub/posts/kube-vip-deploy-ha-k8s-cluster/</link><pubDate>Thu, 24 Jun 2021 11:01:10 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/kube-vip-deploy-ha-k8s-cluster/</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="#%e6%96%b9%e6%a1%88%e4%bb%8b%e7%bb%8d" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>在私有环境中部署 Kubernetes 高可用集群时，传统方案需要准备硬件或软件负载均衡器来创建多控制平面集群。通常我们会选择使用 HAProxy + Keepalived 来实现这个功能：创建 2 个负载均衡器虚拟机，分配一个 VIP（虚拟 IP），通过 VIP 将流量重定向到后端的 Kubernetes 控制平面节点。架构如下图所示：&lt;/p>
&lt;p>
&lt;figure>
&lt;img class="my-0 rounded-md" loading="lazy" alt="20210616142006" src="https://cdn.treesir.pub/img/20210616142006.png">
&lt;/figure>
&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 导入集群时 Scheduler 和 Controller Manager 不健康问题</title><link>https://blog.treesir.pub/posts/rancher-import-cluster-fix/</link><pubDate>Tue, 08 Jun 2021 08:45:22 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rancher-import-cluster-fix/</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="#%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Kubernetes 版本&lt;/strong>：v1.20.4 (KubeKey 部署)&lt;/li>
&lt;li>&lt;strong>操作系统&lt;/strong>：CentOS 7.9.2009&lt;/li>
&lt;li>&lt;strong>Rancher 版本&lt;/strong>：v2.4.15&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">准备 Kubernetes 测试环境
&lt;div id="准备-kubernetes-测试环境" 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%87%86%e5%a4%87-kubernetes-%e6%b5%8b%e8%af%95%e7%8e%af%e5%a2%83" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>本次使用 KubeKey 进行一键部署。KubeKey 底层集群部署基于 kubeadm，详细信息可参考 &lt;a
href="https://github.com/kubesphere/kubekey.git"
target="_blank"
>GitHub 地址&lt;/a>。&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>使用 Helm 部署 Spinnaker 持续部署(CD)平台</title><link>https://blog.treesir.pub/posts/spinnaker-helm-installd/</link><pubDate>Mon, 24 May 2021 16:33:49 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/spinnaker-helm-installd/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>Kubernetes Version: &lt;code>v1.17.9&lt;/code>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>操作系统: &lt;code>CentOS 7.8.2003 &lt;/code>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Helm Version: &lt;code>v3.2.1&lt;/code>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Spinnaker Version: &lt;code>1.26.3&lt;/code>&lt;/p>
&lt;blockquote>
&lt;p>&lt;a
href="https://spinnaker.io/community/releases/versions/"
target="_blank"
>spinnaker 版本说明&lt;/a>&lt;/p>&lt;/blockquote>
&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">spinnaker 组件说明
&lt;div id="spinnaker-组件说明" 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="#spinnaker-%e7%bb%84%e4%bb%b6%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>Deck：前端web页面 端口9000&lt;/p></description></item><item><title>Rancher 开启监控后的，阈值告警配置说明 (三)</title><link>https://blog.treesir.pub/posts/rancher-monitor-config-third/</link><pubDate>Wed, 19 May 2021 08:41:26 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rancher-monitor-config-third/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>此文档为 rancher &lt;code>monitor&lt;/code> 使用系列的 &lt;code>第三篇&lt;/code> ，主要介绍与 &lt;code>dingtalk&lt;/code> 关联配置告警通知、prometheus 告警阈值的配置使用&lt;/p>&lt;/blockquote>
&lt;h2 class="relative group">配置安装 dingtalk webhook
&lt;div id="配置安装-dingtalk-webhook" 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%85%8d%e7%bd%ae%e5%ae%89%e8%a3%85-dingtalk-webhook" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;a
href="https://github.com/timonwong/prometheus-webhook-dingtalk"
target="_blank"
>webhook github 地址&lt;/a>&lt;/p></description></item><item><title>Rancher 开启监控，及生产应用的优化配置工作说明 (一)</title><link>https://blog.treesir.pub/posts/rancher-monitor-config-first/</link><pubDate>Mon, 17 May 2021 10:41:26 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rancher-monitor-config-first/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>kubernetes version: &lt;code>v1.17.9&lt;/code>&lt;/li>
&lt;li>rancher dashboard: &lt;code>v2.3.5&lt;/code>&lt;/li>
&lt;li>操作系统: &lt;code>centos 7.8.2003 &lt;/code>&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="#%e5%9f%ba%e7%a1%80%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;h2 class="relative group">使用 kubekey 部署 kubernetes 集群
&lt;div id="使用-kubekey-部署-kubernetes-集群" 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%bd%bf%e7%94%a8-kubekey-%e9%83%a8%e7%bd%b2-kubernetes-%e9%9b%86%e7%be%a4" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>由于篇幅原因，此处省略部署说明，请参考较早期的 &lt;a
href="http://hugo.blog:1313/post/kubekey-install-k8s/"
target="_blank"
>文档说明&lt;/a>&lt;/p></description></item><item><title>Rancher 开启监控后，exporter/metrics 的添加说明 (二)</title><link>https://blog.treesir.pub/posts/rancher-monitor-config-second/</link><pubDate>Mon, 17 May 2021 10:41:26 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/rancher-monitor-config-second/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;a
href="https://www.treesir.pub/post/rancher-monitor-config-first/"
target="_blank"
>&lt;code>上期&lt;/code>&lt;/a> 介绍了 &lt;code>rancher prometheus operator&lt;/code> 的安装和基础 targets 的修复工作。有的时候我们抓取的 exporter metrics 并不在同集群且与集群没有任何关联时，应该怎么和 rancher &lt;code>monitor&lt;/code> 进行关联配置呢？下面文档将配置展示部署外部 &lt;code>exporter &lt;/code>, 的安装说明、指标抓取、 和监控系统的关联。&lt;/p></description></item><item><title>Velero 备份迁移工具安装与配置</title><link>https://blog.treesir.pub/posts/velero-install/</link><pubDate>Sun, 16 May 2021 18:00:36 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/velero-install/</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="#%e7%8e%af%e5%a2%83%e5%87%86%e5%a4%87" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&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="#%e5%ae%89%e8%a3%85%e5%9f%ba%e7%a1%80%e4%be%9d%e8%b5%96" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>安装 Docker Compose：&lt;/p></description></item><item><title>K8s 部署 Lxcfs 准入控制器，实现容器中资源单独可见</title><link>https://blog.treesir.pub/posts/k8s-lxcfs-admissionhook/</link><pubDate>Fri, 30 Apr 2021 14:10:31 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/k8s-lxcfs-admissionhook/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>kubernetes version: v1.17.9 (&lt;code>kubeadm&lt;/code>)&lt;/li>
&lt;li>os: 7.8.2003 (Core)&lt;/li>
&lt;li>kubernetes dashboard: rancher &lt;code>v2.4.15&lt;/code>&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%a6%82%e8%bf%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>docker 使用 linux 内核中的 &lt;code>cgroup&lt;/code> 实现了对 容器使用资源的限制，默认容器启动后依旧挂载了宿主机的 &lt;code>/proc&lt;/code> 目录，其中包涵了，&lt;code>meminfo&lt;/code>、&lt;code>cpuinfo&lt;/code>、&lt;code>stat&lt;/code>、&lt;code>uptime&lt;/code> 等资源信息。一些监控工具如 &lt;code>free&lt;/code>、&lt;code>top&lt;/code>、&lt;code>htop&lt;/code> 或 &lt;code>业务应用&lt;/code> 还依赖 &lt;code>/proc&lt;/code> 下文件内容获取资源配置和使用情况。当它们在容器中运行时，实际还是查看到的是宿主机的资源使用，导致资源使用展示源不对，目前社区主流的解决方法是使用 &lt;code>lxcfs&lt;/code> 的方法进行解决。&lt;/p></description></item><item><title>使用 Kubekey 一键 离线/在线 部署 kubernetes 集群</title><link>https://blog.treesir.pub/posts/kubekey-install-k8s/</link><pubDate>Mon, 26 Apr 2021 14:59:36 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/kubekey-install-k8s/</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="#%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&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%a6%82%e8%bf%b0" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;blockquote>
&lt;p>&lt;a
href="https://kubesphere.io/"
target="_blank"
>KubeSphere&lt;/a> 是在 &lt;a
href="https://kubernetes.io/"
target="_blank"
>Kubernetes&lt;/a> 之上构建的面向云原生应用的&lt;strong>分布式操作系统&lt;/strong>，完全开源，支持多云与多集群管理，提供全栈的 IT 自动化运维能力，简化企业的 DevOps 工作流。它的架构可以非常方便地使第三方应用与云原生生态组件进行即插即用 (plug-and-play) 的集成。&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><item><title>Coredns 出现间断性无法正常解析域名问题</title><link>https://blog.treesir.pub/posts/intermittent-coredns-hosts/</link><pubDate>Thu, 07 Jan 2021 14:34:16 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/intermittent-coredns-hosts/</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>Kubernetes 节点中，有&lt;code>一台节点&lt;/code>使用 coredns 进行解析&lt;code>某个域名&lt;/code>时，出现间断性无法正常解析问题，而解析另外一个域名时不会出现解析问题。&lt;/p>
&lt;blockquote>
&lt;p>再次重复一下问题重点: &lt;code>且在集群中的某台节点中出现，且使用某个域名时出现&lt;/code>&lt;/p>&lt;/blockquote>
&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%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>操作系统: CentOS Linux release 7.9.2009&lt;/li>
&lt;li>Kubernetes 集群: v1.17.4 （集群使用 rancher &lt;code>自定义添加集群&lt;/code> 一键部署）&lt;/li>
&lt;li>Dashboard: Rancher-v2.3.5&lt;/li>
&lt;li>Linux Kernel: 5.10.3-1.el7.elrepo.x86_64&lt;/li>
&lt;li>Coredns : Coredns:1.6.5 + Node-local-dns&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="#%e5%b7%a5%e5%85%b7%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>测试时使用的容器: praqma/network-multitool:latest&lt;/p></description></item><item><title>Kubeadm 部署 kubernetes-v1.19.x 集群</title><link>https://blog.treesir.pub/posts/kubeadm-deploy-k8s1.9/</link><pubDate>Mon, 21 Dec 2020 13:19:31 +0800</pubDate><author>yangzun@treesir.pub (Zayn)</author><guid>https://blog.treesir.pub/posts/kubeadm-deploy-k8s1.9/</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="#%e7%b3%bb%e7%bb%9f%e7%8e%af%e5%a2%83%e8%af%b4%e6%98%8e" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;ul>
&lt;li>使用操作系统: Centos-7.9.2009&lt;/li>
&lt;li>操作系统内核版本: 4.4.248 (&lt;code>lt&lt;/code>)&lt;/li>
&lt;li>Docker容器版本: 18.09.9&lt;/li>
&lt;li>Kubeadm 版本: 1.19.6&lt;/li>
&lt;li>节点说明:
&lt;ul>
&lt;li>master01: 192.168.8.70 ,192.168.88.70&lt;/li>
&lt;li>node01: 192.168.8.71 ,192.168.88.71&lt;/li>
&lt;li>(备注: 为每个节点配置了两个ip，对外服务网段为: &lt;code>192.168.8.0/24&lt;/code>, 集群内部通讯: &lt;code>192.168.88.0/24&lt;/code>)&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul>
&lt;h2 class="relative group">OS 准备
&lt;div id="os-准备" 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="#os-%e5%87%86%e5%a4%87" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&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%b3%bb%e7%bb%9f%e5%88%9d%e5%a7%8b%e5%8c%96" aria-label="锚点">#&lt;/a>
&lt;/span>
&lt;/h2>
&lt;p>&lt;code>确保已将selinux关闭&lt;/code>&lt;/p></description></item></channel></rss>