<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Antony 筆記：技術原理與實務經驗 – Antony 筆記：技術原理與實務經驗</title><link>https://blog.kubeantony.com/</link><description>Recent content on Antony 筆記：技術原理與實務經驗</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><lastBuildDate>Tue, 30 Jun 2026 09:58:18 +0800</lastBuildDate><atom:link href="https://blog.kubeantony.com/index.xml" rel="self" type="application/rss+xml"/><item><title>Install a kubeadm Kubernetes cluster with Cilium, disabling kube-proxy</title><link>https://blog.kubeantony.com/archive/kubernetes/install-a-kubeadm-kubernetes-cluster-with-cilium-disabling-kube-proxy/</link><pubDate>Tue, 30 Jun 2026 09:58:18 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/install-a-kubeadm-kubernetes-cluster-with-cilium-disabling-kube-proxy/</guid><description>
&lt;h2&gt;Ubuntu 24.04&lt;span class="hx:absolute hx:-mt-20" id="ubuntu-2404"&gt;&lt;/span&gt;
&lt;a href="#ubuntu-2404" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 每一台節點都要做環境準備&lt;span class="hx:absolute hx:-mt-20" id="1-每一台節點都要做環境準備"&gt;&lt;/span&gt;
&lt;a href="#1-%e6%af%8f%e4%b8%80%e5%8f%b0%e7%af%80%e9%bb%9e%e9%83%bd%e8%a6%81%e5%81%9a%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo nano /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
ens18:
dhcp4: false
addresses:
- 192.168.11.72/24
nameservers:
addresses:
- 192.168.11.11
routes:
- to: 0.0.0.0/0
via: 192.168.11.254
$ sudo nano /etc/systemd/timesyncd.conf
...
[Time]
NTP=192.168.11.11
...
$ sudo systemctl restart systemd-timesyncd
$ timedatectl show-timesync --all
$ sudo timedatectl set-timezone Asia/Taipei
$ timedatectl
Local time: Sun 2025-06-29 15:44:28 CST
Universal time: Sun 2025-06-29 07:44:28 UTC
RTC time: Sun 2025-06-29 07:44:28
Time zone: Asia/Taipei (CST, &amp;#43;0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
$ sudo swapoff -a
$ sudo sed -i &amp;#39;/swap/s/^/#/&amp;#39; /etc/fstab
$ cat &amp;lt;&amp;lt;EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
EOF
$ sudo sysctl --system
$ sudo mkdir -p /opt/cni/bin &amp;amp;&amp;amp; \
curl -sL &amp;#34;$(curl -sL https://api.github.com/repos/containernetworking/plugins/releases/latest | \
jq -r &amp;#39;.assets[].browser_download_url&amp;#39; | grep &amp;#39;linux-amd64.*.tgz$&amp;#39;)&amp;#34; -o ~/cni-plugins.tgz &amp;amp;&amp;amp; \
sudo tar xf ~/cni-plugins.tgz -C /opt/cni/bin
$ wget https://github.com/opencontainers/runc/releases/download/v1.3.0/runc.amd64 &amp;amp;&amp;amp; \
sudo install -m 755 runc.amd64 /usr/local/sbin/runc
$ wget https://github.com/containerd/containerd/releases/download/v2.1.3/containerd-2.1.3-linux-amd64.tar.gz &amp;amp;&amp;amp; \
sudo tar Cxzvf /usr/local containerd-2.1.3-linux-amd64.tar.gz &amp;amp;&amp;amp; \
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service &amp;amp;&amp;amp; \
sudo mkdir -p /usr/local/lib/systemd/system &amp;amp;&amp;amp; \
sudo mv containerd.service /usr/local/lib/systemd/system/containerd.service
$ sudo mkdir /etc/containerd
$ sudo containerd config default | sudo tee /etc/containerd/config.toml
$ sudo nano /etc/containerd/config.toml
......
[plugins.&amp;#39;io.containerd.cri.v1.runtime&amp;#39;.containerd.runtimes.runc.options]
SystemdCgroup = true #add
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now containerd
$ sudo systemctl is-active containerd.service
active
$ sudo apt-get update; sudo apt-get upgrade -y
$ sudo apt-get install -y apt-transport-https ca-certificates curl gpg
$ K8S_VERSION=&amp;#39;v1.33&amp;#39;
$ curl -fsSL https://pkgs.k8s.io/core:/stable:/${K8S_VERSION}/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg &amp;amp;&amp;amp; \
echo &amp;#34;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/${K8S_VERSION}/deb/ /&amp;#34; | sudo tee /etc/apt/sources.list.d/kubernetes.list
# Worker node 可不用裝 kubectl
$ sudo apt-get update; sudo apt-get install -y kubelet kubeadm kubectl
$ sudo apt-mark hold kubelet kubeadm kubectl &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;裝 K8s&lt;/h1&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir ~/k8s; cd ~/k8s
nano ~/k8s/init-config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 192.168.11.71 # change from Master node IP
bindPort: 6443
nodeRegistration:
criSocket: unix:///run/containerd/containerd.sock # change from containerd Unix Socket
imagePullPolicy: IfNotPresent
name: c1 # change from Master node hsotname
taints: null
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
kubernetesVersion: 1.33.2
controlPlaneEndpoint: 192.168.11.71:6443
apiServer:
timeoutForControlPlane: 4m0s
#certSANs:
# - 10.10.7.33 # 加入 kube-vip 的 VIP 作為 TLS SAN
certificatesDir: /etc/kubernetes/pki
clusterName: topgun # set your clusterName
controllerManager:
extraArgs:
bind-address: &amp;#34;0.0.0.0&amp;#34;
secure-port: &amp;#34;10257&amp;#34;
scheduler:
extraArgs:
bind-address: &amp;#34;0.0.0.0&amp;#34;
secure-port: &amp;#34;10259&amp;#34;
etcd:
local:
dataDir: /var/lib/etcd
extraArgs:
listen-metrics-urls: &amp;#34;http://0.0.0.0:2381&amp;#34;
dns: {}
imageRepository: registry.k8s.io
networking:
dnsDomain: cluster.local # DNS domain used by Kubernetes Services.
podSubnet: 10.244.0.0/16 # the subnet used by Pods.
serviceSubnet: 10.96.0.0/16 # subnet used by Kubernetes Services.
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 110
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;初始化 K8s&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm init --skip-phases=addon/kube-proxy --upload-certs --config=k8s/init-config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Join worker node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join 192.168.11.71:6443 --token 7pr0b4.79tdi8egs81l4i9g --discovery-token-ca-cert-hash sha256:c6bed66cc0c7f8616a4f920ccc62121b782c37475888a6cc9831ced22fde474f&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;設定 kubeconfig&lt;span class="hx:absolute hx:-mt-20" id="設定-kubeconfig"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-kubeconfig" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p $HOME/.kube; sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config; sudo chown $(id -u):$(id -g) $HOME/.kube/config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;裝 Cilium&lt;span class="hx:absolute hx:-mt-20" id="裝-cilium"&gt;&lt;/span&gt;
&lt;a href="#%e8%a3%9d-cilium" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# Install the Cilium CLI
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
CLI_ARCH=amd64
if [ &amp;#34;$(uname -m)&amp;#34; = &amp;#34;aarch64&amp;#34; ]; then CLI_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
API_SERVER_IP=192.168.11.71
API_SERVER_PORT=6443
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm repo add cilium https://helm.cilium.io/
helm install cilium cilium/cilium \
--namespace kube-system \
--set kubeProxyReplacement=true \
--set k8sServiceHost=${API_SERVER_IP} \
--set k8sServicePort=${API_SERVER_PORT} \
--set bpf.masquerade=true \
--set ipam.mode=kubernetes \
--set ipv4NativeRoutingCIDR=10.244.0.0/16 \
--set bpf.datapathMode=netkit
helm upgrade cilium cilium/cilium \
--namespace=kube-system \
--set kubeProxyReplacement=true \
--set k8sServiceHost=${API_SERVER_IP} \
--set k8sServicePort=${API_SERVER_PORT} \
--set hubble.ui.enabled=true \
--set hubble.relay.enabled=true \
--set hubble.ui.frontend.server.ipv6.enabled=false \
--set hubble.ui.service.type=NodePort \
--set bpf.datapathMode=netkit
helm upgrade cilium cilium/cilium --version 1.17.6 \
--namespace kube-system \
--reuse-values \
--set ingressController.enabled=true \
--set ingressController.loadbalancerMode=dedicated
kubectl -n kube-system rollout restart deployment/cilium-operator
kubectl -n kube-system rollout restart ds/cilium&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;Validate the Installation&lt;span class="hx:absolute hx:-mt-20" id="validate-the-installation"&gt;&lt;/span&gt;
&lt;a href="#validate-the-installation" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n kube-system get pods
NAME READY STATUS RESTARTS AGE
cilium-28kw8 1/1 Running 1 (117m ago) 124m
cilium-envoy-c5nxh 1/1 Running 1 (117m ago) 124m
cilium-envoy-phwpp 1/1 Running 0 117m
cilium-envoy-sb7c2 1/1 Running 0 117m
cilium-m5mvp 1/1 Running 0 116m
cilium-operator-c64699c6b-2kgr5 1/1 Running 0 117m
cilium-operator-c64699c6b-4sg5r 0/1 Completed 0 124m
cilium-operator-c64699c6b-ft9x8 0/1 Completed 0 124m
cilium-operator-c64699c6b-zflrv 1/1 Running 0 117m
cilium-r6x55 1/1 Running 0 117m
coredns-674b8bbfcf-bzk8x 1/1 Running 1 (117m ago) 131m
coredns-674b8bbfcf-tf5fh 1/1 Running 1 (117m ago) 131m
etcd-c1 1/1 Running 1 (117m ago) 131m
hubble-relay-67cfb6bcbd-hx9t8 1/1 Running 0 117m
hubble-ui-85bc4bfc56-57g8f 2/2 Running 0 96m
kube-apiserver-c1 1/1 Running 1 (117m ago) 131m
kube-controller-manager-c1 1/1 Running 1 (117m ago) 131m
kube-scheduler-c1 1/1 Running 1 (117m ago) 131m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cilium status
/¯¯\
/¯¯\__/¯¯\ Cilium: OK
\__/¯¯\__/ Operator: OK
/¯¯\__/¯¯\ Envoy DaemonSet: OK
\__/¯¯\__/ Hubble Relay: OK
\__/ ClusterMesh: disabled
DaemonSet cilium Desired: 3, Ready: 3/3, Available: 3/3
DaemonSet cilium-envoy Desired: 3, Ready: 3/3, Available: 3/3
Deployment cilium-operator Desired: 2, Ready: 2/2, Available: 2/2
Deployment hubble-relay Desired: 1, Ready: 1/1, Available: 1/1
Deployment hubble-ui Desired: 1, Ready: 1/1, Available: 1/1
Containers: cilium Running: 3
cilium-envoy Running: 3
cilium-operator Running: 2, Succeeded: 2
clustermesh-apiserver
hubble-relay Running: 1
hubble-ui Running: 1
Cluster Pods: 8/8 managed by Cilium
Helm chart version: 1.18.0-dev
Image versions cilium quay.io/cilium/cilium-ci:latest: 3
cilium-envoy quay.io/cilium/cilium-envoy:v1.34.1-1750869463-42c7e8cf0f93ea19c9cb7e4d0ad2a339b3f81ad2@sha256:892cab92ffaf8499be90bd227bf07181e4b460ecd97750032ea7e91710a8acce: 3
cilium-operator quay.io/cilium/operator-generic-ci:latest: 4
hubble-relay quay.io/cilium/hubble-relay-ci:latest: 1
hubble-ui quay.io/cilium/hubble-ui-backend:v0.13.2@sha256:a034b7e98e6ea796ed26df8f4e71f83fc16465a19d166eff67a03b822c0bfa15: 1
hubble-ui quay.io/cilium/hubble-ui:v0.13.2@sha256:9e37c1296b802830834cc87342a9182ccbb71ffebb711971e849221bd9d59392: 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>跨叢集 CoreDNS AXFR 同步與 PodCIDR 路由設定紀錄</title><link>https://blog.kubeantony.com/archive/misc/20260629/</link><pubDate>Mon, 29 Jun 2026 03:28:06 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/20260629/</guid><description>
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# us-tkcdc-01
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
tkdt-control-plane Ready control-plane 19h v1.34.3 172.22.16.1 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkdt-master1 Ready &amp;lt;none&amp;gt; 19h v1.34.3 172.22.16.2 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkdt-worker1 Ready &amp;lt;none&amp;gt; 19h v1.34.3 172.22.16.3 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkdt-worker2 Ready &amp;lt;none&amp;gt; 19h v1.34.3 172.22.16.4 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkdt-worker3 Ready &amp;lt;none&amp;gt; 19h v1.34.3 172.22.16.5 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
$ kubectl describe nodes | grep -i podcidr
PodCIDR: 10.244.16.0/25
PodCIDRs: 10.244.16.0/25
PodCIDR: 10.244.16.128/25
PodCIDRs: 10.244.16.128/25
PodCIDR: 10.244.17.0/25
PodCIDRs: 10.244.17.0/25
PodCIDR: 10.244.17.128/25
PodCIDRs: 10.244.17.128/25
PodCIDR: 10.244.18.0/25
PodCIDRs: 10.244.18.0/25
$ kubectl -n kube-system get cm kubeadm-config -o yaml | grep serviceSubnet
serviceSubnet: 10.98.16.0/24
sudo route add -net 172.22.26.0 netmask 255.255.255.128 gw 192.168.11.102
sudo route add -net 10.244.17.0 netmask 255.255.255.128 gw 172.22.16.3
sudo route add -net 10.244.17.128 netmask 255.255.255.128 gw 172.22.16.4
sudo route add -net 10.244.18.0 netmask 255.255.255.128 gw 172.22.16.5
sudo route add -net 10.244.25.0 netmask 255.255.255.128 gw 192.168.11.102
sudo route add -net 10.244.25.128 netmask 255.255.255.128 gw 192.168.11.102
sudo route add -net 10.244.26.0 netmask 255.255.255.128 gw 192.168.11.102
sudo route add -net 10.98.16.0 netmask 255.255.255.0 gw 172.22.16.5
sudo route add -net 10.98.24.0 netmask 255.255.255.0 gw 192.168.11.102
kubectl apply -f - &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
apiVersion: v1
kind: Service
metadata:
name: nginx-tkdt
labels:
app: nginx-tkdt
spec:
clusterIP: None
selector:
app: nginx-tkdt
ports:
- port: 80
name: web
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nginx-tkdt
spec:
serviceName: nginx-tkdt
replicas: 2
selector:
matchLabels:
app: nginx-tkdt
template:
metadata:
labels:
app: nginx-tkdt
spec:
containers:
- name: nginx-tkdt
image: nginx
ports:
- containerPort: 80
name: web
EOF
$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-tkdt-0 1/1 Running 0 36s 10.244.17.5 tkdt-worker1 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
nginx-tkdt-1 1/1 Running 0 33s 10.244.18.6 tkdt-worker3 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
$ kubectl get svc nginx-tkdt
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-tkdt ClusterIP None &amp;lt;none&amp;gt; 80/TCP 44s
$ curl -sI http://10.244.17.5 | head -n 1
HTTP/1.1 200 OK
$ curl -sI http://10.244.26.5 | head -n 1
HTTP/1.1 200 OK
$ dig @10.98.16.10 nginx-tkdt-0.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.17.5
$ dig @10.98.16.10 nginx-tkdt-1.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.18.6
$ dig @10.98.24.10 nginx-tkndt-0.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.26.5
$ dig @10.98.24.10 nginx-tkndt-1.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.25.5
$ kubectl -n kube-system edit cm coredns
transfer tkdt.k8s { # 其他人可以跟我用 AXFR 同步
to * # 來源 IP 問題，先開放給所有人
}
secondary tkndt.k8s { # 我向 tkndt 同步的 domain
transfer from 10.98.24.10 # tkndt 的 coredns svc ip
}
$ kubectl -n kube-system rollout restart deployment coredns
$ kubectl -n kube-system get pods -l k8s-app=kube-dns
NAME READY STATUS RESTARTS AGE
coredns-7d597fb798-5zx2n 1/1 Running 0 16s
coredns-7d597fb798-7xmg7 1/1 Running 0 16s
$ dig @10.98.16.10 nginx-tkndt-0.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.26.5
$ dig @10.98.16.10 nginx-tkndt-1.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.25.5
$ kubectl exec nginx-tkdt-0 -- curl -sI nginx-tkndt-0.nginx-tkndt.default.svc.tkndt.k8s | head -n 1
HTTP/1.1 200 OK
$ kubectl exec nginx-tkdt-0 -- curl -sI nginx-tkndt-1.nginx-tkndt.default.svc.tkndt.k8s | head -n 1
HTTP/1.1 200 OK
==========================================================================
# us-tkcdc-02
$ kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
tkndt-control-plane Ready control-plane 18h v1.34.3 172.22.26.1 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkndt-master1 Ready &amp;lt;none&amp;gt; 18h v1.34.3 172.22.26.2 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkndt-worker1 Ready &amp;lt;none&amp;gt; 18h v1.34.3 172.22.26.3 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkndt-worker2 Ready &amp;lt;none&amp;gt; 18h v1.34.3 172.22.26.4 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
tkndt-worker3 Ready &amp;lt;none&amp;gt; 18h v1.34.3 172.22.26.5 &amp;lt;none&amp;gt; Debian GNU/Linux 12 (bookworm) 6.8.0-124-generic containerd://2.2.0
$ kubectl describe nodes | grep -i podcidr
PodCIDR: 10.244.24.0/25
PodCIDRs: 10.244.24.0/25
PodCIDR: 10.244.24.128/25
PodCIDRs: 10.244.24.128/25
PodCIDR: 10.244.25.0/25
PodCIDRs: 10.244.25.0/25
PodCIDR: 10.244.25.128/25
PodCIDRs: 10.244.25.128/25
PodCIDR: 10.244.26.0/25
PodCIDRs: 10.244.26.0/25
$ kubectl -n kube-system get cm kubeadm-config -o yaml | grep serviceSubnet
serviceSubnet: 10.98.24.0/24
sudo route add -net 172.22.16.0 netmask 255.255.255.128 gw 192.168.11.101
sudo route add -net 10.244.25.0 netmask 255.255.255.128 gw 172.22.26.3
sudo route add -net 10.244.25.128 netmask 255.255.255.128 gw 172.22.26.4
sudo route add -net 10.244.26.0 netmask 255.255.255.128 gw 172.22.26.5
sudo route add -net 10.244.17.0 netmask 255.255.255.128 gw 192.168.11.101
sudo route add -net 10.244.17.128 netmask 255.255.255.128 gw 192.168.11.101
sudo route add -net 10.244.18.0 netmask 255.255.255.128 gw 192.168.11.101
sudo route add -net 10.98.16.0 netmask 255.255.255.0 gw 192.168.11.101
sudo route add -net 10.98.24.0 netmask 255.255.255.0 gw 172.22.26.5
kubectl apply -f - &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
apiVersion: v1
kind: Service
metadata:
name: nginx-tkndt
labels:
app: nginx-tkndt
spec:
clusterIP: None
selector:
app: nginx-tkndt
ports:
- port: 80
name: web
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nginx-tkndt
spec:
serviceName: nginx-tkndt
replicas: 2
selector:
matchLabels:
app: nginx-tkndt
template:
metadata:
labels:
app: nginx-tkndt
spec:
containers:
- name: nginx-tkndt
image: nginx
ports:
- containerPort: 80
name: web
EOF
$ kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-tkndt-0 1/1 Running 0 29s 10.244.26.5 tkndt-worker3 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
nginx-tkndt-1 1/1 Running 0 23s 10.244.25.5 tkndt-worker1 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
$ kubectl get svc nginx-tkndt
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-tkndt ClusterIP None &amp;lt;none&amp;gt; 80/TCP 90s
$ curl -sI http://10.244.17.5 | head -n 1
HTTP/1.1 200 OK
$ curl -sI http://10.244.26.5 | head -n 1
HTTP/1.1 200 OK
$ dig @10.98.24.10 nginx-tkndt-0.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.26.5
$ dig @10.98.24.10 nginx-tkndt-1.nginx-tkndt.default.svc.tkndt.k8s &amp;#43;short
10.244.25.5
$ dig @10.98.16.10 nginx-tkdt-0.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.17.5
$ dig @10.98.16.10 nginx-tkdt-1.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.18.6
$ kubectl -n kube-system edit cm coredns
transfer tkndt.k8s { # 其他人可以跟我用 AXFR 同步
to * # 來源 IP 問題，先開放給所有人
}
secondary tkdt.k8s { # 我向 tkndt 同步的 domain
transfer from 10.98.16.10 # tkndt 的 coredns svc ip
}
$ kubectl -n kube-system rollout restart deployment coredns
$ kubectl -n kube-system get pods -l k8s-app=kube-dns
NAME READY STATUS RESTARTS AGE
coredns-7446d9745d-5pjh7 1/1 Running 0 11s
coredns-7446d9745d-5pxtj 1/1 Running 0 11s
$ $ dig @10.98.24.10 nginx-tkdt-0.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.17.5
$ dig @10.98.24.10 nginx-tkdt-1.nginx-tkdt.default.svc.tkdt.k8s &amp;#43;short
10.244.18.6
$ kubectl exec nginx-tkndt-0 -- curl -sI nginx-tkdt-0.nginx-tkdt.default.svc.tkdt.k8s | head -n 1
HTTP/1.1 200 OK
$ kubectl exec nginx-tkndt-0 -- curl -sI nginx-tkdt-1.nginx-tkdt.default.svc.tkdt.k8s | head -n 1
HTTP/1.1 200 OK&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Claude Code Best Practice</title><link>https://blog.kubeantony.com/archive/misc/claude-code-best-practice/</link><pubDate>Mon, 01 Jun 2026 03:25:26 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/claude-code-best-practice/</guid><description>
&lt;h2&gt;AGENTS.md (全域)&lt;span class="hx:absolute hx:-mt-20" id="agentsmd-全域"&gt;&lt;/span&gt;
&lt;a href="#agentsmd-%e5%85%a8%e5%9f%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ nano ~/.claude/AGENTS.md
# 全域偏好
- 回覆使用繁體中文
$ echo @AGENTS.md &amp;gt; ~/.claude/CLAUDE.md&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>洞悉 Cilium 如何傳遞 K8s Pod 網路封包</title><link>https://blog.kubeantony.com/archive/kubernetes/%E6%B4%9E%E6%82%89-cilium-%E5%A6%82%E4%BD%95%E5%82%B3%E9%81%9E-k8s-pod-%E7%B6%B2%E8%B7%AF%E5%B0%81%E5%8C%85/</link><pubDate>Fri, 08 May 2026 06:59:56 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/%E6%B4%9E%E6%82%89-cilium-%E5%A6%82%E4%BD%95%E5%82%B3%E9%81%9E-k8s-pod-%E7%B6%B2%E8%B7%AF%E5%B0%81%E5%8C%85/</guid><description>
&lt;h2&gt;1. Preface&lt;span class="hx:absolute hx:-mt-20" id="1-preface"&gt;&lt;/span&gt;
&lt;a href="#1-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章會在 CNI 使用 Cilium 的 Kubernetes 環境驗證，pod 跟 pod 之間互相溝通時，在同節點或在不同節點，網路的封包會如何傳遞，並搭配 tcpdump + wireshark 分析封包。&lt;/p&gt;
&lt;h2&gt;2. 環境資訊&lt;span class="hx:absolute hx:-mt-20" id="2-環境資訊"&gt;&lt;/span&gt;
&lt;a href="#2-%e7%92%b0%e5%a2%83%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;K8s 節點及版本資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get nodes -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kubeadm-c1.bbg.com Ready control-plane 27d v1.34.1 172.20.6.11 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4
kubeadm-c2.bbg.com Ready control-plane 27d v1.34.1 172.20.6.12 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4
kubeadm-c3.bbg.com Ready control-plane 26d v1.34.1 172.20.6.13 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4
kubeadm-w1.bbg.com Ready worker 26d v1.34.1 172.20.6.14 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4
kubeadm-w2.bbg.com Ready worker 26d v1.34.1 172.20.6.15 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4
kubeadm-w3.bbg.com Ready worker 26d v1.34.1 172.20.6.16 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-85-generic containerd://2.1.4&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;cilium 設定資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm -n kube-system get values cilium&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;USER-SUPPLIED VALUES: # 忽略此行
bpf:
masquerade: true
hubble:
relay:
enabled: true
ui:
enabled: true
service:
type: NodePort
ipam:
mode: kubernetes
ipv4NativeRoutingCIDR: 10.244.0.0/16
k8sServiceHost: 127.0.0.1
k8sServicePort: 6443
kubeProxyReplacement: true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 cilium 版本、routing 模式和 device mode&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system exec ds/cilium -- cilium-dbg status | grep -iE &amp;#34;^cilium:|^routing|^device mode&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Cilium: Ok 1.18.2 (v1.18.2-5bd307a8)
Routing: Network: Tunnel [vxlan] Host: BPF
Device Mode: veth&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;本篇文章測試環境 routing-mode 為 &lt;code&gt;tunnel&lt;/code&gt;，tunnel-protocol 使用 &lt;code&gt;vxlan&lt;/code&gt;，沒有特別 tunning。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 NGINX pods&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create deploy nginx --image=docker.io/library/nginx:latest --replicas=2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Client pods，replicas 設成 &lt;code&gt;2&lt;/code&gt;，並指定跑在 worker node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: client
name: client
spec:
replicas: 2
selector:
matchLabels:
app: client
template:
metadata:
labels:
app: client
spec:
nodeSelector:
node-role.kubernetes.io/worker: &amp;#34;&amp;#34;
containers:
- image: quay.io/cooloo9871/debug.alp
name: debug-alp
securityContext:
privileged: true&amp;#39; | kubectl apply -f -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 pods 各至在哪一個節點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get pods -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果類似以下螢幕輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS NODE
client-65766844b7-72zg2 Running kubeadm-w1.bbg.com
client-65766844b7-c4w29 Running kubeadm-w2.bbg.com
nginx-66686b6766-6vd9x Running kubeadm-w2.bbg.com
nginx-66686b6766-s25sh Running kubeadm-w3.bbg.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 檢視單一 Pod 的網路架構&lt;span class="hx:absolute hx:-mt-20" id="3-檢視單一-pod-的網路架構"&gt;&lt;/span&gt;
&lt;a href="#3-%e6%aa%a2%e8%a6%96%e5%96%ae%e4%b8%80-pod-%e7%9a%84%e7%b6%b2%e8%b7%af%e6%9e%b6%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;查看 client pod 的 ip address 和 subnet mask&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec -it client-65766844b7-c4w29 -- ip a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...以上省略
34: eth0@if35: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN&amp;gt; mtu 1500 qdisc noqueue state UP
link/ether d6:c4:d2:00:8c:2e brd ff:ff:ff:ff:ff:ff
inet 10.244.7.250/32 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::d4c4:d2ff:fe00:8c2e/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;得知 subnet mask 為 &lt;code&gt;/32&lt;/code&gt;，所以 pod 要上網一定會走 Default Gateway&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查看 client Pod 的 Default Gateway&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec -it client-65766844b7-c4w29 -- ip r&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;default via 10.244.7.247 dev eth0
10.244.7.247 dev eth0 scope link&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;確認 Default Gateway 的值為 &lt;code&gt;10.244.7.247&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查看 client Pod 裡的 Neighbour Table&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec -it client-65766844b7-c4w29 -- ip n&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;10.244.7.247 dev eth0 lladdr 1e:49:e0:67:ec:e7 used 0/0/0 probes 4 STALE&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;得知 Default Gateway &lt;code&gt;10.244.7.247&lt;/code&gt; 對應的 Mac Address 為 &lt;code&gt;1e:49:e0:67:ec:e7&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;到 pod 所在的節點查找 pod 內看到 Default Gateway 對應在主機是哪張網卡&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ip a s | grep -A 3 -B 2 10.244.7.247&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;4: cilium_host@cilium_net: &amp;lt;BROADCAST,MULTICAST,NOARP,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether ba:af:34:f7:09:12 brd ff:ff:ff:ff:ff:ff
inet 10.244.7.247/32 scope global cilium_host
valid_lft forever preferred_lft forever
inet6 fe80::b8af:34ff:fef7:912/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;發現 &lt;code&gt;10.244.7.247&lt;/code&gt; 這張網卡對應的 Mac Address 竟然是 &lt;code&gt;ba:af:34:f7:09:12&lt;/code&gt; 而不是在 client pod 裡面看到的 &lt;code&gt;1e:49:e0:67:ec:e7&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;繼續在 pod 所在的節點查找 &lt;code&gt;1e:49:e0:67:ec:e7&lt;/code&gt; 是哪張網卡&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ip a s | grep -A 3 -B 1 &amp;#39;1e:49:e0:67:ec:e7&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;35: lxc7904b406cec6@if34: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1e:49:e0:67:ec:e7 brd ff:ff:ff:ff:ff:ff link-netns cni-a59f663a-3aed-32da-7743-287142c3ccda
inet6 fe80::1c49:e0ff:fe67:ece7/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;由網卡名稱可以得知是 veth pair，並且另一端連接在 &lt;code&gt;cni-a59f663a-3aed-32da-7743-287142c3ccda&lt;/code&gt; Linux Network Namespace&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;進入這個 Linux Network Namespace 查看網卡資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo ip netns exec cni-a59f663a-3aed-32da-7743-287142c3ccda ip a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;1: lo: &amp;lt;LOOPBACK,UP,LOWER_UP&amp;gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
34: eth0@if35: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default
link/ether d6:c4:d2:00:8c:2e brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.244.7.250/32 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::d4c4:d2ff:fe00:8c2e/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;確認 client pod &lt;code&gt;eth0&lt;/code&gt; 在主機側的網卡名稱是 &lt;code&gt;lxc7904b406cec6&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認初始狀態下 pod 內部 arp cache&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec -it client-65766844b7-c4w29 -- arp -a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;得知 pod 在初始狀態下 arp cache 應為空&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;小結論&lt;span class="hx:absolute hx:-mt-20" id="小結論"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%8f%e7%b5%90%e8%ab%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Client Pod &lt;code&gt;eth0&lt;/code&gt; 網卡對應在 host 主機這側的網卡是 &lt;code&gt;lxc7904b406cec6&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;在 Client Pod 內部 Neighbour Table 紀錄 Default Gateway 的 IP 是在 host 主機 &lt;code&gt;cilium_host&lt;/code&gt; 網卡的 ip，但是 Mac Address 卻是 pod 在 host 主機側網卡的 mac address&lt;/li&gt;
&lt;li&gt;pod 在初始狀態下無任何 arp cache&lt;/li&gt;
&lt;li&gt;網路架構如下圖
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByPWFdOybl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;4. 檢視同一台節點內 Pods 之間網路封包如何傳遞&lt;span class="hx:absolute hx:-mt-20" id="4-檢視同一台節點內-pods-之間網路封包如何傳遞"&gt;&lt;/span&gt;
&lt;a href="#4-%e6%aa%a2%e8%a6%96%e5%90%8c%e4%b8%80%e5%8f%b0%e7%af%80%e9%bb%9e%e5%85%a7-pods-%e4%b9%8b%e9%96%93%e7%b6%b2%e8%b7%af%e5%b0%81%e5%8c%85%e5%a6%82%e4%bd%95%e5%82%b3%e9%81%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;查詢 nginx pod 網卡資訊，在 pod 所在的節點執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;pod_name=&amp;#34;nginx-66686b6766-6vd9x&amp;#34;
sudo ip netns exec $(sudo ip netns identify $(sudo crictl inspect $(sudo crictl ps -a | grep ${pod_name} | cut -d &amp;#34; &amp;#34; -f 1) | jq -r &amp;#39;.info.pid // .status.pid&amp;#39;)) ip a s eth0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;32: eth0@if33: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default
link/ether 9a:08:1c:60:8e:77 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.244.7.203/32 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::9808:1cff:fe60:8e77/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;得知 nginx pod 網卡資訊：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;名稱為 &lt;code&gt;eth0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;ip address 為 &lt;code&gt;10.244.7.203/32&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;mac address 為 &lt;code&gt;9a:08:1c:60:8e:77&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;找到 nginx pod 在主機側的網卡，在 pod 所在的節點執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;pod_name=&amp;#34;nginx-66686b6766-6vd9x&amp;#34;
ip a s | grep -A 3 ^$(sudo ip netns exec $(sudo ip netns identify $(sudo crictl inspect $(sudo crictl ps -a | grep ${pod_name} | cut -d &amp;#34; &amp;#34; -f 1) | jq -r &amp;#39;.info.pid // .status.pid&amp;#39;)) ip a s eth0 | head -n 1 | cut -d &amp;#34;:&amp;#34; -f 2 | tail -c 3)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;33: lxcdad8b6341b55@if32: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 2a:e0:31:24:98:d1 brd ff:ff:ff:ff:ff:ff link-netns cni-90146bc6-03b3-1ff1-72c8-61b61819bb95
inet6 fe80::28e0:31ff:fe24:98d1/64 scope link
valid_lft forever preferred_lft forever&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;得知 nginx pod 在主機側網卡資訊：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;名稱為 &lt;code&gt;lxcdad8b6341b55&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;mac address 為 &lt;code&gt;2a:e0:31:24:98:d1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;額外開啟 4 個終端機，分別都 ssh 到 client 和 nginx pod 所在的同一台節點上，並依序執行以下 4 個收集封包的動作&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;在 client pod 主機側的網卡上，透過 &lt;code&gt;tcpdump&lt;/code&gt; 命令收集 ARP 或 ICMP 封包
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tcpdump -n -i lxc7904b406cec6 arp or icmp -vvv -w client-pod-host.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;在 nginx pod 主機側的網卡上，透過 &lt;code&gt;tcpdump&lt;/code&gt; 命令收集 ARP 或 ICMP 封包
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tcpdump -n -i lxcdad8b6341b55 arp or icmp -vvv -w nginx-pod-host.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;在 client pod Container 側的網卡上，透過 &lt;code&gt;tcpdump&lt;/code&gt; 命令收集 ARP 或 ICMP 封包
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo ip netns exec cni-a59f663a-3aed-32da-7743-287142c3ccda tcpdump -n -i eth0 arp or icmp -vvv -w client-pod.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;在 nginx pod Container 側的網卡上，透過 &lt;code&gt;tcpdump&lt;/code&gt; 命令收集 ARP 或 ICMP 封包
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo ip netns exec cni-90146bc6-03b3-1ff1-72c8-61b61819bb95 tcpdump -n -i eth0 arp or icmp -vvv -w nginx-pod.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;切換到可執行 &lt;code&gt;kubectl&lt;/code&gt; 主機的終端機，進到 &lt;code&gt;client&lt;/code&gt; pod 去 ping &lt;code&gt;nginx&lt;/code&gt; pod&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec -it client-65766844b7-c4w29 -- ping -c 1 10.244.7.203&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;PING 10.244.7.203 (10.244.7.203): 56 data bytes
64 bytes from 10.244.7.203: seq=0 ttl=63 time=0.198 ms
--- 10.244.7.203 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.198/0.198/0.198 ms&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;小總結&lt;span class="hx:absolute hx:-mt-20" id="小總結"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%8f%e7%b8%bd%e7%b5%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkwtoKt1Zg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;client Pod 去 &lt;code&gt;ping&lt;/code&gt; 同一節點的 nginx pod，因 subnet mask 為 &lt;code&gt;/32&lt;/code&gt;，網路封包一定往 Default Gateway &lt;code&gt;10.244.7.247&lt;/code&gt; 送，由於初始化 pod 內部 arp cache 為空，故觸發 arp 通訊協定來去得到 Default Gateway 的 mac address。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJNv6q_y-e.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HknfCcOyWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;由 arp 通訊協定得知 Default Gateway 的 mac address 為 &lt;code&gt;1e:49:e0:67:ec:e7&lt;/code&gt;，這 mac address 對應的網卡是 client pod 在主機側的網卡 &lt;code&gt;lxc7904b406cec6&lt;/code&gt;。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1lD05dkbe.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hyf9AcuJWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;更詳細的運作流程：
&lt;ol&gt;
&lt;li&gt;client Pod 以廣播的方式發送 arp request 封包&lt;/li&gt;
&lt;li&gt;arp request 被在主機側的網卡收到，此時 cilium bpf &lt;code&gt;cil_from_container&lt;/code&gt; 程式會立刻接手&lt;/li&gt;
&lt;li&gt;經過一連串判斷，會用自己的 MAC address 假裝自己是 gateway 來回復這個 arp request，詳情請看 &lt;a
href="https://ithelp.ithome.com.tw/m/articles/10387997#:~:text=bpf_lxc.c%20%E3%80%82-,cil_from_container,-cil_from_container%20%E5%9C%A8%E5%81%9A%E4%BB%80%E9%BA%BC"target="_blank" rel="noopener"&gt;shiun 大佬的源碼分析&lt;/a&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;cil_from_container&lt;/code&gt; 在做什麼？
簡單一句話來解釋就是：「&lt;code&gt;cil_from_container&lt;/code&gt; 是 application container 網路的出口警衛，專門檢查所有從 app container 送出的網路封包，並決定它們的下一步該怎麼走。」&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;client pod 收到被偽造 Mac address 的 arp reply&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;此時 icmp echo request 封包從 pod 內發送到在主機側的 &lt;code&gt;lxc7904b406cec6&lt;/code&gt; 網卡
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkW3HnOy-e.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By31DadJbg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;立刻又被 Cilium 掛在該網卡上的 BPF 程式 &lt;code&gt;cil_from_container&lt;/code&gt; 接住，並作出以下判斷
&lt;ul&gt;
&lt;li&gt;如果目標 pod 是同一個 Node → 找到目標 pod 在主機側的網卡 → 然後將封包送進 Container 側的網卡
&lt;ul&gt;
&lt;li&gt;更詳細運作流程：
&lt;ol&gt;
&lt;li&gt;拿到封包後，把目的 MAC Address 和來源的 MAC Address 的換掉，確保能送到正確的 Pod&lt;/li&gt;
&lt;li&gt;直接送達：它不把包裹交給大樓的收發室 (Linux Network Stack)，而是直接搭電梯（tail_call_policy）衝到收件 Pod 的門口（在主機側的網卡），把包裹交給門口的警衛 (Ingress BPF 程式) 做安全檢查 (Policy Enforcement)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;以下是從 client pod 在主機側網卡收到的 icmp echo request 封包資訊 (為更換 mac address 前)
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Sy-8maOkWg.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B107vaOkWl.png" alt="image" loading="lazy" /&gt;
遺憾的是沒收到更換完 mac address 的 icmp echo request 封包&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;如果目標 pod 是跨 Node → 會轉交 &lt;code&gt;cilium_vxlan&lt;/code&gt; / &lt;code&gt;ens33&lt;/code&gt; 網卡&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;很明顯此次的目標 pod 跟來源 pod 是在同一個 node，經過 cilium bpf 程式一番查找得知要傳給目標 pod 在主機側的網卡，所以 icmp echo request 封包會發送到 nginx pod 在主機側的網卡 &lt;code&gt;lxcdad8b6341b55&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Nginx pod 在主機側的網卡收到 icmp echo request 封包後，cilium bpf 程式 &lt;code&gt;cil_from_container&lt;/code&gt; 立馬接手，執行 nginx Pod 的 Ingress Policy 檢查。&lt;/li&gt;
&lt;li&gt;檢查沒問題後，BPF 對 kernel 說：「我檢查完了，這封包沒問題，你接手處理吧！」。&lt;/li&gt;
&lt;li&gt;此時封包會送進 nginx pod 的 Linux Network Namspace，由於之前已經修改了目的地和來源的 mac address，封包會被正確路由到 nginx Pod 在 Container 側的網卡。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1soBTdybl.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rky-U6u1-x.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;nginx pod 收到 icmp echo request 封包後，會需要回傳 icmp echo reply 的網路封包，同樣會因為 subnet mask 為 &lt;code&gt;/32&lt;/code&gt;，網路封包一定往 Default Gateway &lt;code&gt;10.244.7.247&lt;/code&gt; 送，&lt;strong&gt;由於初始化 pod 內部 arp cache 為空，故又觸發 arp 通訊協定來去得到 Default Gateway 的 mac address(實際上會得到的是 nginx pod 在主機側網卡的 mac address)&lt;/strong&gt; (arp 詳細運作流程不再重複描述)
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkSie0OkWx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;透過 arp 通訊協定得知 nginx 在主機側網卡 mac 位址後，icmp echo reply 封包會發送至 nginx pod 在主機側的網卡
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkZV7Ruk-g.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1WIQCuybg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;icmp echo reply 封包傳送到在 nginx pod 主機側的網卡後，又又又被 cilium bpf 程式 &lt;code&gt;cil_from_container&lt;/code&gt; 接手，並作出以下判斷 :
&lt;ol&gt;
&lt;li&gt;目標 pod 是同一個 Node&lt;/li&gt;
&lt;li&gt;把目的 MAC Address 和來源的 MAC Address 的換掉，確保能送回 client pod&lt;/li&gt;
&lt;li&gt;直接將網路封包送達 client pod 在主機側的網卡&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;client pod 在主機側的網卡收到 icmp echo reply 封包後，cilium bpf 程式 &lt;code&gt;cil_from_container&lt;/code&gt; 接手，執行 client Pod 的 Ingress Policy 檢查，確認沒問題後最後傳回給 client pod 在 container 側的網卡。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1he8Ru1Zx.png" alt="image" loading="lazy" /&gt;
封包詳細資訊：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SynGUAd1be.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;補充說明&lt;span class="hx:absolute hx:-mt-20" id="補充說明"&gt;&lt;/span&gt;
&lt;a href="#%e8%a3%9c%e5%85%85%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;安裝 cilium 後，會在主機的 os 裡面，看到 &lt;code&gt;cilium_host&lt;/code&gt;, &lt;code&gt;cilium_net&lt;/code&gt;, 和 &lt;code&gt;cilium_vxlan&lt;/code&gt; 這 3 個網路介面，目前根據上面的驗證結果可得知在同節點內 pod 跟 pod 之間互相溝通，並不會經過這 3 張網卡。&lt;/p&gt;
&lt;p&gt;如果想驗證，可在 pods 之間互 ping 之前，執行以下收集封包的命令&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;收集 &lt;code&gt;cilium_host&lt;/code&gt; 網路介面的封包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tcpdump -n -i cilium_host arp or icmp -vvv -w cilium_host.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;收集 &lt;code&gt;cilium_net&lt;/code&gt; 網路介面的封包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tcpdump -n -i cilium_net arp or icmp -vvv -w cilium_net.pcap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;收集 &lt;code&gt;cilium_vxlan&lt;/code&gt; 網路介面的封包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tcpdump -n -i cilium_net arp or icmp -vvv -w cilium_vxlan&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;收集結果會看到 icmp 封包，但 icmp 封包內要傳遞的 data 一定會跟 pod 之間互 ping 的 data 不一樣&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkmTKKtJ-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;所以可以確定在同節點內 pod 跟 pod 之間互相溝通，並不會經過 &lt;code&gt;cilium_host&lt;/code&gt;, &lt;code&gt;cilium_net&lt;/code&gt;, 和 &lt;code&gt;cilium_vxlan&lt;/code&gt; 這 3 張網卡。&lt;/p&gt;
&lt;h2&gt;5. 參考文章&lt;span class="hx:absolute hx:-mt-20" id="5-參考文章"&gt;&lt;/span&gt;
&lt;a href="#5-%e5%8f%83%e8%80%83%e6%96%87%e7%ab%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://ithelp.ithome.com.tw/m/articles/10387997"target="_blank" rel="noopener"&gt;[Day 12] 探索 Cilium Pod to Pod Datapath (1) 背後竟然有 ARP 偽造？&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://ithelp.ithome.com.tw/m/articles/10388758"target="_blank" rel="noopener"&gt;[Day 13] 探索 Cilium Pod to Pod Datapath (2) eBPF 走捷徑直接送封包到目的 Pod 面前&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>CNI 運作原理：理解 Container Network Interface 如何讓跨主機的 Pod 通訊</title><link>https://blog.kubeantony.com/archive/kubernetes/cni-%E9%81%8B%E4%BD%9C%E5%8E%9F%E7%90%86-%E7%90%86%E8%A7%A3-container-network-interface-%E5%A6%82%E4%BD%95%E8%AE%93%E8%B7%A8%E4%B8%BB%E6%A9%9F%E7%9A%84-pod-%E9%80%9A%E8%A8%8A/</link><pubDate>Fri, 08 May 2026 05:29:18 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/cni-%E9%81%8B%E4%BD%9C%E5%8E%9F%E7%90%86-%E7%90%86%E8%A7%A3-container-network-interface-%E5%A6%82%E4%BD%95%E8%AE%93%E8%B7%A8%E4%B8%BB%E6%A9%9F%E7%9A%84-pod-%E9%80%9A%E8%A8%8A/</guid><description>
&lt;h2&gt;TL;DR&lt;span class="hx:absolute hx:-mt-20" id="tldr"&gt;&lt;/span&gt;
&lt;a href="#tldr" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;當 worker-1 上的 Pod A &lt;code&gt;ping&lt;/code&gt; worker-2 上的 Pod B：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Pod 內 &lt;code&gt;eth0&lt;/code&gt;（&lt;code&gt;/32&lt;/code&gt; IP、&lt;code&gt;169.254.1.1&lt;/code&gt; link-local default gateway）→ 透過 &lt;strong&gt;Calico CNI&lt;/strong&gt; 建的 veth pair 出到 host netns&lt;/li&gt;
&lt;li&gt;Host netns 的 routing 表把對端 podCIDR 指向 &lt;code&gt;flannel.1&lt;/code&gt;（VXLAN device，VNI 1）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Linux kernel&lt;/strong&gt; 用 &lt;code&gt;ip neigh&lt;/code&gt; + &lt;code&gt;bridge fdb&lt;/code&gt; 查到對端 underlay IP，做 VXLAN encap（UDP port 8472）&lt;/li&gt;
&lt;li&gt;封包經 node container 的 &lt;code&gt;eth0&lt;/code&gt; → host bridge &lt;code&gt;podman1&lt;/code&gt; → 對端 node 的 &lt;code&gt;eth0&lt;/code&gt; → 對端 &lt;code&gt;flannel.1&lt;/code&gt; 做 VXLAN decap → veth → Pod B &lt;code&gt;eth0&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Calico&lt;/strong&gt; 負責建 veth、設 &lt;code&gt;proxy_arp&lt;/code&gt;；&lt;strong&gt;Flannel&lt;/strong&gt; 負責跨 node 的 host route 與 VXLAN fdb；&lt;strong&gt;kernel&lt;/strong&gt; 負責真正的 encap/decap。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;不熟悉 veth pair / encap / overlay / fdb / VXLAN 等術語的讀者，建議先翻 &lt;a
href="#appendix-b-%e8%a1%93%e8%aa%9e%e8%a1%a8"&gt;Appendix B 術語表&lt;/a&gt; 一次再讀正文。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;目錄&lt;span class="hx:absolute hx:-mt-20" id="目錄"&gt;&lt;/span&gt;
&lt;a href="#%e7%9b%ae%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="#tldr"&gt;TL;DR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#0-%e5%89%8d%e6%8f%90%e6%a2%9d%e4%bb%b6"&gt;0. 前提條件&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#1-kubernetes-networking-model-%e4%b8%89%e6%a2%9d%e5%85%ac%e7%b4%84"&gt;1. Kubernetes networking model 三條公約&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#2-canal-%e6%9e%b6%e6%a7%8b%e5%bf%ab%e9%80%9f%e7%90%86%e8%a7%a3"&gt;2. Canal 架構快速理解&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#3-%e7%92%b0%e5%a2%83%e6%8e%a2%e5%8b%98podman-%e7%89%b9%e6%9c%89%e6%ad%a5%e9%a9%9f"&gt;3. 環境探勘（Podman 特有步驟）&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#4-%e9%83%a8%e7%bd%b2-demo-workload"&gt;4. 部署 demo workload&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#5-%e7%ac%ac%e4%b8%80%e5%b1%a4%e8%a7%80%e5%af%9fpod-%e5%85%a7%e7%9c%8b%e5%88%b0%e4%bb%80%e9%ba%bc"&gt;5. 第一層觀察：Pod 內看到什麼&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#6-%e7%ac%ac%e4%ba%8c%e5%b1%a4%e8%a7%80%e5%af%9fnode-container-%e5%85%a7%e7%9c%8b%e5%88%b0%e4%bb%80%e9%ba%bc"&gt;6. 第二層觀察：node container 內看到什麼&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="#61-interface-%e5%85%a8%e8%b2%8c"&gt;6.1 Interface 全貌&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#62-routing-%e8%a1%a8"&gt;6.2 Routing 表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#63-vxlan-forwarding-database-%e8%88%87-neighbor"&gt;6.3 VXLAN forwarding database 與 neighbor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#64-calico-felix-%e7%9a%84%e7%97%95%e8%b7%a1"&gt;6.4 Calico Felix 的痕跡&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a
href="#7-%e7%ac%ac%e4%b8%89%e5%b1%a4%e8%a7%80%e5%af%9f%e6%8a%93%e7%9c%9f%e6%ad%a3%e7%9a%84-vxlan-%e5%b0%81%e5%8c%85"&gt;7. 第三層觀察：抓真正的 VXLAN 封包&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#8-packet-flow-%e5%9c%96"&gt;8. Packet flow 圖&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#9-%e5%b8%b8%e8%a6%8b%e9%a9%97%e8%ad%89-checklist"&gt;9. 常見驗證 checklist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#10-%e6%94%b6%e5%b0%be"&gt;10. 收尾&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#appendix-a-%e6%8c%87%e4%bb%a4%e9%80%9f%e6%9f%a5%e8%a1%a8"&gt;Appendix A. 指令速查表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#appendix-b-%e8%a1%93%e8%aa%9e%e8%a1%a8"&gt;Appendix B. 術語表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#references"&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;目標&lt;span class="hx:absolute hx:-mt-20" id="目標"&gt;&lt;/span&gt;
&lt;a href="#%e7%9b%ae%e6%a8%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在一個 1 master + 2 workers 的 Kubernetes cluster（用 Podman 建立、運作方式類似 kind），CNI 採用 Canal 的情境下，回答一個具體問題：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;當 worker-1 上的 Pod A &lt;code&gt;ping&lt;/code&gt; worker-2 上的 Pod B，封包到底走了哪些 interface、被誰 encap、又被誰 decap？&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;讀完本文後，應能在自己的 cluster 上用 &lt;code&gt;kubectl&lt;/code&gt;、&lt;code&gt;podman exec&lt;/code&gt;、&lt;code&gt;ip&lt;/code&gt;、&lt;code&gt;tcpdump&lt;/code&gt; 等工具，把整條 datapath 親眼看一遍。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;適合對象&lt;/strong&gt;：已熟悉 Pod / Deployment / Service 的使用者，但對 overlay network、VXLAN、CNI plugin chain 仍是黑盒子。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;驗證環境&lt;/strong&gt;：cluster &lt;code&gt;tk8s&lt;/code&gt;（v1.35.0、container runtime containerd 2.2.0、node image &lt;code&gt;quay.io/cloudwalker/taroko:v1.35.0&lt;/code&gt;、3 node：&lt;code&gt;tk8s-control-plane&lt;/code&gt; / &lt;code&gt;tk8s-worker1&lt;/code&gt; / &lt;code&gt;tk8s-worker2&lt;/code&gt;）。其他環境若 IP/CIDR 不同，照樣換值即可。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;0. 前提條件&lt;span class="hx:absolute hx:-mt-20" id="0-前提條件"&gt;&lt;/span&gt;
&lt;a href="#0-%e5%89%8d%e6%8f%90%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：確認 cluster 是 1m2w、INTERNAL-IP 落在 Podman bridge 上、Canal 已安裝（每 node 一個 canal pod，內含 &lt;code&gt;calico-node&lt;/code&gt; + &lt;code&gt;kube-flannel&lt;/code&gt; 兩個 container）。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; 看 cluster 拓樸：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get node -o wide&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION INTERNAL-IP ...
tk8s-control-plane Ready control-plane 2d v1.35.0 172.22.0.1 ...
tk8s-worker1 Ready taroko-worker 2d v1.35.0 172.22.0.2 ... ← 等等 demo Pod A 落腳點
tk8s-worker2 Ready taroko-gateway 2d v1.35.0 172.22.0.3 ... ← Pod B 落腳點&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt; 看 Canal 是否安裝、每個 canal pod 由哪些 container 組成：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n kube-system -l k8s-app&lt;span class="o"&gt;=&lt;/span&gt;canal -o wide
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n kube-system -l k8s-app&lt;span class="o"&gt;=&lt;/span&gt;canal &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].spec.containers[*].name}&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; echo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE
canal-4wvhj 2/2 Running 0 2d 172.22.0.1 tk8s-control-plane
canal-qsnqh 2/2 Running 0 2d 172.22.0.3 tk8s-worker2
canal-vjcm9 2/2 Running 0 2d 172.22.0.2 tk8s-worker1
calico-node kube-flannel ← 兩個 container：calico-node 跑 Felix、kube-flannel 跑 flanneld&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;找不到 canal pod 時，改用 &lt;code&gt;kubectl get pods -n kube-system | grep -E 'canal|calico|flannel'&lt;/code&gt; 比對；不同 manifest 的 label 命名可能不同。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;1. Kubernetes networking model 三條公約&lt;span class="hx:absolute hx:-mt-20" id="1-kubernetes-networking-model-三條公約"&gt;&lt;/span&gt;
&lt;a href="#1-kubernetes-networking-model-%e4%b8%89%e6%a2%9d%e5%85%ac%e7%b4%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：K8s 不規定怎麼做，只規定三件事必須成立；CNI plugin 的工作就是把它變成現實。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;依 &lt;a
href="https://kubernetes.io/docs/concepts/cluster-administration/networking/"target="_blank" rel="noopener"&gt;kubernetes.io&lt;/a&gt; 的規範：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;公約&lt;/th&gt;
&lt;th&gt;通俗說法&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;每個 Pod 拿到一個 cluster 內 routable 的 IP&lt;/td&gt;
&lt;td&gt;不用 port forwarding、不會 port 衝突&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Pod-to-Pod 通訊不經 NAT&lt;/td&gt;
&lt;td&gt;Pod A 看到自己的 IP，跟 Pod B 看到 Pod A 的 IP，必須一致&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Node agent（kubelet 等）能直連該 node 上的 Pod&lt;/td&gt;
&lt;td&gt;host 和 Pod 之間沒有牆&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;CNI plugin 的職責&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IPAM：給每個 Pod 配 IP&lt;/li&gt;
&lt;li&gt;Plumbing：在 host 與 Pod 之間建立 veth&lt;/li&gt;
&lt;li&gt;Forwarding：設好 routing / encap，讓跨 node 的 Pod 互通&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;2. Canal 架構快速理解&lt;span class="hx:absolute hx:-mt-20" id="2-canal-架構快速理解"&gt;&lt;/span&gt;
&lt;a href="#2-canal-%e6%9e%b6%e6%a7%8b%e5%bf%ab%e9%80%9f%e7%90%86%e8%a7%a3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：&lt;strong&gt;Canal = Flannel（負責 networking）+ Calico（負責 NetworkPolicy）&lt;/strong&gt;。Calico 在這個組合下跑 policy-only mode、不跑 BGP。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;角色&lt;/th&gt;
&lt;th&gt;實作者&lt;/th&gt;
&lt;th&gt;跑在哪裡&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CNI plugin（建立 veth、配 IP）&lt;/td&gt;
&lt;td&gt;Calico CNI&lt;/td&gt;
&lt;td&gt;node 上的 &lt;code&gt;/opt/cni/bin/calico&lt;/code&gt; binary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overlay backend（跨 node 封裝）&lt;/td&gt;
&lt;td&gt;Flannel VXLAN&lt;/td&gt;
&lt;td&gt;canal pod 的 &lt;code&gt;kube-flannel&lt;/code&gt; container&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NetworkPolicy 執行&lt;/td&gt;
&lt;td&gt;Calico Felix&lt;/td&gt;
&lt;td&gt;canal pod 的 &lt;code&gt;calico-node&lt;/code&gt; container&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Routing protocol（BGP）&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;不啟用&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;CALICO_NETWORKING_BACKEND=none&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;本文只示範 datapath 連通；&lt;strong&gt;NetworkPolicy 不在範圍內&lt;/strong&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;3. 環境探勘（Podman 特有步驟）&lt;span class="hx:absolute hx:-mt-20" id="3-環境探勘podman-特有步驟"&gt;&lt;/span&gt;
&lt;a href="#3-%e7%92%b0%e5%a2%83%e6%8e%a2%e5%8b%98podman-%e7%89%b9%e6%9c%89%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：node 是 host 上的 Podman container；&lt;code&gt;node 的 eth0&lt;/code&gt; = &lt;code&gt;host 的 podman1 bridge 上的 veth&lt;/code&gt;。之後抓 underlay 封包就要看這座 bridge。&lt;/p&gt;
&lt;p&gt;本 cluster 的 Podman 跑在 &lt;strong&gt;rootful&lt;/strong&gt; 模式，所以指令要加 &lt;code&gt;sudo&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; 列出 node container：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps --format &lt;span class="s1"&gt;&amp;#39;{{.Names}}\t{{.Image}}\t{{.Status}}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tk8s-control-plane quay.io/cloudwalker/taroko:v1.35.0 Up 2 days
tk8s-worker1 quay.io/cloudwalker/taroko:v1.35.0 Up 2 days
tk8s-worker2 quay.io/cloudwalker/taroko:v1.35.0 Up 2 days&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt; 找 nodes 共用的 Podman network：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman network ls
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman network inspect tk8s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NETWORK ID NAME DRIVER
2f259bab93aa podman bridge ← 預設、未使用
2543f305ded9 tk8s bridge ← cluster 真正用的&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;tk8s&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;driver&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;bridge&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;network_interface&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;podman1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;←&lt;/span&gt; &lt;span class="err"&gt;對應&lt;/span&gt; &lt;span class="err"&gt;host&lt;/span&gt; &lt;span class="err"&gt;上的&lt;/span&gt; &lt;span class="err"&gt;bridge&lt;/span&gt; &lt;span class="err"&gt;名稱&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;subnets&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;subnet&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;172.22.0.0/24&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;gateway&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;172.22.0.254&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// ... 其他欄位省略
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;結論&lt;/strong&gt;（記住這三件事，後面都會用到）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Podman network &lt;code&gt;tk8s&lt;/code&gt; ↔ host bridge &lt;code&gt;podman1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;三個 node 都掛在 &lt;code&gt;podman1&lt;/code&gt; 上、IP 落在 &lt;code&gt;172.22.0.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;node 內 &lt;code&gt;eth0&lt;/code&gt; = 接到 &lt;code&gt;podman1&lt;/code&gt; 的 veth；node 的 INTERNAL-IP 就是它在 bridge 上的 IP&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;4. 部署 demo workload&lt;span class="hx:absolute hx:-mt-20" id="4-部署-demo-workload"&gt;&lt;/span&gt;
&lt;a href="#4-%e9%83%a8%e7%bd%b2-demo-workload" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：用 &lt;code&gt;podAntiAffinity&lt;/code&gt; 強制兩個 &lt;code&gt;nicolaka/netshoot&lt;/code&gt; Pod 各落到一台 worker；確認每 node 的 podCIDR 是 &lt;code&gt;/25&lt;/code&gt; 切片；設好 &lt;code&gt;$POD_A&lt;/code&gt; / &lt;code&gt;$POD_B&lt;/code&gt; 等變數方便後續所有指令引用。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;(1)&lt;/strong&gt; 部署並等 Ready：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl apply -f docs/manifests/cni-demo.yaml
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;wait&lt;/span&gt; --for&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;condition&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Ready pod -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;cni-demo --timeout&lt;span class="o"&gt;=&lt;/span&gt;60s
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pod -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;cni-demo -o wide&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;deployment.apps/cni-demo created
pod/cni-demo-548d4c6cbc-bgjqk condition met
pod/cni-demo-548d4c6cbc-lmk44 condition met
NAME READY STATUS IP NODE
cni-demo-548d4c6cbc-bgjqk 1/1 Running 10.244.0.153 tk8s-worker1 ← Pod A
cni-demo-548d4c6cbc-lmk44 1/1 Running 10.244.1.22 tk8s-worker2 ← Pod B&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Pod 名稱與 IP 每次部署都會變動；只要結構一致（兩個 replica、各落在不同 worker、IP 在各自 podCIDR 內）即正確。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;(2)&lt;/strong&gt; 看 podCIDR 切片（cluster pod CIDR &lt;code&gt;10.244.0.0/16&lt;/code&gt; 被切成 &lt;code&gt;/25&lt;/code&gt; 分給每個 node）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get node -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{range .items[*]}{.metadata.name}{&amp;#34;\t&amp;#34;}{.spec.podCIDR}{&amp;#34;\n&amp;#34;}{end}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tk8s-control-plane 10.244.0.0/25
tk8s-worker1 10.244.0.128/25 ← Pod A 來自這個區段
tk8s-worker2 10.244.1.0/25 ← Pod B 來自這個區段&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;(3)&lt;/strong&gt; 設定 shell 變數（&lt;strong&gt;後面所有節都會用到&lt;/strong&gt;）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;POD_A&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pod -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;cni-demo --field-selector spec.nodeName&lt;span class="o"&gt;=&lt;/span&gt;tk8s-worker1 -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;POD_B&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pod -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;cni-demo --field-selector spec.nodeName&lt;span class="o"&gt;=&lt;/span&gt;tk8s-worker2 -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;POD_A_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pod &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.status.podIP}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;POD_B_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pod &lt;span class="nv"&gt;$POD_B&lt;/span&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.status.podIP}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;POD_A=&lt;/span&gt;&lt;span class="nv"&gt;$POD_A&lt;/span&gt;&lt;span class="s2"&gt; (&lt;/span&gt;&lt;span class="nv"&gt;$POD_A_IP&lt;/span&gt;&lt;span class="s2"&gt; @ tk8s-worker1)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;POD_B=&lt;/span&gt;&lt;span class="nv"&gt;$POD_B&lt;/span&gt;&lt;span class="s2"&gt; (&lt;/span&gt;&lt;span class="nv"&gt;$POD_B_IP&lt;/span&gt;&lt;span class="s2"&gt; @ tk8s-worker2)&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;POD_A=cni-demo-548d4c6cbc-bgjqk (10.244.0.153 @ tk8s-worker1)
POD_B=cni-demo-548d4c6cbc-lmk44 (10.244.1.22 @ tk8s-worker2)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;5. 第一層觀察：Pod 內看到什麼&lt;span class="hx:absolute hx:-mt-20" id="5-第一層觀察pod-內看到什麼"&gt;&lt;/span&gt;
&lt;a href="#5-%e7%ac%ac%e4%b8%80%e5%b1%a4%e8%a7%80%e5%af%9fpod-%e5%85%a7%e7%9c%8b%e5%88%b0%e4%bb%80%e9%ba%bc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：Pod 內只有 &lt;code&gt;eth0&lt;/code&gt;、IP 是 &lt;code&gt;/32&lt;/code&gt;、default gateway 是 dummy 的 &lt;code&gt;169.254.1.1&lt;/code&gt;。Pod 不知道 overlay、不知道對端 node。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -- ip a show eth0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -- ip route
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -- ping -c &lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="nv"&gt;$POD_B_IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2: eth0@if29: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 ... ← MTU 1500（Calico 預設）
link/ether 32:90:8e:80:e6:7a ...
inet 10.244.0.153/32 scope global eth0 ← 注意是 /32
default via 169.254.1.1 dev eth0 ← link-local dummy gateway
169.254.1.1 dev eth0 scope link
PING 10.244.1.22 (10.244.1.22) 56(84) bytes of data.
64 bytes from 10.244.1.22: icmp_seq=1 ttl=62 time=0.614 ms ← ttl 從 64 掉到 62
64 bytes from 10.244.1.22: icmp_seq=2 ttl=62 time=0.370 ms
64 bytes from 10.244.1.22: icmp_seq=3 ttl=62 time=0.399 ms
--- 10.244.1.22 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2084ms&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;為什麼會這樣？&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/32&lt;/code&gt; mask：Pod 把 host 視為 point-to-point 對端，沒有 subnet 概念&lt;/li&gt;
&lt;li&gt;&lt;code&gt;169.254.1.1&lt;/code&gt; 是 Calico CNI 寫死的 dummy next hop（&lt;a
href="https://github.com/projectcalico/calico/blob/master/cni-plugin/pkg/dataplane/linux/dataplane_linux.go"target="_blank" rel="noopener"&gt;Calico CNI 原始碼&lt;/a&gt;：&lt;code&gt;gw := net.IPv4(169, 254, 1, 1)&lt;/code&gt;）；host-side veth 上設定 &lt;code&gt;proxy_arp=1&lt;/code&gt;，所以 ARP 永遠回應 host MAC，然後封包就到 host netns 了&lt;/li&gt;
&lt;li&gt;ttl 從 64 → 62 = 兩端 &lt;code&gt;flannel.1&lt;/code&gt; 各 decrement 一次（VXLAN device 跨 layer-3 forwarding）&lt;/li&gt;
&lt;li&gt;MTU 1500 vs 後面會看到的 &lt;code&gt;flannel.1&lt;/code&gt; MTU 1450 → &lt;a
href="#mtu-mismatch-%e5%b0%8f%e6%8f%90%e9%86%92"&gt;§ 8 MTU mismatch 小提醒&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;6. 第二層觀察：node container 內看到什麼&lt;span class="hx:absolute hx:-mt-20" id="6-第二層觀察node-container-內看到什麼"&gt;&lt;/span&gt;
&lt;a href="#6-%e7%ac%ac%e4%ba%8c%e5%b1%a4%e8%a7%80%e5%af%9fnode-container-%e5%85%a7%e7%9c%8b%e5%88%b0%e4%bb%80%e9%ba%bc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：node netns 上有三類 interface（&lt;code&gt;eth0&lt;/code&gt;、&lt;code&gt;flannel.1&lt;/code&gt;、&lt;code&gt;caliXXXX&lt;/code&gt; veth）；routing / fdb / neigh 三張表加起來決定封包要怎麼走。&lt;/p&gt;
&lt;p&gt;本節指令都用 &lt;code&gt;sudo podman exec tk8s-worker1 &amp;lt;cmd&amp;gt;&lt;/code&gt; 從 host 跑；想拿 shell 互動的話，改用 &lt;code&gt;sudo podman exec -it tk8s-worker1 bash&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;6.1 Interface 全貌&lt;span class="hx:absolute hx:-mt-20" id="61-interface-全貌"&gt;&lt;/span&gt;
&lt;a href="#61-interface-%e5%85%a8%e8%b2%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ip -br a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;lo UNKNOWN 127.0.0.1/8 ::1/128
eth0@if5 UP 172.22.0.2/24 ... ← 接到 host podman1 的 veth
flannel.1 UNKNOWN 10.244.0.128/32 ... ← VXLAN device，IP 為 podCIDR 首 IP
cali96e9f6c0c5f@if2 UP ... ┐
cali431d010c6bb@if2 UP ... │
cali6c6a1f0801c@if2 UP ... ├ Calico CNI 為各本機 Pod 建的 veth
cali55122502246@if2 UP ... │
caliaf66b54b075@if2 UP ... │
cali58f769715fe@if2 UP ... ┘ ← 這條對應到 demo Pod A&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 VXLAN 參數：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ip -d link show flannel.1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;5: flannel.1: ... mtu 1450 ...
link/ether e6:16:30:64:14:d3 ...
vxlan id 1 ← VNI 1
local 172.22.0.2 ← encap 後外層 src IP
dev eth0 ← 從 eth0 寄出
dstport 8472 ← Flannel VXLAN UDP port
nolearning ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;定位 Pod A 對應的 host-side veth（用 ifindex 對照）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;POD_A_IFLINK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -- cat /sys/class/net/eth0/iflink&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;POD_A_IFLINK=&lt;/span&gt;&lt;span class="nv"&gt;$POD_A_IFLINK&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 sh -c &lt;span class="s2"&gt;&amp;#34;ip link | grep -A1 \&amp;#34;^&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;POD_A_IFLINK&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;:\&amp;#34;&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;POD_A_IFLINK=29
29: cali58f769715fe@if2: ... mtu 1500 ...
link/ether ee:ee:ee:ee:ee:ee ...
link-netns cni-d3b2a847-5b76-c640-8ffa-0e3952643e1b ← 對端 netns（Pod 的 netns）&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;ifindex 與 &lt;code&gt;caliXXXX&lt;/code&gt; hash 每個 Pod 都不同；&lt;code&gt;29&lt;/code&gt; / &lt;code&gt;cali58f769715fe&lt;/code&gt; 只是這次的值。
三類 interface 角色一覽：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Interface&lt;/th&gt;
&lt;th&gt;角色&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;eth0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;underlay 進出口；連到 host bridge &lt;code&gt;podman1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;flannel.1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;VXLAN device（VNI 1、dstport 8472、IP 為 podCIDR 首 IP）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;caliXXXX&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;每個本機 Pod 一條 veth（host 端）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/blockquote&gt;
&lt;h3&gt;6.2 Routing 表&lt;span class="hx:absolute hx:-mt-20" id="62-routing-表"&gt;&lt;/span&gt;
&lt;a href="#62-routing-%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ip route&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;default via 172.22.0.254 dev eth0 proto static metric 100 ← (a) 對外 default
10.244.0.0/25 via 10.244.0.0 dev flannel.1 onlink ← (c) 跨 node：到 control-plane podCIDR
10.244.0.130 dev cali96e9f6c0c5f scope link ┐
10.244.0.131 dev cali431d010c6bb scope link │
10.244.0.132 dev cali6c6a1f0801c scope link │
10.244.0.136 dev cali55122502246 scope link ├ (b) 本機 Pod：每個 /32 走對應 cali veth
10.244.0.138 dev caliaf66b54b075 scope link │
10.244.0.153 dev cali58f769715fe scope link ┘ ← demo Pod A
10.244.1.0/25 via 10.244.1.0 dev flannel.1 onlink ← (c) 跨 node：到 worker2 podCIDR ★
172.22.0.0/24 dev eth0 proto kernel scope link src 172.22.0.2 ← (d) host underlay subnet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;封包送往 Pod B（&lt;code&gt;10.244.1.22&lt;/code&gt;）時，命中第 (c) ★ 條規則&lt;/strong&gt;：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;next-hop 是 &lt;code&gt;10.244.1.0&lt;/code&gt; —— 正好是對端 worker2 上 &lt;code&gt;flannel.1&lt;/code&gt; 的 IP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;onlink&lt;/code&gt; 告訴 kernel：「直接視為同一鏈路」，不必再對 next-hop 做 ARP&lt;/li&gt;
&lt;li&gt;出 device 是本機 &lt;code&gt;flannel.1&lt;/code&gt; —— 等於告訴 kernel「這條要做 VXLAN encap」&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;類型&lt;/th&gt;
&lt;th&gt;範例&lt;/th&gt;
&lt;th&gt;由誰寫的&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(a) 對外 default&lt;/td&gt;
&lt;td&gt;&lt;code&gt;default via 172.22.0.254 dev eth0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;node 啟動時 DHCP/Podman&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(b) 本機 Pod /32&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.244.0.153 dev cali58f769715fe&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Calico CNI 每建一個 Pod 寫一條&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(c) 跨 node Pod CIDR&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.244.1.0/25 via 10.244.1.0 dev flannel.1 onlink&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Flannel daemon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(d) host underlay&lt;/td&gt;
&lt;td&gt;&lt;code&gt;172.22.0.0/24 dev eth0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;kernel 自動&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;6.3 VXLAN forwarding database 與 neighbor&lt;span class="hx:absolute hx:-mt-20" id="63-vxlan-forwarding-database-與-neighbor"&gt;&lt;/span&gt;
&lt;a href="#63-vxlan-forwarding-database-%e8%88%87-neighbor" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 bridge fdb show dev flannel.1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ip neigh show dev flannel.1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# bridge fdb show dev flannel.1 ← 對端 flannel.1 MAC → 對端 underlay IP
d2:41:35:4c:5e:90 dst 172.22.0.3 self permanent ← worker2
d6:e5:aa:e1:8a:0e dst 172.22.0.1 self permanent ← control-plane
# ip neigh show dev flannel.1 ← 對端 flannel.1 IP → 對端 flannel.1 MAC
10.244.1.0 lladdr d2:41:35:4c:5e:90 PERMANENT ← worker2
10.244.0.0 lladdr d6:e5:aa:e1:8a:0e PERMANENT ← control-plane&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;kernel 對 Pod B 做 VXLAN encap 的四步查表&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Step 1 ip route 10.244.1.22 命中 10.244.1.0/25 via 10.244.1.0 dev flannel.1 onlink
Step 2 ip neigh 10.244.1.0 → MAC d2:41:35:4c:5e:90
Step 3 bridge fdb MAC d2:41:35:4c:5e:90 → underlay dst 172.22.0.3
Step 4 build VXLAN packet outer = UDP 172.22.0.2:?? → 172.22.0.3:8472, VNI 1
inner = original ICMP (10.244.0.153 → 10.244.1.22)
送出 device = eth0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;這兩張表是 Flannel daemon 透過 Kubernetes API 蒐集各 node 的 &lt;code&gt;flannel.alpha.coreos.com/*&lt;/code&gt; annotation 後，主動寫到 kernel 的（&lt;code&gt;PERMANENT&lt;/code&gt; 條目）—— 完全不需要 multicast、不需要 BGP。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;6.4 Calico Felix 的痕跡&lt;span class="hx:absolute hx:-mt-20" id="64-calico-felix-的痕跡"&gt;&lt;/span&gt;
&lt;a href="#64-calico-felix-%e7%9a%84%e7%97%95%e8%b7%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;即使沒有 NetworkPolicy，Felix 也會建立基礎 chain 結構。本文不展開、只示範它存在。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 iptables -t filter -L &lt;span class="p"&gt;|&lt;/span&gt; grep -i cali &lt;span class="p"&gt;|&lt;/span&gt; head&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cali-INPUT ... /* cali:Cz_u1IQiXIMmKD4c */ ┐
cali-FORWARD ... /* cali:wUHhoiAYhphO9Mso */ ├ Felix 的三個 hook chain
cali-OUTPUT ... /* cali:tVnHkvAo15HuiPy0 */ ┘
ACCEPT ... /* Policy explicitly accepted packet. */ mark match 0x10000/0x10000
MARK ... MARK or 0x10000
MARK ... MARK and 0xffe5ffff
cali-from-hep-forward ... ← host endpoint forward dispatcher
cali-from-wl-dispatch ... ← workload (Pod) ingress dispatcher
cali-to-wl-dispatch ... ← workload (Pod) egress dispatcher&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;7. 第三層觀察：抓真正的 VXLAN 封包&lt;span class="hx:absolute hx:-mt-20" id="7-第三層觀察抓真正的-vxlan-封包"&gt;&lt;/span&gt;
&lt;a href="#7-%e7%ac%ac%e4%b8%89%e5%b1%a4%e8%a7%80%e5%af%9f%e6%8a%93%e7%9c%9f%e6%ad%a3%e7%9a%84-vxlan-%e5%b0%81%e5%8c%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：在 host 對 &lt;code&gt;podman1&lt;/code&gt; bridge 抓 UDP 8472，能同時看到外層 underlay 與內層 Pod-to-Pod ICMP。&lt;/p&gt;
&lt;p&gt;本 cluster 的 node image 沒裝 &lt;code&gt;tcpdump&lt;/code&gt;（&lt;code&gt;sudo podman exec tk8s-worker1 which tcpdump&lt;/code&gt; 回 missing），所以直接在 host 抓最快。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;開兩個 terminal：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Terminal 1：host 上對 podman1 抓 UDP 8472（用 host filter 收緊噪音）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tcpdump -i podman1 -nn -c &lt;span class="m"&gt;8&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;udp port 8472 and host 172.22.0.2 and host 172.22.0.3&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Terminal 2：發 ping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$POD_A&lt;/span&gt; -- ping -c &lt;span class="m"&gt;4&lt;/span&gt; &lt;span class="nv"&gt;$POD_B_IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;listening on podman1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
11:40:13.754197 IP 172.22.0.2.60047 &amp;gt; 172.22.0.3.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.0.153 &amp;gt; 10.244.1.22: ICMP echo request, id 9, seq 1, length 64
11:40:13.754358 IP 172.22.0.3.60047 &amp;gt; 172.22.0.2.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.1.22 &amp;gt; 10.244.0.153: ICMP echo reply, id 9, seq 1, length 64
... (其餘略)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;逐欄對照：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;欄位&lt;/th&gt;
&lt;th&gt;意義&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;IP 172.22.0.2.60047 &amp;gt; 172.22.0.3.8472&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;外層：兩個 worker 在 podman1 上的 IP；dst port 8472 = Flannel VXLAN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OTV, flags [I] (0x08)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;tcpdump 預設把 UDP 8472 顯示為 OTV（同 port、格式相容）；要強制顯示 VXLAN 加 &lt;code&gt;-T vxlan&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;instance 1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;即 VNI 1（與 &lt;code&gt;ip -d link show flannel.1&lt;/code&gt; 的 &lt;code&gt;vxlan id 1&lt;/code&gt; 一致）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;內層 &lt;code&gt;IP 10.244.0.153 &amp;gt; 10.244.1.22: ICMP echo request&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;原始 Pod-to-Pod ICMP，被 VXLAN 包在裡面&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;8. Packet flow 圖&lt;span class="hx:absolute hx:-mt-20" id="8-packet-flow-圖"&gt;&lt;/span&gt;
&lt;a href="#8-packet-flow-%e5%9c%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：把前面三節學到的 interface / route / fdb / encap 串成一張圖。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;worker-1 (Podman container, 172.22.0.2) worker-2 (Podman container, 172.22.0.3)
&amp;#43;-------------------------------&amp;#43; &amp;#43;-------------------------------&amp;#43;
| Pod A netns | | Pod B netns |
| &amp;#43;------&amp;#43; | | &amp;#43;------&amp;#43; |
| | eth0 | 10.244.0.153/32 | | 10.244.1.22/32| eth0 | |
| | mtu | 1500 | | 1500| mtu | |
| &amp;#43;--&amp;#43;---&amp;#43; | | &amp;#43;---&amp;#43;--&amp;#43; |
| | (veth pair) | | (veth pair) | |
| &amp;#43;--&amp;#43;--------------&amp;#43; | | &amp;#43;--------------&amp;#43;--&amp;#43; |
| | cali58f769715fe | ← Calico | | Calico → | caliYYYYYYYYY | |
| | proxy_arp=1 | CNI | | CNI | proxy_arp=1 | |
| &amp;#43;-------&amp;#43;---------&amp;#43; 建立 | | 建立 &amp;#43;---------&amp;#43;------&amp;#43; |
| | | | | |
| [host route, 在 node netns] | | [host route, 在 node netns] |
| 10.244.1.0/25 via 10.244.1.0 | | 10.244.0.128/25 via ... |
| dev flannel.1 onlink | | dev flannel.1 onlink |
| | | | | |
| &amp;#43;-------v-----&amp;#43; | | &amp;#43;-----v-------&amp;#43; |
| | flannel.1 | VXLAN encap | | VXLAN decap | flannel.1 | |
| | id 1 | (in-kernel) | | (in-kernel) | id 1 | |
| | 10.244.0.128| MTU 1450 | | MTU 1450 | 10.244.1.0 | |
| &amp;#43;-------&amp;#43;-----&amp;#43; | | &amp;#43;-----&amp;#43;-------&amp;#43; |
| | | | | |
| &amp;#43;-------v-----&amp;#43; UDP 8472 | | UDP 8472 &amp;#43;--v-------&amp;#43; |
| | eth0 | src 172.22.0.2 | dst 172.22.0.3 | eth0 | |
| | (veth) | | | | (veth) | |
| &amp;#43;-------&amp;#43;-----&amp;#43; | | &amp;#43;----&amp;#43;-----&amp;#43; |
&amp;#43;----------|--------------------&amp;#43; &amp;#43;----------------------|-------&amp;#43;
| |
| &amp;#43;------------------------------&amp;#43; |
&amp;#43;---------&amp;gt;| host bridge: podman1 |&amp;lt;---------------&amp;#43;
| (Podman network &amp;#34;tk8s&amp;#34;) |
| subnet 172.22.0.0/24 |
&amp;#43;------------------------------&amp;#43;
(L2 forwarding；這裡看到的是 underlay UDP 封包)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;各步驟責任歸屬：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Calico CNI&lt;/strong&gt;：建立 Pod 的 veth pair、設定 host-side &lt;code&gt;caliXXXX&lt;/code&gt;、加上 &lt;code&gt;proxy_arp=1&lt;/code&gt;、寫 &lt;code&gt;&amp;lt;pod-ip&amp;gt;/32 dev caliXXXX scope link&lt;/code&gt; host route&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flannel daemon&lt;/strong&gt;（&lt;code&gt;canal/kube-flannel&lt;/code&gt; container）：管理 &lt;code&gt;flannel.1&lt;/code&gt; 的存在、寫入跨 node 的 host route 與 VXLAN fdb / neigh&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Linux kernel&lt;/strong&gt;：實際做 VXLAN encap/decap、ARP 與 routing；fdb / neigh 查表&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;host 的 podman1 bridge&lt;/strong&gt;：純 L2 forwarding，把 underlay UDP 在 nodes 之間搬&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;MTU mismatch 小提醒&lt;span class="hx:absolute hx:-mt-20" id="mtu-mismatch-小提醒"&gt;&lt;/span&gt;
&lt;a href="#mtu-mismatch-%e5%b0%8f%e6%8f%90%e9%86%92" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Pod eth0 MTU = 1500（Calico CNI 預設）&lt;/li&gt;
&lt;li&gt;flannel.1 MTU = 1450（VXLAN header 50 bytes）&lt;/li&gt;
&lt;li&gt;podman1 bridge MTU = 1500&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;意思是：Pod 直接送一個 1500 byte 的 packet，到了 flannel.1 因 MTU 較小，要嘛被分片、要嘛觸發 ICMP「Fragmentation Needed」回去做 PMTUD。本 demo 用 ping（小 packet）看不到問題；做大量 TCP 流量時會用 PMTUD 收斂到 1450。如要徹底避免這個 mismatch，可以在 Calico install spec 顯式把 &lt;code&gt;mtu&lt;/code&gt; 設成 &lt;code&gt;1450&lt;/code&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;9. 常見驗證 checklist&lt;span class="hx:absolute hx:-mt-20" id="9-常見驗證-checklist"&gt;&lt;/span&gt;
&lt;a href="#9-%e5%b8%b8%e8%a6%8b%e9%a9%97%e8%ad%89-checklist" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;這節重點&lt;/strong&gt;：ping 不通時按以下順序排查（依 &lt;a
href="https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md"target="_blank" rel="noopener"&gt;Flannel troubleshooting 文件&lt;/a&gt;）。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;檢查項&lt;/th&gt;
&lt;th&gt;指令&lt;/th&gt;
&lt;th&gt;健康時應看到&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;node 互通&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman exec tk8s-worker1 ping -c 2 172.22.0.3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0% packet loss&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;podCIDR 已設&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get node tk8s-worker1 -o jsonpath='{.spec.podCIDR}'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.244.0.128/25&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;flannel subnet&lt;/td&gt;
&lt;td&gt;見 9.3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;FLANNEL_SUBNET&lt;/code&gt; 與 podCIDR 一致&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;VXLAN checksum offload bug&lt;/td&gt;
&lt;td&gt;見 9.4&lt;/td&gt;
&lt;td&gt;（只在懷疑時才下）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;9.1 node 互通&lt;span class="hx:absolute hx:-mt-20" id="91-node-互通"&gt;&lt;/span&gt;
&lt;a href="#91-node-%e4%ba%92%e9%80%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ping -c &lt;span class="m"&gt;2&lt;/span&gt; 172.22.0.3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;PING 172.22.0.3 (172.22.0.3) 56(84) bytes of data.
64 bytes from 172.22.0.3: icmp_seq=1 ttl=64 time=0.308 ms
64 bytes from 172.22.0.3: icmp_seq=2 ttl=64 time=0.236 ms
--- 172.22.0.3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1032ms&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.2 podCIDR 是否設置&lt;span class="hx:absolute hx:-mt-20" id="92-podcidr-是否設置"&gt;&lt;/span&gt;
&lt;a href="#92-podcidr-%e6%98%af%e5%90%a6%e8%a8%ad%e7%bd%ae" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get node tk8s-worker1 -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.spec.podCIDR}&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; echo&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;10.244.0.128/25&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.3 flannel 寫好的 subnet&lt;span class="hx:absolute hx:-mt-20" id="93-flannel-寫好的-subnet"&gt;&lt;/span&gt;
&lt;a href="#93-flannel-%e5%af%ab%e5%a5%bd%e7%9a%84-subnet" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;/run/flannel/subnet.env&lt;/code&gt; 在 canal pod 的 &lt;code&gt;kube-flannel&lt;/code&gt; container 內，&lt;strong&gt;不在 node container 的 host 檔案系統&lt;/strong&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CANAL_POD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pod -n kube-system -l k8s-app&lt;span class="o"&gt;=&lt;/span&gt;canal &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --field-selector spec.nodeName&lt;span class="o"&gt;=&lt;/span&gt;tk8s-worker1 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; -n kube-system &lt;span class="nv"&gt;$CANAL_POD&lt;/span&gt; -c kube-flannel -- cat /run/flannel/subnet.env&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.129/25 ← 與 podCIDR 10.244.0.128/25 對應（差別在 .128 vs .129：podCIDR 用 network address，flannel 用第一個 host IP）
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.4 VXLAN checksum offload（只在懷疑時才下）&lt;span class="hx:absolute hx:-mt-20" id="94-vxlan-checksum-offload只在懷疑時才下"&gt;&lt;/span&gt;
&lt;a href="#94-vxlan-checksum-offload%e5%8f%aa%e5%9c%a8%e6%87%b7%e7%96%91%e6%99%82%e6%89%8d%e4%b8%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;抓得到 underlay UDP 8472 卻看不到 inner packet 時，可能是 VXLAN checksum offload bug：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tk8s-worker1 ethtool -K flannel.1 tx-checksum-ip-generic off&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Actual changes:
tx-checksum-ip-generic: off
tx-tcp-segmentation: off [not requested]
tx-tcp-ecn-segmentation: off [not requested]
tx-tcp-mangleid-segmentation: off [not requested]
tx-tcp6-segmentation: off [not requested]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;本 cluster 無此問題；上面只是示範指令在這個環境跑得起來。如不需要，請用 &lt;code&gt;... on&lt;/code&gt; 改回。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;10. 收尾&lt;span class="hx:absolute hx:-mt-20" id="10-收尾"&gt;&lt;/span&gt;
&lt;a href="#10-%e6%94%b6%e5%b0%be" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl delete -f docs/manifests/cni-demo.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;deployment.apps &amp;#34;cni-demo&amp;#34; deleted from default namespace&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;Appendix A. 指令速查表&lt;span class="hx:absolute hx:-mt-20" id="appendix-a-指令速查表"&gt;&lt;/span&gt;
&lt;a href="#appendix-a-%e6%8c%87%e4%bb%a4%e9%80%9f%e6%9f%a5%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;依「想看什麼」反查：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;想看什麼&lt;/th&gt;
&lt;th&gt;在哪裡跑&lt;/th&gt;
&lt;th&gt;指令&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pod IP / MTU / MAC&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl exec&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip a show eth0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pod default route&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl exec&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip route&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pod-to-Pod 連通&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl exec&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ping &amp;lt;pod B IP&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node 上所有 interface&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip -br a&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;flannel.1 的 VXLAN 參數&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip -d link show flannel.1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pod A 對應的 host-side veth&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip link | grep -A1 ^&amp;lt;iflink&amp;gt;:&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node 的 routing 表&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip route&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;對端 flannel.1 IP→MAC&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ip neigh show dev flannel.1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;對端 MAC→underlay IP&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bridge fdb show dev flannel.1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Felix iptables 痕跡&lt;/td&gt;
&lt;td&gt;node container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;iptables -t filter -L | grep cali&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;underlay VXLAN 封包&lt;/td&gt;
&lt;td&gt;host&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tcpdump -i podman1 -nn 'udp port 8472'&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;flannel 的 subnet.env&lt;/td&gt;
&lt;td&gt;canal pod (&lt;code&gt;kube-flannel&lt;/code&gt; container)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cat /run/flannel/subnet.env&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Podman bridge / network&lt;/td&gt;
&lt;td&gt;host&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman network inspect tk8s&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;node container 列表&lt;/td&gt;
&lt;td&gt;host&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman ps&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;Appendix B. 術語表&lt;span class="hx:absolute hx:-mt-20" id="appendix-b-術語表"&gt;&lt;/span&gt;
&lt;a href="#appendix-b-%e8%a1%93%e8%aa%9e%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;B.1 Linux kernel networking&lt;span class="hx:absolute hx:-mt-20" id="b1-linux-kernel-networking"&gt;&lt;/span&gt;
&lt;a href="#b1-linux-kernel-networking" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;network namespace（netns）&lt;/strong&gt;
kernel 提供的隔離機制；每個 netns 有自己獨立的一套 interface、routing table、iptables、socket。每個 Pod 跑在自己的 netns 裡，看不到 host 與其他 Pod 的網路狀態。Node 本身（不論是真機還是 Podman container）也是一個 netns。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;veth pair（virtual Ethernet pair）&lt;/strong&gt;
kernel 提供的成對 virtual interface，行為像「一條虛擬網線」：從一端送進去的封包會從另一端原樣出現。常用法是把一端放在 Pod netns、另一端放在 host netns，當作 Pod 與 host 之間的連線。Calico CNI 對每個 Pod 建一條：host 端 = &lt;code&gt;caliXXXXXXXXXX&lt;/code&gt;（host netns）、pod 端 = &lt;code&gt;eth0&lt;/code&gt;（Pod netns）。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;bridge（Linux bridge）&lt;/strong&gt;
kernel 內建的 software switch，把多個 interface 聚成一個 L2 廣播域、做 MAC learning 與 forwarding。本文裡 host 上的 &lt;code&gt;podman1&lt;/code&gt; 就是一個 bridge，連著三個 node container 的 veth。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MAC address&lt;/strong&gt;
L2 layer 的 6-byte 位址；同一個 L2 廣播域內用 ARP 由 IP 查到 MAC。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ARP（Address Resolution Protocol）/ neighbor table&lt;/strong&gt;
IPv4 用 ARP 廣播「誰有這個 IP？」來解析 IP→MAC；kernel 把結果快取在 neighbor table，用 &lt;code&gt;ip neigh&lt;/code&gt; 看。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;proxy ARP&lt;/strong&gt;
Host 收到 ARP request 時，雖然該 IP 不是自己也回應「我來」，引導對方把封包送過來、再由自己 forward。Calico 在每條 host-side veth 上設 &lt;code&gt;/proc/sys/net/ipv4/conf/&amp;lt;veth&amp;gt;/proxy_arp = 1&lt;/code&gt;，所以 Pod 對 dummy gateway &lt;code&gt;169.254.1.1&lt;/code&gt; 發 ARP 永遠收到 host MAC，封包就被導進 host netns 處理。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;routing table / next-hop&lt;/strong&gt;
kernel 決定「封包該從哪個 interface 出、下一跳給誰」的查表結構；用 &lt;code&gt;ip route&lt;/code&gt; 看。Next-hop 是命中該條後送往的下一個 IP：對端在同一鏈路時 = 目的 IP；跨 layer-3 時 = gateway。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;onlink（route flag）&lt;/strong&gt;
強制 kernel 把 next-hop 視為「同一鏈路」、不再去 ARP 解析它。Flannel 寫的跨 node 路由 &lt;code&gt;10.244.1.0/25 via 10.244.1.0 dev flannel.1 onlink&lt;/code&gt; 用這個 flag——對端 &lt;code&gt;flannel.1&lt;/code&gt; 的 IP 雖然不在自己 subnet 內，但因為走 VXLAN，下一跳由 fdb / neigh 表處理而非 ARP。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TTL（Time To Live）&lt;/strong&gt;
IPv4 header 的 8-bit 計數器，每經過一個 router 減 1，到 0 就丟掉並回 ICMP Time Exceeded。送出端通常從 64 起算；本文 ping 看到 ttl=62 表示中間經過兩跳（兩端 &lt;code&gt;flannel.1&lt;/code&gt; 各一次）。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MTU（Maximum Transmission Unit）/ PMTUD&lt;/strong&gt;
Interface 一次能送的最大 L3 封包大小。乙太網典型 1500 byte；VXLAN 因要加 50 byte header（IP 20 + UDP 8 + VXLAN 8 + 內層 Ethernet 14），inner MTU 通常 = underlay MTU − 50。當 sender 送了超過 path 上某段 MTU 的封包，DF flag 為 1 時 router 會丟封包並回 ICMP &amp;ldquo;Fragmentation Needed&amp;rdquo;，sender 據此調整——這個過程叫 &lt;strong&gt;Path MTU Discovery (PMTUD)&lt;/strong&gt;。&lt;/p&gt;
&lt;h3&gt;B.2 Encapsulation 與 overlay 網路&lt;span class="hx:absolute hx:-mt-20" id="b2-encapsulation-與-overlay-網路"&gt;&lt;/span&gt;
&lt;a href="#b2-encapsulation-%e8%88%87-overlay-%e7%b6%b2%e8%b7%af" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;encapsulation（encap）/ decapsulation（decap）&lt;/strong&gt;
encap 就是「把一個完整的封包當成 payload，包進另一個封包裡」，外層 header 的 src/dst 是傳輸路徑用的位址，內層才是原始封包；decap 就是反向取出內層。VXLAN 是其中一種 encap：把整個 L2 frame 包進 UDP。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;underlay network / overlay network&lt;/strong&gt;
Underlay 是底下「真的能 routable / switchable 的網路」；overlay 是邏輯上跑在 underlay 上的虛擬網路。本文中：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;underlay = host bridge &lt;code&gt;podman1&lt;/code&gt; + 三個 node 的 &lt;code&gt;172.22.0.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;overlay = &lt;code&gt;10.244.0.0/16&lt;/code&gt; 的 Pod IP 空間，靠 VXLAN 在 underlay 上重建&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Pod 不知道 overlay 是「假的」；underlay 不知道 Pod 的存在。中間靠 &lt;code&gt;flannel.1&lt;/code&gt; 做翻譯。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VXLAN（Virtual Extensible LAN）&lt;/strong&gt;
&lt;a
href="https://datatracker.ietf.org/doc/html/rfc7348"target="_blank" rel="noopener"&gt;RFC 7348&lt;/a&gt; 定義的 overlay 協定，把 L2 frame 包進 UDP（標準 port 4789；Flannel 為了相容歷史用 8472）。Linux kernel 支援，建一條 &lt;code&gt;flannel.1&lt;/code&gt; 這種 VXLAN device 即可：對它送的封包會自動 encap、收到的會自動 decap。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VNI（VXLAN Network Identifier）&lt;/strong&gt;
24-bit ID，類似 VLAN tag 但容量大得多；不同 VNI 的封包互相不可見。Flannel 預設 VNI = 1。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;fdb（forwarding database）&lt;/strong&gt;
Bridge / VXLAN device 的 MAC→出口對應表。一般 bridge 是 MAC→bridge port；&lt;strong&gt;VXLAN device 是 MAC→underlay IP&lt;/strong&gt;（kernel 知道要把這個 MAC 的封包 encap 後送去哪個 underlay endpoint）。本文 &lt;code&gt;bridge fdb show dev flannel.1&lt;/code&gt; 看到的 &lt;code&gt;dst 172.22.0.3&lt;/code&gt; 就是「對端 flannel.1 的 MAC 對應到對端 node 的 underlay IP」。&lt;/p&gt;
&lt;h3&gt;B.3 Kubernetes / CNI 元件&lt;span class="hx:absolute hx:-mt-20" id="b3-kubernetes--cni-元件"&gt;&lt;/span&gt;
&lt;a href="#b3-kubernetes--cni-%e5%85%83%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;CNI（Container Network Interface）&lt;/strong&gt;
&lt;a
href="https://github.com/containernetworking/cni"target="_blank" rel="noopener"&gt;CNI spec&lt;/a&gt;：kubelet 每次起 / 停一個 Pod 時，按 spec 呼叫指定的 binary（如 &lt;code&gt;/opt/cni/bin/calico&lt;/code&gt;），由它負責建 veth、配 IP、寫 host route。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;IPAM（IP Address Management）&lt;/strong&gt;
配 Pod IP 的子系統。CNI plugin 可以自己做 IPAM，也可以呼叫獨立 IPAM plugin。Calico 在 Canal 模式中自己做 IPAM。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;podCIDR&lt;/strong&gt;
Node 物件 &lt;code&gt;.spec.podCIDR&lt;/code&gt;，給每個 node 預先切好的 Pod IP 段。本 cluster 是 cluster pod CIDR &lt;code&gt;10.244.0.0/16&lt;/code&gt; → 每 node 切 &lt;code&gt;/25&lt;/code&gt;。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NetworkPolicy&lt;/strong&gt;
K8s API 物件，宣告「哪些 Pod 可以連到哪些 Pod / port」。執行靠 CNI 端的 controller，例如 Calico Felix 把它翻成 iptables / eBPF rules。本文不示範。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calico Felix&lt;/strong&gt;
Calico 的 per-node agent，負責 program iptables / eBPF rules（執行 NetworkPolicy）以及維護 endpoint state。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Flannel daemon（flanneld）&lt;/strong&gt;
Per-node agent，watch K8s API 收集各 node 的 podCIDR、&lt;code&gt;flannel.alpha.coreos.com/*&lt;/code&gt; annotation，然後在本機建 &lt;code&gt;flannel.1&lt;/code&gt; VXLAN device、寫 host route、寫 VXLAN fdb / neigh entry。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Calico CNI plugin&lt;/strong&gt;
被 kubelet 呼叫的 binary（不是常駐 daemon），負責 Pod 啟動時建 veth pair、配 Pod IP、寫 host-side &lt;code&gt;&amp;lt;pod-ip&amp;gt;/32 dev caliXXXX&lt;/code&gt; 路由、設 proxy_arp。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Canal&lt;/strong&gt;
把 Calico（policy）+ Flannel（networking）兩個 project 的 manifest 包成一份 install。Calico 在這個組合下跑 policy-only mode（&lt;code&gt;CALICO_NETWORKING_BACKEND=none&lt;/code&gt;），所以 Calico 的 BIRD（BGP daemon）不啟用、改由 Flannel 的 VXLAN 負責跨 node 連線。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;BGP（Border Gateway Protocol）&lt;/strong&gt;
Internet 的 routing protocol，Calico 預設用它讓各 node 互相 announce 自己的 podCIDR、不需要 overlay encap。Canal 模式下 BGP 停用、改用 Flannel VXLAN，所以本文看不到 BGP 相關痕跡。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;References&lt;span class="hx:absolute hx:-mt-20" id="references"&gt;&lt;/span&gt;
&lt;a href="#references" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;技術細節皆引自下列官方來源（依 &lt;code&gt;CLAUDE.md&lt;/code&gt; 規範要求）：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Kubernetes networking model：&lt;a
href="https://kubernetes.io/docs/concepts/cluster-administration/networking/"target="_blank" rel="noopener"&gt;https://kubernetes.io/docs/concepts/cluster-administration/networking/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Canal（Calico + Flannel）：&lt;a
href="https://docs.tigera.io/calico/latest/getting-started/kubernetes/flannel/install-for-flannel"target="_blank" rel="noopener"&gt;https://docs.tigera.io/calico/latest/getting-started/kubernetes/flannel/install-for-flannel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Calico architecture（Felix 等元件職責）：&lt;a
href="https://docs.tigera.io/calico/latest/reference/architecture/overview"target="_blank" rel="noopener"&gt;https://docs.tigera.io/calico/latest/reference/architecture/overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Flannel backends（VXLAN VNI、UDP 8472）：&lt;a
href="https://github.com/flannel-io/flannel/blob/master/Documentation/backends.md"target="_blank" rel="noopener"&gt;https://github.com/flannel-io/flannel/blob/master/Documentation/backends.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Flannel troubleshooting：&lt;a
href="https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md"target="_blank" rel="noopener"&gt;https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Calico CNI dataplane source（169.254.1.1 gateway、proxy_arp）：&lt;a
href="https://github.com/projectcalico/calico/blob/master/cni-plugin/pkg/dataplane/linux/dataplane_linux.go"target="_blank" rel="noopener"&gt;https://github.com/projectcalico/calico/blob/master/cni-plugin/pkg/dataplane/linux/dataplane_linux.go&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>資安事件報告 - 內部跳板伺服器遭加密貨幣挖礦惡意程式入侵</title><link>https://blog.kubeantony.com/archive/misc/%E8%B3%87%E5%AE%89%E4%BA%8B%E4%BB%B6%E5%A0%B1%E5%91%8A-%E5%85%A7%E9%83%A8%E8%B7%B3%E6%9D%BF%E4%BC%BA%E6%9C%8D%E5%99%A8%E9%81%AD%E5%8A%A0%E5%AF%86%E8%B2%A8%E5%B9%A3%E6%8C%96%E7%A4%A6%E6%83%A1%E6%84%8F%E7%A8%8B%E5%BC%8F%E5%85%A5%E4%BE%B5/</link><pubDate>Wed, 06 May 2026 08:09:20 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/%E8%B3%87%E5%AE%89%E4%BA%8B%E4%BB%B6%E5%A0%B1%E5%91%8A-%E5%85%A7%E9%83%A8%E8%B7%B3%E6%9D%BF%E4%BC%BA%E6%9C%8D%E5%99%A8%E9%81%AD%E5%8A%A0%E5%AF%86%E8%B2%A8%E5%B9%A3%E6%8C%96%E7%A4%A6%E6%83%A1%E6%84%8F%E7%A8%8B%E5%BC%8F%E5%85%A5%E4%BE%B5/</guid><description>
&lt;h2&gt;1. 事件概要&lt;span class="hx:absolute hx:-mt-20" id="1-事件概要"&gt;&lt;/span&gt;
&lt;a href="#1-%e4%ba%8b%e4%bb%b6%e6%a6%82%e8%a6%81" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;內部跳板與開發伺服器遭未授權入侵。經鑑識確認，本事件為典型的 &lt;strong&gt;加密貨幣資源劫持 (Cryptojacking)&lt;/strong&gt;，攻擊者透過對外暴露的 SSH 服務進行長期的密碼暴力破解，成功取得系統 &lt;code&gt;root&lt;/code&gt; 權限。&lt;/p&gt;
&lt;p&gt;攻擊者入侵後展現出高度的隱蔽技巧：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;降權躲避查緝&lt;/strong&gt;：取得 &lt;code&gt;root&lt;/code&gt; 後，刻意切換至一般使用者 A 的身分，於 &lt;code&gt;/var/tmp/&lt;/code&gt; 目錄下執行挖礦程式，以避免在系統資源監控（如 &lt;code&gt;top&lt;/code&gt;）中出現 &lt;code&gt;root&lt;/code&gt; 執行高耗能程序的突兀現象。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;雙軌營利模式&lt;/strong&gt;：同時運行傳統的 &lt;strong&gt;XMRig&lt;/strong&gt; 惡意挖礦（挖掘 Monero）與合法的 &lt;strong&gt;Vortix Cloud DePIN&lt;/strong&gt; 算力出租節點（&lt;code&gt;vortix-agent&lt;/code&gt;），多管齊下榨取伺服器算力。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;深度潛伏&lt;/strong&gt;：部署了 &lt;code&gt;sshdd.so&lt;/code&gt; (利用 &lt;code&gt;LD_PRELOAD&lt;/code&gt; 機制的 Userland Rootkit) 來隱藏實體檔案，並建立 &lt;code&gt;systemd&lt;/code&gt; 幽靈帳號與 &lt;code&gt;sudoers&lt;/code&gt; 免密碼提權後門，確保能長期掌控系統。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;本事件未發現明確的資料外洩 (Data Exfiltration) 傳輸行為。初始調查中 &lt;code&gt;/var/tmp/syst3md.1~8&lt;/code&gt; 出現的 &lt;strong&gt;2025 年 11 月&lt;/strong&gt; 檔案時間戳記，經查證為攻擊者使用 &lt;code&gt;wget&lt;/code&gt; 或 &lt;code&gt;curl&lt;/code&gt; 下載工具時，保留了中繼伺服器上原始檔案之 &lt;code&gt;Last-Modified&lt;/code&gt; 時間所致（Time-stomping 假象），實際入侵時間確認為 &lt;strong&gt;2026 年 2 月 15 日&lt;/strong&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;2. 受影響範圍評估&lt;span class="hx:absolute hx:-mt-20" id="2-受影響範圍評估"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%8f%97%e5%bd%b1%e9%9f%bf%e7%af%84%e5%9c%8d%e8%a9%95%e4%bc%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;確診受害主機：&lt;/strong&gt; 內部跳板與開發伺服器（主機名稱與 IP 已匿名化）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;初始感染源 (Patient Zero)：&lt;/strong&gt; 該伺服器本身（因 SSH 對外開放且密碼遭暴力破解），&lt;strong&gt;已排除終端使用者 A 之個人電腦遭惡意程式感染的風險&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;橫向移動風險評估：&lt;/strong&gt; 雖然攻擊者主要目標為挖礦，但因其曾掌握 &lt;code&gt;root&lt;/code&gt; 權限長達 80 餘天，伺服器上曾存放之使用者 B 的 SSH 私鑰、GitLab 密碼及各類環境變數 Token 均需視為「已遭曝露」。內網 K8s/RKE2 節點（30+ 台主機）具有潛在橫向感染風險，需全面清查。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;3. 攻擊時間軸 (Timeline)&lt;span class="hx:absolute hx:-mt-20" id="3-攻擊時間軸-timeline"&gt;&lt;/span&gt;
&lt;a href="#3-%e6%94%bb%e6%93%8a%e6%99%82%e9%96%93%e8%bb%b8-timeline" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;發生時間&lt;/th&gt;
&lt;th style="text-align: left"&gt;攻擊階段&lt;/th&gt;
&lt;th style="text-align: left"&gt;關鍵事件與動作描述&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-01 至 02 月&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;初始存取 (Initial Access)&lt;/td&gt;
&lt;td style="text-align: left"&gt;系統遭來自多個海外 IP (如 121.64.89.228) 之持續性 SSH 暴力破解攻擊，導致 &lt;code&gt;btmp&lt;/code&gt; 錯誤登入日誌暴增至 258MB。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-02-15 13:06&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;破城與持久化&lt;/td&gt;
&lt;td style="text-align: left"&gt;攻擊者成功猜中 &lt;code&gt;root&lt;/code&gt;（或具 sudo 權限帳號）密碼。登入後上傳 Launcher (&lt;code&gt;/usr/bin/log&lt;/code&gt;)。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-02-15 13:07&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;佈署後門&lt;/td&gt;
&lt;td style="text-align: left"&gt;植入 Rootkit (&lt;code&gt;sshdd.so&lt;/code&gt;)；建立幽靈帳號 &lt;code&gt;systemd&lt;/code&gt; (UID 1003) 並修改 &lt;code&gt;/etc/sudoers&lt;/code&gt; 賦予免密碼提權能力。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-02-15 13:08&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;降權執行挖礦&lt;/td&gt;
&lt;td style="text-align: left"&gt;啟用 &lt;code&gt;/etc/ld.so.preload&lt;/code&gt; 隱藏行蹤；&lt;strong&gt;切換為使用者 A 身份&lt;/strong&gt;，下載並執行 XMRig 礦工 (&lt;code&gt;syst3md&lt;/code&gt; / &lt;code&gt;/var/log/log&lt;/code&gt;)。&lt;em&gt;(註：此時下載的檔案帶有 2025-11-19 之原始 HTTP 標頭時間)&lt;/em&gt;。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-03-02&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;工具更新&lt;/td&gt;
&lt;td style="text-align: left"&gt;攻擊者下載 &lt;code&gt;mOymN.gz&lt;/code&gt; (6MB 工具包)。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-03-28&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;部署 DePIN 獲利&lt;/td&gt;
&lt;td style="text-align: left"&gt;攻擊者上傳 &lt;code&gt;vortix-agent&lt;/code&gt; (15.7MB) 並執行，開始利用 Vortix Cloud 進行算力出租獲利。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-04-18&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;持續活動&lt;/td&gt;
&lt;td style="text-align: left"&gt;下載器腳本 &lt;code&gt;cli&lt;/code&gt; 進行最後一次更新。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;2026-05-06&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;偵測與應變&lt;/td&gt;
&lt;td style="text-align: left"&gt;管理員發現異常 (LD_PRELOAD 攔截)，展開鑑識，確認入侵路徑並進行緊急止血。&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;4. 威脅指標 (IoCs)&lt;span class="hx:absolute hx:-mt-20" id="4-威脅指標-iocs"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%a8%81%e8%84%85%e6%8c%87%e6%a8%99-iocs" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;4.1 惡意檔案與 Hash (SHA256)&lt;span class="hx:absolute hx:-mt-20" id="41-惡意檔案與-hash-sha256"&gt;&lt;/span&gt;
&lt;a href="#41-%e6%83%a1%e6%84%8f%e6%aa%94%e6%a1%88%e8%88%87-hash-sha256" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rootkit (&lt;code&gt;/usr/local/lib/sshdd.so&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;acb2e78d748e9a22e80c386a58f6377f683fce556bc64da2bd6d82b2a9207e3c&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Launcher (&lt;code&gt;/usr/bin/log&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;c8e59338f471e255a40e13ef810db7db98ce018e417211ca0bdf90ef8cdd3894&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XMRig Miner (&lt;code&gt;/var/log/log&lt;/code&gt; &amp;amp; &lt;code&gt;/var/tmp/syst3md.1&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;dcf343df280816c4856ee164b9b4b14906a09b1fd4bfab604ee9370529ed61d1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vortix CLI (&lt;code&gt;/var/tmp/cli&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;c21fa4c1d6ed5342e49ef0561cc566a2cbe06a83f6298374fe9cb4f8027b6911&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vortix Agent (&lt;code&gt;/var/tmp/vortix-agent&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;c6b67c7ffc11c67eea889b8e0eef6891123123388297e0deaa490837a7b06833&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tool Archive (&lt;code&gt;/var/tmp/mOymN.gz&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;ac15860162f216d03e374d07f7eeb42944e4b0f08e78ea2468f3df9cbdb860cf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.2 系統入侵跡證&lt;span class="hx:absolute hx:-mt-20" id="42-系統入侵跡證"&gt;&lt;/span&gt;
&lt;a href="#42-%e7%b3%bb%e7%b5%b1%e5%85%a5%e4%be%b5%e8%b7%a1%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;檔案隱藏機制：&lt;/strong&gt; &lt;code&gt;/etc/ld.so.preload&lt;/code&gt; (內容包含 &lt;code&gt;/usr/local/lib/sshdd.so&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;持久化服務：&lt;/strong&gt; &lt;code&gt;/etc/systemd/system/log.service&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cron 後門：&lt;/strong&gt; &lt;code&gt;/etc/cron.hourly/0&lt;/code&gt; (權限 &lt;code&gt;5777&lt;/code&gt;，大小 0 bytes)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;提權後門帳號：&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/etc/passwd&lt;/code&gt; 中存在偽裝帳號 &lt;code&gt;systemd:x:1003:1003:...&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/sudoers&lt;/code&gt; 中存在越權設定 &lt;code&gt;systemd ALL=(ALL) NOPASSWD:ALL&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.3 網路與通訊 (Network/C2)&lt;span class="hx:absolute hx:-mt-20" id="43-網路與通訊-networkc2"&gt;&lt;/span&gt;
&lt;a href="#43-%e7%b6%b2%e8%b7%af%e8%88%87%e9%80%9a%e8%a8%8a-networkc2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;77.221.157.206:6196&lt;/code&gt; (Rootkit 內建 C2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;141.95.72.59&lt;/code&gt; (Rootkit 內建 C2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;139.99.125.38&lt;/code&gt; (Rootkit 內建 C2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;139.99.123.196&lt;/code&gt; (Rootkit 內建 C2)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;141.94.96.71:3333&lt;/code&gt; (活動礦池)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;94.26.106.195&lt;/code&gt; (HTTP Staging Server，提供 &lt;code&gt;cli&lt;/code&gt; 等惡意程式下載)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pool.supportxmr.com:9000&lt;/code&gt; (合法 Monero 礦池，遭濫用)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;4.4 攻擊者 Vortix DePIN 識別標記 (Tokens)&lt;span class="hx:absolute hx:-mt-20" id="44-攻擊者-vortix-depin-識別標記-tokens"&gt;&lt;/span&gt;
&lt;a href="#44-%e6%94%bb%e6%93%8a%e8%80%85-vortix-depin-%e8%ad%98%e5%88%a5%e6%a8%99%e8%a8%98-tokens" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;uUbGvGz7zAMgGtHsTo8EOi1krvj+OPi7SF5UMeoCJnU=&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;jUliaNLclI34oUpjC7ewra/HjEuw+UgYa7jrpxMBC3k=&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;5. 攻擊手法分析 (MITRE ATT&amp;amp;CK Mapping)&lt;span class="hx:absolute hx:-mt-20" id="5-攻擊手法分析-mitre-attck-mapping"&gt;&lt;/span&gt;
&lt;a href="#5-%e6%94%bb%e6%93%8a%e6%89%8b%e6%b3%95%e5%88%86%e6%9e%90-mitre-attck-mapping" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;階段策略&lt;/th&gt;
&lt;th style="text-align: left"&gt;技術編號&lt;/th&gt;
&lt;th style="text-align: left"&gt;技術名稱&lt;/th&gt;
&lt;th style="text-align: left"&gt;具體行為對應&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Initial Access&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1110.001&lt;/td&gt;
&lt;td style="text-align: left"&gt;Password Guessing&lt;/td&gt;
&lt;td style="text-align: left"&gt;針對伺服器對外 SSH 服務進行密集密碼暴力破解。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Execution&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1059.004&lt;/td&gt;
&lt;td style="text-align: left"&gt;Unix Shell&lt;/td&gt;
&lt;td style="text-align: left"&gt;利用 Bash 執行 &lt;code&gt;wget&lt;/code&gt;/&lt;code&gt;curl&lt;/code&gt; 下載腳本與執行檔。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Privilege Escalation&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1548.003&lt;/td&gt;
&lt;td style="text-align: left"&gt;Sudo and Sudo Caching&lt;/td&gt;
&lt;td style="text-align: left"&gt;建立 &lt;code&gt;systemd&lt;/code&gt; 帳號並於 &lt;code&gt;/etc/sudoers&lt;/code&gt; 寫入 &lt;code&gt;NOPASSWD:ALL&lt;/code&gt; 後門。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Defense Evasion&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1070.006&lt;/td&gt;
&lt;td style="text-align: left"&gt;Timestomp&lt;/td&gt;
&lt;td style="text-align: left"&gt;利用 &lt;code&gt;wget&lt;/code&gt; 預設行為保留伺服器端舊時間戳記，造成調查干擾。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Defense Evasion&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1548.002&lt;/td&gt;
&lt;td style="text-align: left"&gt;Bypass User Account Control&lt;/td&gt;
&lt;td style="text-align: left"&gt;取得 &lt;code&gt;root&lt;/code&gt; 後刻意切換為使用者 A 身份執行耗能程式，規避直覺查緝。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Defense Evasion&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1574.006&lt;/td&gt;
&lt;td style="text-align: left"&gt;Dynamic Linker Hijacking&lt;/td&gt;
&lt;td style="text-align: left"&gt;植入 &lt;code&gt;sshdd.so&lt;/code&gt; 劫持 &lt;code&gt;LD_PRELOAD&lt;/code&gt;，攔截目錄與檔案讀取 API。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Persistence&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1546.004&lt;/td&gt;
&lt;td style="text-align: left"&gt;Unix shell Configuration&lt;/td&gt;
&lt;td style="text-align: left"&gt;利用 Systemd (&lt;code&gt;log.service&lt;/code&gt;) 與 Cron (&lt;code&gt;/etc/cron.hourly/0&lt;/code&gt;) 進行駐留。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Impact&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;T1496&lt;/td&gt;
&lt;td style="text-align: left"&gt;Resource Hijacking&lt;/td&gt;
&lt;td style="text-align: left"&gt;同時執行 XMRig 與 Vortix Agent，劫持運算力進行雙重加密貨幣獲利。&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;6. 處置與防護建議&lt;span class="hx:absolute hx:-mt-20" id="6-處置與防護建議"&gt;&lt;/span&gt;
&lt;a href="#6-%e8%99%95%e7%bd%ae%e8%88%87%e9%98%b2%e8%ad%b7%e5%bb%ba%e8%ad%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;6.1 立即止血 (Containment)&lt;span class="hx:absolute hx:-mt-20" id="61-立即止血-containment"&gt;&lt;/span&gt;
&lt;a href="#61-%e7%ab%8b%e5%8d%b3%e6%ad%a2%e8%a1%80-containment" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;強制中止惡意程序：&lt;/strong&gt; 中止 &lt;code&gt;/var/log/log&lt;/code&gt;、&lt;code&gt;/usr/bin/log&lt;/code&gt;、&lt;code&gt;cli&lt;/code&gt;、&lt;code&gt;vortix-agent&lt;/code&gt; 等程序，並全面停用 &lt;code&gt;log.service&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;根除 Rootkit 與實體檔案：&lt;/strong&gt; 刪除 &lt;code&gt;/etc/ld.so.preload&lt;/code&gt; 解除系統攔截，清理 &lt;code&gt;/var/tmp/&lt;/code&gt; 下之所有惡意工具與備份。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;封堵後門帳號：&lt;/strong&gt; 於 &lt;code&gt;/etc/passwd&lt;/code&gt;、&lt;code&gt;/etc/shadow&lt;/code&gt; 刪除 &lt;code&gt;systemd&lt;/code&gt; 偽裝帳號，並修改 &lt;code&gt;/etc/sudoers&lt;/code&gt; 移除越權規則。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;網路封鎖：&lt;/strong&gt; 於上層防火牆 (Firewall/Security Group) 設定阻擋已知之 C2 節點、礦池 IP 及 Staging Server。&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;6.2 系統重建與憑證輪替 (Eradication &amp;amp; Recovery)&lt;span class="hx:absolute hx:-mt-20" id="62-系統重建與憑證輪替-eradication--recovery"&gt;&lt;/span&gt;
&lt;a href="#62-%e7%b3%bb%e7%b5%b1%e9%87%8d%e5%bb%ba%e8%88%87%e6%86%91%e8%ad%89%e8%bc%aa%e6%9b%bf-eradication--recovery" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;作業系統重裝：&lt;/strong&gt; 由於伺服器曾遭 Rootkit 高度掌控逾 80 天，強烈建議從乾淨的 ISO 映像檔重新安裝作業系統，僅可遷移純資料檔案（如設定檔、資料庫 dump），切勿直接複製執行檔或系統腳本。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;全面撤銷與輪替憑證：&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;強制重設所有伺服器本機帳號密碼。&lt;/li&gt;
&lt;li&gt;撤銷伺服器上使用者 A、使用者 B 等所有使用者的 SSH 私鑰，並重新核發。&lt;/li&gt;
&lt;li&gt;重設所有可能於伺服器上曝露之第三方憑證（如 GitLab Admin、K8s Secret 等）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;6.3 長期安全強化 (Post-Incident)&lt;span class="hx:absolute hx:-mt-20" id="63-長期安全強化-post-incident"&gt;&lt;/span&gt;
&lt;a href="#63-%e9%95%b7%e6%9c%9f%e5%ae%89%e5%85%a8%e5%bc%b7%e5%8c%96-post-incident" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;阻斷暴力破解根源 (最高優先級)：&lt;/strong&gt; 修改 &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;，設定 &lt;code&gt;PasswordAuthentication no&lt;/code&gt;，&lt;strong&gt;全面強制僅能使用 SSH 金鑰登入&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;存取來源限制：&lt;/strong&gt; 透過防火牆限制 SSH 服務僅允許信任的來源 IP（如公司 VPN 網段）連線。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;橫向掃描與威脅通報：&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;使用本報告之 IoC 腳本，清查使用者 B 曾登入過之內網 K8s 節點。&lt;/li&gt;
&lt;li&gt;（選用）附上攻擊者 Token 向 &lt;code&gt;abuse@vortix.cloud&lt;/code&gt; 提出檢舉，阻斷攻擊者利用合法 DePIN 平台之洗錢管道。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Gemini CLI `/init` 異常延遲重現步驟</title><link>https://blog.kubeantony.com/archive/misc/gemini-cli-init-%E7%95%B0%E5%B8%B8%E5%BB%B6%E9%81%B2%E9%87%8D%E7%8F%BE%E6%AD%A5%E9%A9%9F/</link><pubDate>Tue, 05 May 2026 02:08:38 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/gemini-cli-init-%E7%95%B0%E5%B8%B8%E5%BB%B6%E9%81%B2%E9%87%8D%E7%8F%BE%E6%AD%A5%E9%A9%9F/</guid><description>
&lt;h2&gt;背景&lt;span class="hx:absolute hx:-mt-20" id="背景"&gt;&lt;/span&gt;
&lt;a href="#%e8%83%8c%e6%99%af" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;原始 session 中,執行 &lt;code&gt;/init&lt;/code&gt; 後 Gemini CLI 花了約 1 小時 25 分鐘才完成 GEMINI.md 的產出。
從 log 抽出的 tool call 時間戳顯示有兩個明顯卡點:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;卡點 1&lt;/strong&gt;:&lt;code&gt;/init&lt;/code&gt; 送出 → 第一個 tool call,等了 &lt;strong&gt;約 45 分鐘&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;卡點 2&lt;/strong&gt;:list 根目錄 → list &lt;code&gt;openspec/specs&lt;/code&gt; 子目錄,等了 &lt;strong&gt;約 31 分鐘&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;本文件目的是讓問題可被重現,以利後續判斷成因或回報 bug。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;環境前置條件&lt;span class="hx:absolute hx:-mt-20" id="環境前置條件"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e5%89%8d%e7%bd%ae%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;重現前需準備與原情境一致的環境:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Gemini CLI 版本:&lt;strong&gt;0.40.1&lt;/strong&gt;(stable,2026 年 4 月底發布)&lt;/li&gt;
&lt;li&gt;OpenSpec 版本:&lt;strong&gt;1.3.1&lt;/strong&gt;(2026 年 4 月下旬發布,latest 為當下最新)&lt;/li&gt;
&lt;li&gt;Node.js / npm 已安裝(&lt;code&gt;openspec&lt;/code&gt; 需要 Node.js 20.19.0 或更新)&lt;/li&gt;
&lt;li&gt;OS:Linux&lt;/li&gt;
&lt;li&gt;使用者 preference:永遠使用繁體中文回應&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;若要重新驗證版本:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Gemini CLI:&lt;code&gt;gemini /about&lt;/code&gt; 或 &lt;code&gt;gemini --version&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;OpenSpec:&lt;code&gt;openspec --version&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;若要強制升級到當下最新 stable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Gemini CLI:&lt;code&gt;npm install -g @google/gemini-cli@latest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;OpenSpec:&lt;code&gt;npm install -g @fission-ai/openspec@latest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h3&gt;一鍵建立 workspace&lt;span class="hx:absolute hx:-mt-20" id="一鍵建立-workspace"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%80%e9%8d%b5%e5%bb%ba%e7%ab%8b-workspace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir -p ~/k8s/workload/graceful-shutdown
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo npm install -g @fission-ai/openspec
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/k8s/workload/graceful-shutdown
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openspec init --tools gemini&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;openspec init --tools gemini&lt;/code&gt; 會自動產出以下結構,內含 &lt;code&gt;.gemini/commands/opsx/&lt;/code&gt; 的 4 個 toml 指令、&lt;code&gt;.gemini/skills/openspec-*/&lt;/code&gt; 的 4 個 SKILL.md,以及 &lt;code&gt;openspec/changes/archive/&lt;/code&gt; 與 &lt;code&gt;openspec/specs/&lt;/code&gt; 兩個空目錄:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;graceful-shutdown/
├── .gemini/
│ ├── commands/opsx/
│ │ ├── apply.toml
│ │ ├── archive.toml
│ │ ├── explore.toml
│ │ └── propose.toml
│ └── skills/
│ ├── openspec-apply-change/SKILL.md
│ ├── openspec-archive-change/SKILL.md
│ ├── openspec-explore/SKILL.md
│ └── openspec-propose/SKILL.md
└── openspec/
├── changes/archive/
└── specs/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;啟動 CLI(建議開啟 debug log + YOLO 模式)&lt;span class="hx:absolute hx:-mt-20" id="啟動-cli建議開啟-debug-log--yolo-模式"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%9f%e5%8b%95-cli%e5%bb%ba%e8%ad%b0%e9%96%8b%e5%95%9f-debug-log--yolo-%e6%a8%a1%e5%bc%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/k8s/workload/graceful-shutdown
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;script -q /tmp/gemini-repro.log -c &lt;span class="s1"&gt;&amp;#39;gemini --debug --yolo&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;--debug&lt;/code&gt; 在卡住時可以從 log 看出是 retry、thinking、還是在等 API。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;--yolo&lt;/code&gt; 會自動同意所有 tool 呼叫的確認對話,避免重現過程被 plan / write_file / shell 的確認 prompt 打斷,確保延遲現象來自 Gemini 本身而非「等使用者按 yes」。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;script&lt;/code&gt; 指令會保留 TTY 讓互動模式正常運作,同時把整個 terminal session 錄到指定檔案。結束時按 &lt;code&gt;Ctrl+D&lt;/code&gt; 或輸入 &lt;code&gt;exit&lt;/code&gt;。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;替代方案:若不需要 log 檔,直接 &lt;code&gt;gemini --debug --yolo&lt;/code&gt; 即可。互動模式的 log 也會自動寫到 &lt;code&gt;~/.gemini/&lt;/code&gt; 底下,可在 CLI 內輸入 &lt;code&gt;/about&lt;/code&gt; 或 &lt;code&gt;/bug&lt;/code&gt; 查詢確切路徑。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;重現步驟&lt;span class="hx:absolute hx:-mt-20" id="重現步驟"&gt;&lt;/span&gt;
&lt;a href="#%e9%87%8d%e7%8f%be%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Step 1 — 完整需求&lt;span class="hx:absolute hx:-mt-20" id="step-1--完整需求"&gt;&lt;/span&gt;
&lt;a href="#step-1--%e5%ae%8c%e6%95%b4%e9%9c%80%e6%b1%82" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;輸入:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/plan 我想搭配 openspec 的流程開發一套 go 語言寫的 http server,這網站要能夠接住 sigint 和 sigterm 的訊號,並執行 graceful shutdown,這網站最終要部署在 K8s 上,並且 CNI 是 cilium 還有啟用 kubeproxy replacement,pod 狀態為 Terminating 的時候,要執行 prestop hook sleep 2s,不要寫在 source code 裡面&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;預期行為:Gemini 進入 &lt;strong&gt;Plan Mode&lt;/strong&gt;,使用 &lt;code&gt;openspec-propose&lt;/code&gt; skill 並輸出計畫摘要。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/By-z2TLAZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Step 2 — 確認 plan(第一次)&lt;span class="hx:absolute hx:-mt-20" id="step-2--確認-plan第一次"&gt;&lt;/span&gt;
&lt;a href="#step-2--%e7%a2%ba%e8%aa%8d-plan%e7%ac%ac%e4%b8%80%e6%ac%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;輸入:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;好&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;✦ I have drafted the detailed implementation plan. Please review it below:
1 # Implementation Plan: Graceful Shutdown Go HTTP Server
2
3 ## Background &amp;amp; Motivation
4 The objective is to build a Go-based HTTP server capable of performing a graceful shutdown when receiving `SIGINT` or `SIGTERM` signals. The application
will be deployed on a Kubernetes cluster utilizing the Cilium CNI with kube-proxy replacement. To ensure zero downtime during pod termination, a `preStop`
hook sleeping for 2 seconds must be configured at the deployment level rather than being hardcoded in the application logic. The development process will be
guided by the `openspec` workflow.
5
6 ## Scope &amp;amp; Impact
7 - **Go Application**: Create a basic HTTP server in Go that listens for termination signals and shuts down gracefully using context timeouts.
8 - **Dockerization**: Create a `Dockerfile` to containerize the Go application.
9 - **Kubernetes Manifests**: Create a Deployment and Service manifest. The Deployment must include a `lifecycle.preStop` hook to execute `sleep 2`.
10 - **Process**: Utilize `openspec-propose` to generate standard artifacts (`proposal.md`, `design.md`, `tasks.md`).
11
12 ## Proposed Solution
13 1. **OpenSpec Setup**: Use the `openspec` CLI to scaffold a new change (`graceful-shutdown-go-server`) and generate the required artifacts.
14 2. **Implementation**:
15 - Write `main.go` using `net/http` and `os/signal`.
16 - Create a minimal `Dockerfile` (e.g., multi-stage build starting from `golang:alpine`).
17 - Define `deployment.yaml` with the `preStop` hook (`command: [&amp;#34;/bin/sh&amp;#34;, &amp;#34;-c&amp;#34;, &amp;#34;sleep 2&amp;#34;]`).
18 3. **Verification**: Confirm the application builds, the Docker image can be created, and the Kubernetes manifests are structurally correct and contain the
requested hooks.
19
20 ## Alternatives Considered
21 - *Hardcoding sleep in Go*: Rejected as per the requirement to handle the delay externally via Kubernetes lifecycle hooks to keep the application code
focused on application-level shutdown logic rather than orchestration-specific workarounds.
22
23 ## Phased Implementation Plan
24 - **Phase 1: OpenSpec Artifacts**: Exit Plan Mode, create the `openspec` change, and let the `openspec-propose` skill generate the documentation artifacts.
25 - **Phase 2: Code Implementation**: Write the Go source code and Dockerfile.
26 - **Phase 3: Kubernetes Manifests**: Write the Deployment and Service configurations, ensuring the `preStop` hook is correctly defined.
27
28 ## Verification
29 - Code review of the Go server to ensure signal handling and context usage.
30 - Verification of the `deployment.yaml` to confirm the presence of the `preStop` hook.
31
32 ## Migration &amp;amp; Rollback
33 - N/A (New deployment).
Does this detailed plan look correct to you? If so, I will proceed to formally submit it for approval so we can begin execution.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h3&gt;Step 4 — 要求繁中&lt;span class="hx:absolute hx:-mt-20" id="step-4--要求繁中"&gt;&lt;/span&gt;
&lt;a href="#step-4--%e8%a6%81%e6%b1%82%e7%b9%81%e4%b8%ad" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;請注意永遠必須要使用繁體中文&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;✦ 接下來，我將讀取該變更的狀態，以確定需要產生哪些產出物。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec status --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 32 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;status&amp;#34;: &amp;#34;blocked&amp;#34;, │
│ &amp;#34;missingDeps&amp;#34;: [ │
│ &amp;#34;design&amp;#34;, │
│ &amp;#34;specs&amp;#34; │
│ ] │
│ } │
│ ] │
│ } │
│ Process Group PGID: 5697 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 根據狀態，我需要先建立 proposal。我會先獲取 proposal 的指令與模板。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec instructions proposal --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 7 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;instruction&amp;#34;: &amp;#34;Create the proposal document that establishes WHY this change is needed.\n\nSections:\n- **Why**: 1-2 sentences on the problem or │
│ opportunity. What problem does this solve? Why now?\n- **What Changes**: Bullet list of changes. Be specific about new capabilities, modifications, or │
│ removals. Mark breaking changes with **BREAKING**.\n- **Capabilities**: Identify which specs will be created or modified:\n - **New Capabilities**: List │
│ capabilities being introduced. Each becomes a new `specs/&amp;lt;name&amp;gt;/spec.md`. Use kebab-case names (e.g., `user-auth`, `data-export`).\n - **Modified │
│ Capabilities**: List existing capabilities whose REQUIREMENTS are changing. Only include if spec-level behavior changes (not just implementation details). │
│ Each needs a delta spec file. Check `openspec/specs/` for existing spec names. Leave empty if no requirement changes.\n- **Impact**: Affected code, APIs, │
│ dependencies, or systems.\n\nIMPORTANT: The Capabilities section is critical. It creates the contract between\nproposal and specs phases. Research │
│ existing specs before filling this in.\nEach capability listed here will need a corresponding spec file.\n\nKeep it concise (1-2 pages). Focus on the │
│ \&amp;#34;why\&amp;#34; not the \&amp;#34;how\&amp;#34; -\nimplementation details belong in design.md.\n\nThis is the foundation - specs, design, and tasks all build on this.\n&amp;#34;, │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 我現在來撰寫 proposal.md。
✓ WriteFile proposal.md → Accepted (&amp;#43;24, -0)
1 ## Why
2
3 為了確保部署在 Kubernetes (使用 Cilium CNI 且啟用 kube-proxy replacement) 上的 Go HTTP 伺服器在 Pod 終止過程中不會遺失請求，我們需要實作 Graceful
Shutdown 機制，並搭配 Kubernetes 的 `preStop` hook。這樣可以確保在 Pod 進入 Terminating 狀態後，仍有緩衝時間處理剩餘請求。
4
5 ## What Changes
6
7 - 實作 Go 語言的 HTTP 伺服器，支援監聽 `SIGINT` 與 `SIGTERM` 訊號。
8 - 呼叫 `http.Server.Shutdown()` 方法以優雅地關閉連線。
9 - 提供 `Dockerfile` 用於容器化部署。
10 - 提供 Kubernetes Deployment 與 Service 清單 (Manifests)。
11 - 在 Deployment 中加入 `lifecycle.preStop` hook 執行 `sleep 2`。
12
13 ## Capabilities
14
15 ### New Capabilities
16 - `graceful-shutdown-server`: 提供一個具備訊號監聽與優雅關閉能力的 HTTP 伺服器，並包含 K8s 部署設定。
17
18 ### Modified Capabilities
19 &amp;lt;!-- 無 --&amp;gt;
20
21 ## Impact
22
23 - **應用程式**: 新增 `main.go` 處理伺服器啟動與關閉邏輯。
24 - **基礎設施**: 新增 K8s Deployment 與 Service 設定，影響 Pod 的生命週期管理。
✦ proposal.md 已建立。現在我再次檢查狀態，並獲取 design 的指令。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec status --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 26 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;status&amp;#34;: &amp;#34;blocked&amp;#34;, │
│ &amp;#34;missingDeps&amp;#34;: [ │
│ &amp;#34;design&amp;#34;, │
│ &amp;#34;specs&amp;#34; │
│ ] │
│ } │
│ ] │
│ } │
│ Process Group PGID: 5768 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 我將先獲取 design 的指令。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec instructions design --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 13 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;path&amp;#34;: &amp;#34;proposal.md&amp;#34;, │
│ &amp;#34;description&amp;#34;: &amp;#34;Initial proposal document outlining the change&amp;#34; │
│ } │
│ ], │
│ &amp;#34;unlocks&amp;#34;: [ │
│ &amp;#34;tasks&amp;#34; │
│ ] │
│ } │
│ Process Group PGID: 5803 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 現在我來撰寫 design.md。
✓ WriteFile design.md → Accepted (&amp;#43;28, -0)
1 ## Context
2
3 目前需要一個能夠在 Kubernetes 環境中安全退場的 Go 伺服器。由於 Kubernetes 的 Service 負載平衡與 Pod 終止是非同步進行的，若不設定 `preStop` hook 與
Graceful Shutdown，可能會在 Pod 關閉期間漏掉部分請求。
4
5 ## Goals / Non-Goals
6
7 **Goals:**
8 - 實作訊號處理邏輯以支援優雅關閉。
9 - 配置 K8s 生命週期鉤子 (`preStop`)。
10 - 確保程式碼簡潔且符合 Go 最佳實踐。
11
12 **Non-Goals:**
13 - 實作複雜的業務邏輯。
14 - 設定進階的 Cilium 網路政策（僅關注 shutdown 流程）。
15
16 ## Decisions
17
18 - **訊號處理**: 使用 `os/signal` 監聽 `SIGINT` (Ctrl&amp;#43;C) 與 `SIGTERM` (K8s 終止訊號)。
19 - **優雅關閉**: 使用 `http.Server.Shutdown()` 並設定 5-10 秒的超時 context，確保進行中的請求有時間完成。
20 - **Kubernetes 整合**:
21 - 在 Deployment 中加入 `lifecycle.preStop.exec` 執行 `sleep 2`。
22 - 理由：這讓 Cilium CNI 有足夠的時間從 eBPF 表中移除該 Pod 的 IP，避免新的請求進來，而此時應用程式已進入關閉流程。
23 - **容器化**: 使用多階段建置 (multi-stage build) 以縮小映像檔體積並提高安全性。
24
25 ## Risks / Trade-offs
26
27 - **[Risk]**: `preStop` hook 時間過短。 → **Mitigation**: 預設 2 秒符合一般 Cilium 環境下 kube-proxy replacement 的收斂速度。
28 - **[Risk]**: 應用程式關閉時間超過 `terminationGracePeriodSeconds`。 → **Mitigation**: 確保 Go 的 `Shutdown` context timeout 小於 K8s 的預設 30 秒。
✦ design.md 已完成。現在我需要建立 specs。根據 proposal，我定義了一個新能力 graceful-shutdown-server。
我將獲取 specs 的指令。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec instructions specs --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 13 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;path&amp;#34;: &amp;#34;proposal.md&amp;#34;, │
│ &amp;#34;description&amp;#34;: &amp;#34;Initial proposal document outlining the change&amp;#34; │
│ } │
│ ], │
│ &amp;#34;unlocks&amp;#34;: [ │
│ &amp;#34;tasks&amp;#34; │
│ ] │
│ } │
│ Process Group PGID: 5850 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 我將建立 openspec/changes/graceful-shutdown-go-server/specs/graceful-shutdown-server/spec.md。
✓ WriteFile spec.md → Accepted (&amp;#43;22, -0)
1 ## ADDED Requirements
2
3 ### Requirement: 訊號監聽 (Signal Handling)
4 伺服器必須監聽 `os.Interrupt` (SIGINT) 與 `syscall.SIGTERM` 訊號。
5
6 #### Scenario: 接收到終止訊號
7 - **WHEN** 伺服器接收到 SIGTERM 訊號
8 - **THEN** 伺服器啟動關閉程序並停止接受新請求
9
10 ### Requirement: 優雅關閉 (Graceful Shutdown)
11 伺服器必須在關閉前等待現有連線處理完畢，並設定超時機制。
12
13 #### Scenario: 關閉程序執行
14 - **WHEN** 呼叫 Shutdown 方法
15 - **THEN** 伺服器等待所有作用中請求完成，或直到達到 10 秒超時為止
16
17 ### Requirement: Kubernetes PreStop Hook
18 部署清單必須包含 PreStop 鉤子以延遲應用程式關閉。
19
20 #### Scenario: Pod 進入 Terminating 狀態
21 - **WHEN** Kubernetes 將 Pod 標記為 Terminating
22 - **THEN** PreStop 鉤子執行 `sleep 2`，延遲傳送 SIGTERM 訊號給容器
✦ 現在 proposal, design, specs 都已完成。最後我需要建立 tasks。
我將獲取 tasks 的指令。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec instructions tasks --change &amp;#34;graceful-shutdown-go-server&amp;#34; --json │
│ │
│ ... first 17 lines hidden (Ctrl&amp;#43;O to show) ... │
│ &amp;#34;id&amp;#34;: &amp;#34;design&amp;#34;, │
│ &amp;#34;done&amp;#34;: true, │
│ &amp;#34;path&amp;#34;: &amp;#34;design.md&amp;#34;, │
│ &amp;#34;description&amp;#34;: &amp;#34;Technical design document with implementation details&amp;#34; │
│ } │
│ ], │
│ &amp;#34;unlocks&amp;#34;: [] │
│ } │
│ Process Group PGID: 5894 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 我將建立 tasks.md。
✓ WriteFile tasks.md → Accepted (&amp;#43;17, -0)
1 ## 1. 專案初始化與 Go 伺服器實作
2
3 - [ ] 1.1 初始化 Go 專案 (`go mod init`)
4 - [ ] 1.2 在 `main.go` 中實作基礎 HTTP 伺服器
5 - [ ] 1.3 實作訊號監聽邏輯 (`SIGINT`, `SIGTERM`)
6 - [ ] 1.4 實作優雅關閉邏輯 (`http.Server.Shutdown`)
7
8 ## 2. 容器化
9
10 - [ ] 2.1 撰寫多階段建置的 `Dockerfile`
11 - [ ] 2.2 測試本地映像檔建置
12
13 ## 3. Kubernetes 部署清單
14
15 - [ ] 3.1 撰寫 Service 清單
16 - [ ] 3.2 撰寫 Deployment 清單，並加入 `lifecycle.preStop` hook 與 `sleep 2`
17 - [ ] 3.3 驗證 Manifests 語法正確性
✦ 所有產出物均已建立。我將檢查最終狀態。
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Shell openspec status --change &amp;#34;graceful-shutdown-go-server&amp;#34; │
│ │
│ ... first 2 lines hidden (Ctrl&amp;#43;O to show) ... │
│ Progress: 4/4 artifacts complete │
│ │
│ [x] proposal │
│ [x] design │
│ [x] specs │
│ [x] tasks │
│ │
│ All artifacts complete! │
│ Process Group PGID: 5950 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ 所有 OpenSpec 產出物已準備就緒！
- 變更名稱: graceful-shutdown-go-server
- 位置: openspec/changes/graceful-shutdown-go-server/
- 已建立產出物:
- proposal.md: 概述為何需要此變更。
- design.md: 詳述技術決策（訊號處理、K8s Hook、多階段建置）。
- specs/graceful-shutdown-server/spec.md: 定義功能需求與測試情境。
- tasks.md: 實作檢查清單。
準備好開始實作了！
您可以輸入 /opsx:apply 或直接要求我開始執行任務。&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h3&gt;Step 5 — 觸發 &lt;code&gt;/init&lt;/code&gt;(關鍵卡點 1)&lt;span class="hx:absolute hx:-mt-20" id="step-5--觸發-init關鍵卡點-1"&gt;&lt;/span&gt;
&lt;a href="#step-5--%e8%a7%b8%e7%99%bc-init%e9%97%9c%e9%8d%b5%e5%8d%a1%e9%bb%9e-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;這是第一個延遲發生的位置。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在 CLI 輸入:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/init&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;Gemini CLI 會將其展開為內建的長 prompt(以「You are an AI agent that brings the power of Gemini directly into the terminal&amp;hellip;」開頭),要求模型分析當前目錄並產生 GEMINI.md。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;預期觀察&lt;/strong&gt;:模型可能長時間停留在「Thinking&amp;hellip;」狀態而未呼叫任何工具。原 session 此處等了約 45 分鐘。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;建議在此設定計時器&lt;/strong&gt;,若超過 5 分鐘無任何輸出,記錄當下時間。&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Step 6 — Tool 執行間卡頓(關鍵卡點 2)&lt;span class="hx:absolute hx:-mt-20" id="step-6--tool-執行間卡頓關鍵卡點-2"&gt;&lt;/span&gt;
&lt;a href="#step-6--tool-%e5%9f%b7%e8%a1%8c%e9%96%93%e5%8d%a1%e9%a0%93%e9%97%9c%e9%8d%b5%e5%8d%a1%e9%bb%9e-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;不需輸入任何內容,此為自動發生。&lt;/p&gt;
&lt;p&gt;當 Gemini 終於開始動作後,會先 &lt;code&gt;list_directory .&lt;/code&gt;,然後嘗試 &lt;code&gt;list_directory openspec/specs&lt;/code&gt;。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;預期觀察&lt;/strong&gt;:這兩個 list_directory 呼叫之間可能再次出現長時間靜默。原 session 此處等了約 31 分鐘。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3&gt;Step 7 — 驗證 CLI 是否還活著&lt;span class="hx:absolute hx:-mt-20" id="step-7--驗證-cli-是否還活著"&gt;&lt;/span&gt;
&lt;a href="#step-7--%e9%a9%97%e8%ad%89-cli-%e6%98%af%e5%90%a6%e9%82%84%e6%b4%bb%e8%91%97" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;若你想確認 CLI 是否真的卡住而非完成,可在另一個視窗或等到回到 prompt 後輸入:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;hello?&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;觀察重點與紀錄&lt;span class="hx:absolute hx:-mt-20" id="觀察重點與紀錄"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%80%e5%af%9f%e9%87%8d%e9%bb%9e%e8%88%87%e7%b4%80%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;建議用一個簡單表格記錄每次重現的結果:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;步驟&lt;/th&gt;
&lt;th&gt;開始時間&lt;/th&gt;
&lt;th&gt;結束時間&lt;/th&gt;
&lt;th&gt;耗時&lt;/th&gt;
&lt;th&gt;備註&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Step 1-4(openspec 流程)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Step 5(&lt;code&gt;/init&lt;/code&gt; 送出 → 第一個 tool call)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;卡點 1&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Step 6(list root → list specs)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;卡點 2&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Step 5-6 總和(&lt;code&gt;/init&lt;/code&gt; → 寫完 GEMINI.md)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;對照組建議(強烈建議跑)&lt;span class="hx:absolute hx:-mt-20" id="對照組建議強烈建議跑"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%8d%e7%85%a7%e7%b5%84%e5%bb%ba%e8%ad%b0%e5%bc%b7%e7%83%88%e5%bb%ba%e8%ad%b0%e8%b7%91" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;為了確認延遲是否與 openspec 流程或累積 context 有關,建議再做以下對照:&lt;/p&gt;
&lt;h3&gt;對照組 A:空目錄獨立 &lt;code&gt;/init&lt;/code&gt;&lt;span class="hx:absolute hx:-mt-20" id="對照組-a空目錄獨立-init"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%8d%e7%85%a7%e7%b5%84-a%e7%a9%ba%e7%9b%ae%e9%8c%84%e7%8d%a8%e7%ab%8b-init" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;開新空目錄 &lt;code&gt;mkdir /tmp/clean-test &amp;amp;&amp;amp; cd /tmp/clean-test&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;啟動 &lt;code&gt;gemini --debug&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;直接執行 &lt;code&gt;/init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;記錄完成時間&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;若 A 在數分鐘內完成,而原情境需 1 小時,可確認延遲與「已有檔案的目錄 + 累積 context」相關。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;對照組 B:同目錄但全新 session&lt;span class="hx:absolute hx:-mt-20" id="對照組-b同目錄但全新-session"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%8d%e7%85%a7%e7%b5%84-b%e5%90%8c%e7%9b%ae%e9%8c%84%e4%bd%86%e5%85%a8%e6%96%b0-session" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;在原本的 &lt;code&gt;graceful-shutdown&lt;/code&gt; 目錄(已含 openspec 產物)&lt;/li&gt;
&lt;li&gt;開新 session(關閉舊的、重開 &lt;code&gt;gemini&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;直接執行 &lt;code&gt;/init&lt;/code&gt;,跳過 Step 1-4&lt;/li&gt;
&lt;li&gt;記錄完成時間&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;若 B 比原情境快很多,可確認延遲與「同 session 內累積的 context」相關。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;蒐集的資訊(回報 bug 時附上)&lt;span class="hx:absolute hx:-mt-20" id="蒐集的資訊回報-bug-時附上"&gt;&lt;/span&gt;
&lt;a href="#%e8%92%90%e9%9b%86%e7%9a%84%e8%b3%87%e8%a8%8a%e5%9b%9e%e5%a0%b1-bug-%e6%99%82%e9%99%84%e4%b8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;執行 &lt;code&gt;/about&lt;/code&gt; 取得:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CLI Version&lt;/li&gt;
&lt;li&gt;Git Commit&lt;/li&gt;
&lt;li&gt;Model(特別注意是不是 Auto / preview 模型)&lt;/li&gt;
&lt;li&gt;Auth Method&lt;/li&gt;
&lt;li&gt;Tier(免費/付費)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;並一併附上 &lt;code&gt;/tmp/gemini-repro.log&lt;/code&gt; 的 debug log。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;啟動 log 已透露的線索&lt;span class="hx:absolute hx:-mt-20" id="啟動-log-已透露的線索"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%9f%e5%8b%95-log-%e5%b7%b2%e9%80%8f%e9%9c%b2%e7%9a%84%e7%b7%9a%e7%b4%a2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;第一次嘗試啟動時,雖然指令寫法錯誤導致 CLI 立即退出,但啟動階段的 debug log 已透露幾個與本案延遲可能相關的訊息,值得在後續分析時納入考量:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Ripgrep is not available. Falling back to GrepTool.&lt;/code&gt;&lt;/strong&gt;
此版本未安裝 ripgrep,搜尋將使用較慢的內建 GrepTool。&lt;code&gt;/init&lt;/code&gt; 需要掃描整個專案目錄,這雖不至於造成小時級延遲,但會放大整體耗時。
v0.40 開始已將 ripgrep bundle 進 SEA 版本,以 npm 安裝可能未包含,可考慮另外安裝 &lt;code&gt;ripgrep&lt;/code&gt; 套件。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Experiment flag &lt;code&gt;45773134 = 300&lt;/code&gt;、&lt;code&gt;45773135 = 600&lt;/code&gt;&lt;/strong&gt;
數值單位推測為秒,對應 5 分鐘和 10 分鐘,符合常見的 timeout / retry backoff 閾值。若後續 debug log 出現的延遲區間是 5/10 分鐘的倍數,很可能就是這兩個 flag 控制的 retry 行為。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Experiment flag &lt;code&gt;45740200&lt;/code&gt; 的官方公告&lt;/strong&gt;
原文(節錄):「We are adding more robust detection of policy-violating use cases and changing how we prioritize traffic. This may result in higher capacity-related errors during periods of high traffic.」
說明 Google 近期正在調整 traffic 優先順序,&lt;strong&gt;確實可能讓 capacity-related error 增加&lt;/strong&gt;。這與「卡點期間其實是 backend 排隊或被節流」的推測相符。
公告連結:https://goo.gle/geminicli-updates&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;已知相關 issues(供參考)&lt;span class="hx:absolute hx:-mt-20" id="已知相關-issues供參考"&gt;&lt;/span&gt;
&lt;a href="#%e5%b7%b2%e7%9f%a5%e7%9b%b8%e9%97%9c-issues%e4%be%9b%e5%8f%83%e8%80%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;以下三個 issue 與本案症狀高度相符,&lt;strong&gt;截至 v0.40.1(本文件撰寫時的最新 stable)仍為 open&lt;/strong&gt;,在 v0.39 ~ v0.40 的 changelog 中均未見對應 fix:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/22141"target="_blank" rel="noopener"&gt;google-gemini/gemini-cli#22141&lt;/a&gt; — Gemini CLI becomes extremely slow (1+ HOURS) / stuck during small code-edit tasks&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/17442"target="_blank" rel="noopener"&gt;google-gemini/gemini-cli#17442&lt;/a&gt; — CLI Agent Intermittent Long Loading Times/Hangs During Tool Execution&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/26126"target="_blank" rel="noopener"&gt;google-gemini/gemini-cli#26126&lt;/a&gt; — Stuck at &amp;ldquo;Thinking&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;另一個與 &lt;code&gt;/init&lt;/code&gt; 直接相關但症狀不同的 issue(僅供參考):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/6984"target="_blank" rel="noopener"&gt;google-gemini/gemini-cli#6984&lt;/a&gt; — &lt;code&gt;/init&lt;/code&gt; command hangs at &amp;ldquo;Concluding the Process&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Ubuntu XFCE 安裝繁體中文輸入法 &amp; 設定左 Shift 切換中英文</title><link>https://blog.kubeantony.com/archive/misc/ubuntu-xfce-%E5%AE%89%E8%A3%9D%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E8%BC%B8%E5%85%A5%E6%B3%95-%E8%A8%AD%E5%AE%9A%E5%B7%A6-shift-%E5%88%87%E6%8F%9B%E4%B8%AD%E8%8B%B1%E6%96%87/</link><pubDate>Mon, 04 May 2026 12:46:10 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/ubuntu-xfce-%E5%AE%89%E8%A3%9D%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E8%BC%B8%E5%85%A5%E6%B3%95-%E8%A8%AD%E5%AE%9A%E5%B7%A6-shift-%E5%88%87%E6%8F%9B%E4%B8%AD%E8%8B%B1%E6%96%87/</guid><description>
&lt;h2&gt;環境&lt;span class="hx:absolute hx:-mt-20" id="環境"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;作業系統&lt;/strong&gt;:Ubuntu Desktop&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;桌面環境&lt;/strong&gt;:XFCE&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;連線方式&lt;/strong&gt;:透過 RDP 連入(xrdp)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;輸入法框架&lt;/strong&gt;:IBus&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;目標&lt;/strong&gt;:使用 Chewing(新酷音)輸入繁體中文,並用&lt;strong&gt;單按左 Shift&lt;/strong&gt; 切換中英文&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;本文件適用於&lt;strong&gt;已使用 IBus 框架&lt;/strong&gt;的 XFCE 環境。如果你的桌面是 GNOME,設定方式會不同;GNOME Shell 不接受純 modifier 鍵當切換熱鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;步驟一:確認環境&lt;span class="hx:absolute hx:-mt-20" id="步驟一確認環境"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%80%e7%a2%ba%e8%aa%8d%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1-1 確認桌面環境&lt;span class="hx:absolute hx:-mt-20" id="1-1-確認桌面環境"&gt;&lt;/span&gt;
&lt;a href="#1-1-%e7%a2%ba%e8%aa%8d%e6%a1%8c%e9%9d%a2%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$XDG_CURRENT_DESKTOP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$DESKTOP_SESSION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;XFCE
xfce&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1-2 確認目前的輸入法框架&lt;span class="hx:absolute hx:-mt-20" id="1-2-確認目前的輸入法框架"&gt;&lt;/span&gt;
&lt;a href="#1-2-%e7%a2%ba%e8%aa%8d%e7%9b%ae%e5%89%8d%e7%9a%84%e8%bc%b8%e5%85%a5%e6%b3%95%e6%a1%86%e6%9e%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$GTK_IM_MODULE&lt;/span&gt; &lt;span class="nv"&gt;$QT_IM_MODULE&lt;/span&gt; &lt;span class="nv"&gt;$XMODIFIERS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ibus ibus @im=ibus&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1-3 確認 IBus daemon 正常運作&lt;span class="hx:absolute hx:-mt-20" id="1-3-確認-ibus-daemon-正常運作"&gt;&lt;/span&gt;
&lt;a href="#1-3-%e7%a2%ba%e8%aa%8d-ibus-daemon-%e6%ad%a3%e5%b8%b8%e9%81%8b%e4%bd%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ps aux &lt;span class="p"&gt;|&lt;/span&gt; grep ibus-daemon&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出(關鍵在 &lt;code&gt;--xim&lt;/code&gt; 參數要存在):&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;bigred 5010 0.1 0.0 457360 8652 ? Ssl 20:33 0:00 /usr/bin/ibus-daemon --daemonize --xim&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟二:確認 / 安裝中文輸入法引擎&lt;span class="hx:absolute hx:-mt-20" id="步驟二確認--安裝中文輸入法引擎"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%8c%e7%a2%ba%e8%aa%8d--%e5%ae%89%e8%a3%9d%e4%b8%ad%e6%96%87%e8%bc%b8%e5%85%a5%e6%b3%95%e5%bc%95%e6%93%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;2-1 確認系統有 Chewing 引擎&lt;span class="hx:absolute hx:-mt-20" id="2-1-確認系統有-chewing-引擎"&gt;&lt;/span&gt;
&lt;a href="#2-1-%e7%a2%ba%e8%aa%8d%e7%b3%bb%e7%b5%b1%e6%9c%89-chewing-%e5%bc%95%e6%93%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus list-engine &lt;span class="p"&gt;|&lt;/span&gt; grep -i -E &lt;span class="s2"&gt;&amp;#34;chewing|pinyin|bopomofo|rime|cangjie&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出(看到 &lt;code&gt;chewing - Chewing&lt;/code&gt; 即代表已安裝):&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;language: Pinyin
chewing - Chewing
language: Tatar, Crimean
xkb:ua:crh_f:crh - Crimean Tatar (Turkish F)
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2-2 若沒有 Chewing,執行以下指令安裝&lt;span class="hx:absolute hx:-mt-20" id="2-2-若沒有-chewing執行以下指令安裝"&gt;&lt;/span&gt;
&lt;a href="#2-2-%e8%8b%a5%e6%b2%92%e6%9c%89-chewing%e5%9f%b7%e8%a1%8c%e4%bb%a5%e4%b8%8b%e6%8c%87%e4%bb%a4%e5%ae%89%e8%a3%9d" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install ibus-chewing
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟三:確認輸入法清單包含 English 與 Chewing&lt;span class="hx:absolute hx:-mt-20" id="步驟三確認輸入法清單包含-english-與-chewing"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%89%e7%a2%ba%e8%aa%8d%e8%bc%b8%e5%85%a5%e6%b3%95%e6%b8%85%e5%96%ae%e5%8c%85%e5%90%ab-english-%e8%88%87-chewing" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gsettings get org.freedesktop.ibus.general preload-engines&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[&amp;#39;xkb:us::eng&amp;#39;, &amp;#39;chewing&amp;#39;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果清單不對,用以下指令設定:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gsettings &lt;span class="nb"&gt;set&lt;/span&gt; org.freedesktop.ibus.general preload-engines &lt;span class="s2"&gt;&amp;#34;[&amp;#39;xkb:us::eng&amp;#39;, &amp;#39;chewing&amp;#39;]&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟四:設定環境變數(關鍵步驟)⭐&lt;span class="hx:absolute hx:-mt-20" id="步驟四設定環境變數關鍵步驟"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e5%9b%9b%e8%a8%ad%e5%ae%9a%e7%92%b0%e5%a2%83%e8%ae%8a%e6%95%b8%e9%97%9c%e9%8d%b5%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;這是讓設定能&lt;strong&gt;穩定生效&lt;/strong&gt;的關鍵。即使目前 &lt;code&gt;echo $GTK_IM_MODULE&lt;/code&gt; 顯示為 &lt;code&gt;ibus&lt;/code&gt;,也要把它寫入 &lt;code&gt;~/.xprofile&lt;/code&gt;,確保 XFCE session 啟動時一定會載入。&lt;/p&gt;
&lt;h3&gt;4-1 檢查目前狀態&lt;span class="hx:absolute hx:-mt-20" id="4-1-檢查目前狀態"&gt;&lt;/span&gt;
&lt;a href="#4-1-%e6%aa%a2%e6%9f%a5%e7%9b%ae%e5%89%8d%e7%8b%80%e6%85%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat ~/.xprofile 2&amp;gt;/dev/null
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat ~/.profile 2&amp;gt;/dev/null &lt;span class="p"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;&amp;#34;GTK_IM_MODULE|QT_IM_MODULE|XMODIFIERS&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果兩個指令都沒輸出,代表環境變數沒寫在使用者層級的設定檔。雖然系統可能有臨時注入,但不夠穩定,要明確寫入。&lt;/p&gt;
&lt;h3&gt;4-2 寫入 ~/.xprofile&lt;span class="hx:absolute hx:-mt-20" id="4-2-寫入-xprofile"&gt;&lt;/span&gt;
&lt;a href="#4-2-%e5%af%ab%e5%85%a5-xprofile" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &amp;gt; ~/.xprofile &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export GTK_IM_MODULE=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export QT_IM_MODULE=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export XMODIFIERS=@im=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;4-3 確認檔案內容&lt;span class="hx:absolute hx:-mt-20" id="4-3-確認檔案內容"&gt;&lt;/span&gt;
&lt;a href="#4-3-%e7%a2%ba%e8%aa%8d%e6%aa%94%e6%a1%88%e5%85%a7%e5%ae%b9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat ~/.xprofile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟五:設定左 Shift 為切換熱鍵&lt;span class="hx:absolute hx:-mt-20" id="步驟五設定左-shift-為切換熱鍵"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%94%e8%a8%ad%e5%ae%9a%e5%b7%a6-shift-%e7%82%ba%e5%88%87%e6%8f%9b%e7%86%b1%e9%8d%b5" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;5-1 開啟 IBus 設定&lt;span class="hx:absolute hx:-mt-20" id="5-1-開啟-ibus-設定"&gt;&lt;/span&gt;
&lt;a href="#5-1-%e9%96%8b%e5%95%9f-ibus-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus-setup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;5-2 設定 Next input method 為 Shift_L&lt;span class="hx:absolute hx:-mt-20" id="5-2-設定-next-input-method-為-shift_l"&gt;&lt;/span&gt;
&lt;a href="#5-2-%e8%a8%ad%e5%ae%9a-next-input-method-%e7%82%ba-shift_l" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 &lt;strong&gt;General&lt;/strong&gt; 分頁:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;找到 &lt;strong&gt;Keyboard Shortcuts&lt;/strong&gt; 區塊的 &lt;strong&gt;Next input method&lt;/strong&gt; 欄位&lt;/li&gt;
&lt;li&gt;點右側的 &lt;code&gt;...&lt;/code&gt; 按鈕開啟設定視窗&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;刪除清單裡所有現有的快捷鍵&lt;/strong&gt;(例如 &lt;code&gt;&amp;lt;Shift&amp;gt;space&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;在 &lt;strong&gt;Key code&lt;/strong&gt; 欄位手動輸入:
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Shift_L&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Modifiers 區的所有勾選都不要勾&lt;/strong&gt;(Shift / Ctrl / Alt / Super 全部不勾)&lt;/li&gt;
&lt;li&gt;點 &lt;strong&gt;Add&lt;/strong&gt;,再點 &lt;strong&gt;OK&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;設定完成後主畫面的 Next input method 欄位應顯示為:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Shift_L&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意:Modifiers 一個都不能勾。如果勾了 &lt;code&gt;&amp;lt;Shift&amp;gt;&lt;/code&gt; 變成 modifier 用,或是寫成組合鍵(例如 &lt;code&gt;&amp;lt;Control&amp;gt;Shift_L&lt;/code&gt;),都會導致切換行為異常。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;5-3 重啟 IBus&lt;span class="hx:absolute hx:-mt-20" id="5-3-重啟-ibus"&gt;&lt;/span&gt;
&lt;a href="#5-3-%e9%87%8d%e5%95%9f-ibus" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟六:測試&lt;span class="hx:absolute hx:-mt-20" id="步驟六測試"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e5%85%ad%e6%b8%ac%e8%a9%a6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;開啟任一支援文字輸入的應用程式(文字編輯器、瀏覽器網址列等),按下&lt;strong&gt;左 Shift 鍵&lt;/strong&gt;,應該會看到:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;右上角(或工作列上)的 IBus 圖示在 &lt;code&gt;EN&lt;/code&gt; 與中文圖示之間切換&lt;/li&gt;
&lt;li&gt;切到中文模式後,可正常用注音輸入繁體中文&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shift + 字母鍵(如 Shift+a)&lt;/strong&gt; 仍然正常輸出大寫字母,&lt;strong&gt;不會誤觸切換&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;完整指令速查&lt;span class="hx:absolute hx:-mt-20" id="完整指令速查"&gt;&lt;/span&gt;
&lt;a href="#%e5%ae%8c%e6%95%b4%e6%8c%87%e4%bb%a4%e9%80%9f%e6%9f%a5" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;整個流程可以濃縮成以下幾步:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 1. 確認環境&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$XDG_CURRENT_DESKTOP&lt;/span&gt; &lt;span class="c1"&gt;# 應為 XFCE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$GTK_IM_MODULE&lt;/span&gt; &lt;span class="nv"&gt;$QT_IM_MODULE&lt;/span&gt; &lt;span class="nv"&gt;$XMODIFIERS&lt;/span&gt; &lt;span class="c1"&gt;# 應為 ibus ibus @im=ibus&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ps aux &lt;span class="p"&gt;|&lt;/span&gt; grep ibus-daemon &lt;span class="c1"&gt;# 確認有 --xim&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 2. 確認引擎&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus list-engine &lt;span class="p"&gt;|&lt;/span&gt; grep -i chewing &lt;span class="c1"&gt;# 應看到 chewing - Chewing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gsettings get org.freedesktop.ibus.general preload-engines &lt;span class="c1"&gt;# 應為 [&amp;#39;xkb:us::eng&amp;#39;, &amp;#39;chewing&amp;#39;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 3. 寫入環境變數(關鍵)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &amp;gt; ~/.xprofile &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export GTK_IM_MODULE=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export QT_IM_MODULE=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export XMODIFIERS=@im=ibus
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 4. 開設定 → Next input method 設成 Shift_L (Modifiers 全不勾)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus-setup
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 5. 重啟 IBus&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ibus restart&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;故障排除&lt;span class="hx:absolute hx:-mt-20" id="故障排除"&gt;&lt;/span&gt;
&lt;a href="#%e6%95%85%e9%9a%9c%e6%8e%92%e9%99%a4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;症狀&lt;/th&gt;
&lt;th&gt;可能原因&lt;/th&gt;
&lt;th&gt;解法&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;按 Shift 完全沒反應&lt;/td&gt;
&lt;td&gt;環境變數未生效&lt;/td&gt;
&lt;td&gt;確認 &lt;code&gt;~/.xprofile&lt;/code&gt; 已寫入,登出再登入 RDP session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;按任何鍵都會觸發切換&lt;/td&gt;
&lt;td&gt;Modifiers 勾選了 &lt;code&gt;&amp;lt;Shift&amp;gt;&lt;/code&gt;,或 IBus 把 Shift_L 當 modifier 處理&lt;/td&gt;
&lt;td&gt;重新進 ibus-setup,確認 Modifiers 完全沒勾&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;切換到中文後切不回英文&lt;/td&gt;
&lt;td&gt;快捷鍵設成 &lt;code&gt;&amp;lt;Control&amp;gt;Shift_L&lt;/code&gt; 等 modifier 組合,IBus 對這類組合切換不穩定&lt;/td&gt;
&lt;td&gt;改回單獨 &lt;code&gt;Shift_L&lt;/code&gt;,或改用 &lt;code&gt;&amp;lt;Shift&amp;gt;space&lt;/code&gt;、&lt;code&gt;&amp;lt;Super&amp;gt;space&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;螢幕中央跳出選單但右上角不變&lt;/td&gt;
&lt;td&gt;IBus 與桌面環境通訊不同步&lt;/td&gt;
&lt;td&gt;重啟 IBus(&lt;code&gt;ibus restart&lt;/code&gt;),必要時重新登入 session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shift+字母 變成切換而不是大寫&lt;/td&gt;
&lt;td&gt;同上(modifier 處理錯誤)&lt;/td&gt;
&lt;td&gt;重新檢查 ibus-setup 的設定&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;備註:為什麼 XFCE 可以這樣設,GNOME 不行&lt;span class="hx:absolute hx:-mt-20" id="備註為什麼-xfce-可以這樣設gnome-不行"&gt;&lt;/span&gt;
&lt;a href="#%e5%82%99%e8%a8%bb%e7%82%ba%e4%bb%80%e9%ba%bc-xfce-%e5%8f%af%e4%bb%a5%e9%80%99%e6%a8%a3%e8%a8%adgnome-%e4%b8%8d%e8%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GNOME Shell&lt;/strong&gt; 會強制攔截輸入法熱鍵,並要求快捷鍵至少包含一個非 modifier 鍵,因此&lt;strong&gt;單按 Shift 在 GNOME 上做不到&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XFCE&lt;/strong&gt; 不會攔截熱鍵,IBus 可以完整接管,所以單按 Shift_L 切換才有機會穩定運作。&lt;/li&gt;
&lt;li&gt;如果一定要在 GNOME 上實現單按 Shift 切換,需要改用 &lt;strong&gt;Fcitx5&lt;/strong&gt; 框架(它自己接管熱鍵處理,可繞過 GNOME 的限制)。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>在 Alpine Linux 上修復 Gemini CLI Segfault</title><link>https://blog.kubeantony.com/archive/container/%E5%9C%A8-alpine-linux-%E4%B8%8A%E4%BF%AE%E5%BE%A9-gemini-cli-segfault/</link><pubDate>Mon, 04 May 2026 10:10:44 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/%E5%9C%A8-alpine-linux-%E4%B8%8A%E4%BF%AE%E5%BE%A9-gemini-cli-segfault/</guid><description>
&lt;blockquote&gt;
&lt;p&gt;環境:Alpine Linux 3.23、x86_64、Node.js(apk 套件版)
症狀:Gemini CLI 在互動模式下 thinking 後直接退出,看似當機卻沒錯誤訊息
解法:11 行 C code 的 LD_PRELOAD shim,補上 musl 缺少的 2 個 glibc 符號&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;TL;DR(只想看解法的請從這裡開始)&lt;span class="hx:absolute hx:-mt-20" id="tldr只想看解法的請從這裡開始"&gt;&lt;/span&gt;
&lt;a href="#tldr%e5%8f%aa%e6%83%b3%e7%9c%8b%e8%a7%a3%e6%b3%95%e7%9a%84%e8%ab%8b%e5%be%9e%e9%80%99%e8%a3%a1%e9%96%8b%e5%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;如果你已經確認是同樣問題,直接跳到 &lt;a
href="#%e5%ae%8c%e6%95%b4%e4%bf%ae%e5%be%a9%e6%ad%a5%e9%a9%9f"&gt;完整修復步驟&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;如果想了解問題定位過程,請從 &lt;a
href="#%e7%97%87%e7%8b%80"&gt;症狀&lt;/a&gt; 開始讀。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;症狀&lt;span class="hx:absolute hx:-mt-20" id="症狀"&gt;&lt;/span&gt;
&lt;a href="#%e7%97%87%e7%8b%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在 Alpine Linux 上用 &lt;code&gt;apk add nodejs npm&lt;/code&gt; 裝好 Node 後,用 npm 安裝 Gemini CLI:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;npm install -g @google/gemini-cli&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;啟動互動模式並嘗試讓 Gemini 執行 shell 指令:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gemini&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;輸入任何會觸發 shell tool 的 prompt,例如:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;請執行 shell 指令: openspec new change test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Gemini 顯示「Thinking&amp;hellip;」幾秒後,直接退回 shell prompt,沒有任何錯誤訊息&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;更詭異的:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gemini -p &amp;quot;echo hello&amp;quot;&lt;/code&gt;(headless 模式)&lt;strong&gt;不會 crash&lt;/strong&gt;,但會出現 &lt;code&gt;Tool &amp;quot;run_shell_command&amp;quot; not found&lt;/code&gt; 警告&lt;/li&gt;
&lt;li&gt;互動模式才 crash,且每次都 crash&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;除錯過程&lt;span class="hx:absolute hx:-mt-20" id="除錯過程"&gt;&lt;/span&gt;
&lt;a href="#%e9%99%a4%e9%8c%af%e9%81%8e%e7%a8%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Step 1:啟用 core dump&lt;span class="hx:absolute hx:-mt-20" id="step-1啟用-core-dump"&gt;&lt;/span&gt;
&lt;a href="#step-1%e5%95%9f%e7%94%a8-core-dump" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Gemini crash 時什麼錯誤訊息都沒有,所以第一步是讓系統在 crash 時把記憶體狀態完整保存下來,後續才能分析。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 允許 core dump 沒有大小限制&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;ulimit&lt;/span&gt; -c unlimited
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定 core dump 寫到 /tmp,檔名包含程序名跟 PID&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sysctl -w kernel.core_pattern&lt;span class="o"&gt;=&lt;/span&gt;/tmp/core.%e.%p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意:&lt;code&gt;ulimit -c&lt;/code&gt; 只在當前 shell 有效。如果開新 terminal 要重設一次。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Step 2:重現 crash 並確認 core dump 有產生&lt;span class="hx:absolute hx:-mt-20" id="step-2重現-crash-並確認-core-dump-有產生"&gt;&lt;/span&gt;
&lt;a href="#step-2%e9%87%8d%e7%8f%be-crash-%e4%b8%a6%e7%a2%ba%e8%aa%8d-core-dump-%e6%9c%89%e7%94%a2%e7%94%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gemini&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;進去後輸入會觸發 crash 的 prompt(任何要跑 shell 的都行):&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;請執行 shell 指令: ls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;等它 thinking 後直接退出,然後檢查:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ls -la /tmp/core.* 2&amp;gt;/dev/null
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-rw------- &lt;span class="m"&gt;1&lt;/span&gt; bigred bigred &lt;span class="m"&gt;877506560&lt;/span&gt; May &lt;span class="m"&gt;4&lt;/span&gt; 17:22 /tmp/core.MainThread.12320&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;看到一個 &lt;strong&gt;877 MB 的 core dump&lt;/strong&gt;,程序名為 &lt;code&gt;MainThread&lt;/code&gt;(Node.js 22+ 對 main thread 的命名)。&lt;/p&gt;
&lt;p&gt;這個 core dump 確認了兩件事:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Crash 是真的 SIGSEGV&lt;/strong&gt;(系統有寫 core dump,代表是異常終止)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;記憶體用量正常&lt;/strong&gt;(877 MB 對 Node 程式不算大,排除記憶體不足)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Step 3:從 core dump 找出載入的 native modules&lt;span class="hx:absolute hx:-mt-20" id="step-3從-core-dump-找出載入的-native-modules"&gt;&lt;/span&gt;
&lt;a href="#step-3%e5%be%9e-core-dump-%e6%89%be%e5%87%ba%e8%bc%89%e5%85%a5%e7%9a%84-native-modules" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;.node&lt;/code&gt; 檔案是 Node.js 的 native binding(C++ 編譯的模組)。crash 多半發生在這類模組,所以先列出 crash 當下載入了哪些:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ readelf -n /tmp/core.MainThread.12320 2&amp;gt;/dev/null &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;\.node&lt;/span&gt;$&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.../node_modules/@github/keytar/build/Release/keytar.node
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.../node_modules/@lydell/node-pty-linux-x64/pty.node&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;兩個嫌疑犯:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;keytar.node&lt;/code&gt;(處理系統 keychain)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pty.node&lt;/code&gt;(處理 PTY,讓 Gemini 能跑 shell 指令)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Step 4:檢查 .node 檔案的符號解析&lt;span class="hx:absolute hx:-mt-20" id="step-4檢查-node-檔案的符號解析"&gt;&lt;/span&gt;
&lt;a href="#step-4%e6%aa%a2%e6%9f%a5-node-%e6%aa%94%e6%a1%88%e7%9a%84%e7%ac%a6%e8%99%9f%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ldd /opt/node-musl/lib/node_modules/@google/gemini-cli/node_modules/@github/keytar/build/Release/keytar.node
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /lib/ld-musl-x86_64.so.1 &lt;span class="o"&gt;(&lt;/span&gt;0x7feffb852000&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; libsecret-1.so.0 &lt;span class="o"&gt;=&lt;/span&gt;&amp;gt; /usr/lib/libsecret-1.so.0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; libglib-2.0.so.0 &lt;span class="o"&gt;=&lt;/span&gt;&amp;gt; /usr/lib/libglib-2.0.so.0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# 沒有 &amp;#34;symbol not found&amp;#34; → keytar 沒問題&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ldd /opt/node-musl/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty-linux-x64/pty.node
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /lib/ld-musl-x86_64.so.1 &lt;span class="o"&gt;(&lt;/span&gt;0x7fd30e512000&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; libutil.so.1 &lt;span class="o"&gt;=&lt;/span&gt;&amp;gt; /lib/ld-musl-x86_64.so.1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Error relocating .../pty.node: napi_call_threadsafe_function: symbol not found
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Error relocating .../pty.node: napi_get_cb_info: symbol not found
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Error relocating .../pty.node: napi_create_object: symbol not found
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Error relocating .../pty.node: __asprintf_chk: symbol not found
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Error relocating .../pty.node: fcntl64: symbol not found
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;... &lt;span class="o"&gt;(&lt;/span&gt;40+ 個 symbol not found&lt;span class="o"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;找到嫌疑犯&lt;/strong&gt;:&lt;code&gt;pty.node&lt;/code&gt; 有 40 多個 symbol 解析失敗。&lt;/p&gt;
&lt;h3&gt;Step 5:辨識真正的「致命」符號&lt;span class="hx:absolute hx:-mt-20" id="step-5辨識真正的致命符號"&gt;&lt;/span&gt;
&lt;a href="#step-5%e8%be%a8%e8%ad%98%e7%9c%9f%e6%ad%a3%e7%9a%84%e8%87%b4%e5%91%bd%e7%ac%a6%e8%99%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;過濾掉 N-API 相關的(那些是 ldd 假警報,實際 dlopen 時會從 node binary 解析):&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ldd .../pty.node 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;symbol not found&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -v napi_
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;__asprintf_chk
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;fcntl64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;只缺這兩個 glibc 符號&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;__asprintf_chk&lt;/code&gt;:glibc &lt;code&gt;_FORTIFY_SOURCE&lt;/code&gt; 提供的硬化版 asprintf&lt;/li&gt;
&lt;li&gt;&lt;code&gt;fcntl64&lt;/code&gt;:glibc 32-bit 系統用的 64-bit file offset 版 fcntl(x86_64 上等同 &lt;code&gt;fcntl&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;兩者 musl libc 都沒提供。&lt;/p&gt;
&lt;h3&gt;Step 6:確認 gcompat 也沒提供這兩個符號&lt;span class="hx:absolute hx:-mt-20" id="step-6確認-gcompat-也沒提供這兩個符號"&gt;&lt;/span&gt;
&lt;a href="#step-6%e7%a2%ba%e8%aa%8d-gcompat-%e4%b9%9f%e6%b2%92%e6%8f%90%e4%be%9b%e9%80%99%e5%85%a9%e5%80%8b%e7%ac%a6%e8%99%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ sudo apk info gcompat &lt;span class="p"&gt;|&lt;/span&gt; head -3
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gcompat-1.1.0-r4 description:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;GNU C Library compatibility layer &lt;span class="k"&gt;for&lt;/span&gt; musl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ nm -D /usr/lib/libgcompat.so.0 &lt;span class="p"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;&amp;#34;asprintf|fcntl&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# (空)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;連最新版 gcompat(已是最新 1.1.0-r4)都沒實作這兩個。&lt;/p&gt;
&lt;h3&gt;Step 7:確認 N-API 那 40 多個是假警報&lt;span class="hx:absolute hx:-mt-20" id="step-7確認-n-api-那-40-多個是假警報"&gt;&lt;/span&gt;
&lt;a href="#step-7%e7%a2%ba%e8%aa%8d-n-api-%e9%82%a3-40-%e5%a4%9a%e5%80%8b%e6%98%af%e5%81%87%e8%ad%a6%e5%a0%b1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;驗證 Node binary 真的有 export N-API 符號:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ nm -D /opt/node-musl/bin/node &lt;span class="p"&gt;|&lt;/span&gt; grep napi_call_threadsafe_function
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0000000000d24590 T napi_call_threadsafe_function&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Node binary 確實 export 了 N-API 符號&lt;/strong&gt;(&lt;code&gt;T&lt;/code&gt; 代表 exported)。&lt;/p&gt;
&lt;p&gt;ldd 顯示 napi_* not found 的原因是:&lt;code&gt;.node&lt;/code&gt; 檔案不是設計來直接執行的,ldd 的 NEEDED libraries 列表裡沒有 node binary,所以找不到 N-API 符號。&lt;strong&gt;真正執行時是 &lt;code&gt;dlopen&lt;/code&gt; 從 node main process 動態解析,不會出問題&lt;/strong&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;根因分析&lt;span class="hx:absolute hx:-mt-20" id="根因分析"&gt;&lt;/span&gt;
&lt;a href="#%e6%a0%b9%e5%9b%a0%e5%88%86%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;用一個比喻說明&lt;span class="hx:absolute hx:-mt-20" id="用一個比喻說明"&gt;&lt;/span&gt;
&lt;a href="#%e7%94%a8%e4%b8%80%e5%80%8b%e6%af%94%e5%96%bb%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;想像 Linux 系統就像一個&lt;strong&gt;工具箱出租店&lt;/strong&gt;,租客(程式)上門時可以借各種工具來完成工作。&lt;/p&gt;
&lt;p&gt;不同 Linux 發行版的工具箱規格不同:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ubuntu / Debian / RHEL&lt;/strong&gt; 用「&lt;strong&gt;glibc 工具箱&lt;/strong&gt;」—— 工具齊全、型號繁多、體積大&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alpine&lt;/strong&gt; 用「&lt;strong&gt;musl 工具箱&lt;/strong&gt;」—— 精簡輕量、只放最常用的工具&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Gemini CLI 裡有一個關鍵零件叫 &lt;code&gt;pty.node&lt;/code&gt;(讓它能控制終端機),這個零件&lt;strong&gt;原本是給 Ubuntu 的 glibc 工具箱用的&lt;/strong&gt;,它預期能借到 42 種特定工具:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;其中 &lt;strong&gt;40 種&lt;/strong&gt;(N-API 工具)是「Gemini 自己帶來的」—— 不是跟工具箱借,所以沒問題 ✓&lt;/li&gt;
&lt;li&gt;剩下 &lt;strong&gt;2 種&lt;/strong&gt;(&lt;code&gt;__asprintf_chk&lt;/code&gt;、&lt;code&gt;fcntl64&lt;/code&gt;)&lt;strong&gt;只有 glibc 工具箱才有&lt;/strong&gt;,Alpine 的 musl 工具箱沒放這兩個 ✗&lt;/li&gt;
&lt;li&gt;連 Alpine 的「相容套件箱」(gcompat,號稱能模擬 glibc)也沒提供這兩個 ✗&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;結果&lt;/strong&gt;:&lt;code&gt;pty.node&lt;/code&gt; 載入到一半發現借不到工具,而 Gemini 對這個錯誤沒有處理好,&lt;strong&gt;整個程式直接當機&lt;/strong&gt;(SIGSEGV)。&lt;/p&gt;
&lt;p&gt;我們的修復就是&lt;strong&gt;自己做一個小工具盒(11 行 C code 的 shim),補上這兩個 musl 沒有的工具&lt;/strong&gt;,讓 &lt;code&gt;pty.node&lt;/code&gt; 能正常載入。&lt;/p&gt;
&lt;h3&gt;關鍵概念對照表&lt;span class="hx:absolute hx:-mt-20" id="關鍵概念對照表"&gt;&lt;/span&gt;
&lt;a href="#%e9%97%9c%e9%8d%b5%e6%a6%82%e5%bf%b5%e5%b0%8d%e7%85%a7%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;我用的詞&lt;/th&gt;
&lt;th&gt;實際技術名詞&lt;/th&gt;
&lt;th&gt;簡單解釋&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;工具箱&lt;/td&gt;
&lt;td&gt;C 標準函式庫(libc)&lt;/td&gt;
&lt;td&gt;Linux 系統最底層的函式庫,所有程式都會用到&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;glibc 工具箱&lt;/td&gt;
&lt;td&gt;glibc(GNU C Library)&lt;/td&gt;
&lt;td&gt;Ubuntu / Debian / RHEL 等主流發行版用的 libc,功能多&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;musl 工具箱&lt;/td&gt;
&lt;td&gt;musl libc&lt;/td&gt;
&lt;td&gt;Alpine 用的 libc,功能精簡、體積小&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;相容套件箱&lt;/td&gt;
&lt;td&gt;gcompat&lt;/td&gt;
&lt;td&gt;Alpine 提供的 glibc 相容層,但實作不完整&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;工具&lt;/td&gt;
&lt;td&gt;動態連結符號(symbol)&lt;/td&gt;
&lt;td&gt;程式執行時需要從 libc 借用的函式名稱&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;關鍵零件&lt;/td&gt;
&lt;td&gt;native binding(&lt;code&gt;.node&lt;/code&gt; 檔)&lt;/td&gt;
&lt;td&gt;用 C++ 編譯的 Node 模組,直接跟系統打交道&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;自製小工具盒&lt;/td&gt;
&lt;td&gt;LD_PRELOAD shim&lt;/td&gt;
&lt;td&gt;在程式啟動前先載入,補上缺失的函式&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;為什麼 headless 模式不會 crash,互動模式才會?&lt;span class="hx:absolute hx:-mt-20" id="為什麼-headless-模式不會-crash互動模式才會"&gt;&lt;/span&gt;
&lt;a href="#%e7%82%ba%e4%bb%80%e9%ba%bc-headless-%e6%a8%a1%e5%bc%8f%e4%b8%8d%e6%9c%83-crash%e4%ba%92%e5%8b%95%e6%a8%a1%e5%bc%8f%e6%89%8d%e6%9c%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;因為&lt;strong&gt;只有互動模式才會打開終端機&lt;/strong&gt;。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;互動模式&lt;/strong&gt;:Gemini 要給你聊天介面、要能執行 shell 指令、要能即時顯示輸出 → &lt;strong&gt;必須載入 &lt;code&gt;pty.node&lt;/code&gt; → 借不到工具 → 當機&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Headless 模式&lt;/strong&gt;(&lt;code&gt;gemini -p &amp;quot;...&amp;quot;&lt;/code&gt;):純文字進、純文字出,不需要終端機 → &lt;strong&gt;完全不載入 &lt;code&gt;pty.node&lt;/code&gt; → 沒事&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;這也解釋了為什麼之前那麼難找原因:headless 跟互動只差一個小開關,但內部走的路徑天差地別。&lt;/p&gt;
&lt;h3&gt;那 N-API 那 40 個錯誤訊息是什麼?&lt;span class="hx:absolute hx:-mt-20" id="那-n-api-那-40-個錯誤訊息是什麼"&gt;&lt;/span&gt;
&lt;a href="#%e9%82%a3-n-api-%e9%82%a3-40-%e5%80%8b%e9%8c%af%e8%aa%a4%e8%a8%8a%e6%81%af%e6%98%af%e4%bb%80%e9%ba%bc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;那是 &lt;code&gt;ldd&lt;/code&gt; 工具的「假警報」。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ldd&lt;/code&gt; 是設計來檢查「直接執行的程式」會借哪些工具,但 &lt;code&gt;pty.node&lt;/code&gt; 不是直接執行,而是被 Node 用另一種機制(&lt;code&gt;dlopen&lt;/code&gt;)動態載入。Node 載入時會把 N-API 那 40 個工具直接遞給 &lt;code&gt;pty.node&lt;/code&gt;,所以實際上不會缺。&lt;/p&gt;
&lt;p&gt;但 &lt;code&gt;ldd&lt;/code&gt; 不知道有這層機制,看到 &lt;code&gt;pty.node&lt;/code&gt; 沒明確標註「這 40 個工具會跟 Node 借」,就誤報成「缺 40 個符號」。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;所以實際上只缺 2 個 glibc 符號,不是 42 個&lt;/strong&gt;。這也是為什麼修復這麼簡單——只要補 2 個就好。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;完整修復步驟&lt;span class="hx:absolute hx:-mt-20" id="完整修復步驟"&gt;&lt;/span&gt;
&lt;a href="#%e5%ae%8c%e6%95%b4%e4%bf%ae%e5%be%a9%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;整個流程約 10 分鐘。&lt;/p&gt;
&lt;h3&gt;前置:確認你的環境符合條件&lt;span class="hx:absolute hx:-mt-20" id="前置確認你的環境符合條件"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e7%a2%ba%e8%aa%8d%e4%bd%a0%e7%9a%84%e7%92%b0%e5%a2%83%e7%ac%a6%e5%90%88%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ cat /etc/alpine-release
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;3.23.3
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ uname -m
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;x86_64
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認你的 Node 是 musl 編譯&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ldd &lt;span class="k"&gt;$(&lt;/span&gt;which node&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; head -1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /lib/ld-musl-x86_64.so.1 &lt;span class="o"&gt;(&lt;/span&gt;...&lt;span class="o"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果你不是 Alpine,或不是 musl Node,這篇修復可能不適用。&lt;/p&gt;
&lt;h3&gt;Step 1:換一個 Node.js binary(可選但推薦)&lt;span class="hx:absolute hx:-mt-20" id="step-1換一個-nodejs-binary可選但推薦"&gt;&lt;/span&gt;
&lt;a href="#step-1%e6%8f%9b%e4%b8%80%e5%80%8b-nodejs-binary%e5%8f%af%e9%81%b8%e4%bd%86%e6%8e%a8%e8%96%a6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Alpine 的 &lt;code&gt;apk add nodejs&lt;/code&gt; 是 Node 24,這個版本對某些 N-API 套件相容性差。換成 unofficial-builds 的 Node 22 LTS musl prebuild:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 下載&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;NODE_VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;v22.11.0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /tmp
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;wget https://unofficial-builds.nodejs.org/download/release/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;NODE_VERSION&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/node-&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;NODE_VERSION&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;-linux-x64-musl.tar.xz
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 解壓到 /opt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/node-musl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tar -xJf node-&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;NODE_VERSION&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;-linux-x64-musl.tar.xz -C /opt/node-musl --strip-components&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認 libstdc++ 已裝(unofficial musl Node 需要這個)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apk add libstdc++
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 切到新 Node&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/opt/node-musl/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 永久化&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;export PATH=/opt/node-musl/bin:$PATH&amp;#39;&lt;/span&gt; &amp;gt;&amp;gt; ~/.bashrc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ which node
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/opt/node-musl/bin/node
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ node --version
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;v22.11.0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ node -e &lt;span class="s2"&gt;&amp;#34;console.log(&amp;#39;N-API:&amp;#39;, process.versions.napi)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;N-API: &lt;span class="m"&gt;9&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 2:用新 Node 安裝 Gemini CLI&lt;span class="hx:absolute hx:-mt-20" id="step-2用新-node-安裝-gemini-cli"&gt;&lt;/span&gt;
&lt;a href="#step-2%e7%94%a8%e6%96%b0-node-%e5%ae%89%e8%a3%9d-gemini-cli" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/opt/node-musl/bin/npm install -g @google/gemini-cli&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;added 86 packages in 21s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 3:確認 pty.node 缺哪些符號&lt;span class="hx:absolute hx:-mt-20" id="step-3確認-ptynode-缺哪些符號"&gt;&lt;/span&gt;
&lt;a href="#step-3%e7%a2%ba%e8%aa%8d-ptynode-%e7%bc%ba%e5%93%aa%e4%ba%9b%e7%ac%a6%e8%99%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ldd /opt/node-musl/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty-linux-x64/pty.node 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;symbol not found&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -v napi_&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出(只有兩個):&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Error relocating .../pty.node: __asprintf_chk: symbol not found
Error relocating .../pty.node: fcntl64: symbol not found&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果你看到的不只這兩個,代表你的環境跟我不同,後續 shim 可能要再加幾個函式。&lt;/p&gt;
&lt;h3&gt;Step 4:安裝 build toolchain&lt;span class="hx:absolute hx:-mt-20" id="step-4安裝-build-toolchain"&gt;&lt;/span&gt;
&lt;a href="#step-4%e5%ae%89%e8%a3%9d-build-toolchain" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apk add build-base&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期看到:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;(1/3) Installing fortify-headers (...)
(2/3) Installing patch (...)
(3/3) Installing build-base (...)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 5:撰寫並編譯 LD_PRELOAD shim&lt;span class="hx:absolute hx:-mt-20" id="step-5撰寫並編譯-ld_preload-shim"&gt;&lt;/span&gt;
&lt;a href="#step-5%e6%92%b0%e5%af%ab%e4%b8%a6%e7%b7%a8%e8%ad%af-ld_preload-shim" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;建立 shim 目錄:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/glibc-shim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;寫 shim 程式:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /opt/glibc-shim/shim.c &amp;gt; /dev/null &lt;span class="s"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#define _GNU_SOURCE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#include &amp;lt;stdio.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#include &amp;lt;stdarg.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#include &amp;lt;stdlib.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#include &amp;lt;fcntl.h&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; * __asprintf_chk: glibc _FORTIFY_SOURCE 提供的 hardened asprintf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; * musl 沒有對應實作,直接 forward 到 vasprintf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; * (功能等價,只是不做 buffer overflow check,對 PTY 操作沒影響)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;int __asprintf_chk(char **strp, int flag, const char *fmt, ...) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_list ap;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; int ret;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_start(ap, fmt);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ret = vasprintf(strp, fmt, ap);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_end(ap);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; return ret;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;/*
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; * fcntl64: glibc 32-bit 系統用的 64-bit file offset 版 fcntl
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; * x86_64 上 fcntl 行為等同 fcntl64,musl 只提供 fcntl
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; */
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;int fcntl64(int fd, int cmd, ...) {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_list ap;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; void *arg;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_start(ap, cmd);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; arg = va_arg(ap, void *);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; va_end(ap);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; return fcntl(fd, cmd, arg);
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;編譯:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo gcc -shared -fPIC -O2 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o /opt/glibc-shim/libglibc-shim.so &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/glibc-shim/shim.c&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證 shim 提供了正確符號:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ nm -D /opt/glibc-shim/libglibc-shim.so &lt;span class="p"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;&amp;#34;asprintf_chk|fcntl64&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="m"&gt;0000000000001160&lt;/span&gt; T __asprintf_chk
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="m"&gt;0000000000001210&lt;/span&gt; T fcntl64&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證 LD_PRELOAD 後 pty.node 不再缺符號:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ &lt;span class="nv"&gt;LD_PRELOAD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/opt/glibc-shim/libglibc-shim.so &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ldd /opt/node-musl/lib/node_modules/@google/gemini-cli/node_modules/@lydell/node-pty-linux-x64/pty.node 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;symbol not found&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -v napi_
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# (空白,代表所有非 napi 符號都解決了)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 6:用 wrapper script 永久化 LD_PRELOAD&lt;span class="hx:absolute hx:-mt-20" id="step-6用-wrapper-script-永久化-ld_preload"&gt;&lt;/span&gt;
&lt;a href="#step-6%e7%94%a8-wrapper-script-%e6%b0%b8%e4%b9%85%e5%8c%96-ld_preload" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;不要每次都手打 &lt;code&gt;LD_PRELOAD=...&lt;/code&gt;。把原本的 gemini symlink 換成一個 wrapper:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 備份原本的 symlink&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mv /opt/node-musl/bin/gemini /opt/node-musl/bin/gemini.real
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 寫 wrapper&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /opt/node-musl/bin/gemini &amp;gt; /dev/null &lt;span class="s"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#!/bin/sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Gemini CLI launcher with glibc shim for Alpine/musl
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Required because @lydell/node-pty-linux-x64/pty.node references
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# glibc-only symbols (__asprintf_chk, fcntl64) that musl/gcompat lacks.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;export LD_PRELOAD=/opt/glibc-shim/libglibc-shim.so
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;exec /opt/node-musl/bin/node \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; /opt/node-musl/lib/node_modules/@google/gemini-cli/bundle/gemini.js &amp;#34;$@&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod +x /opt/node-musl/bin/gemini&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 7:驗證修復&lt;span class="hx:absolute hx:-mt-20" id="step-7驗證修復"&gt;&lt;/span&gt;
&lt;a href="#step-7%e9%a9%97%e8%ad%89%e4%bf%ae%e5%be%a9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gemini --version&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;進互動模式測試:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;gemini&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;進 Gemini CLI 後,輸入會觸發 shell 的 prompt:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;請執行 shell 指令: ls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期看到 Gemini &lt;strong&gt;真的執行 ls 並回傳結果&lt;/strong&gt;,而不是 thinking 後 crash 退出。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;結果驗證範例&lt;span class="hx:absolute hx:-mt-20" id="結果驗證範例"&gt;&lt;/span&gt;
&lt;a href="#%e7%b5%90%e6%9e%9c%e9%a9%97%e8%ad%89%e7%af%84%e4%be%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;實際執行 Gemini 互動模式的成功輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;gt; 請執行 shell 指令: openspec new change test-with-shim
Creating New OpenSpec Change: Executing the requested openspec command.
✓ Shell openspec new change test-with-shim
✔ Created change &amp;#39;test-with-shim&amp;#39; at openspec/changes/test-with-shim/
✓ ReadFolder openspec/changes/test-with-shim/ → Found 1 item(s).
✓ ReadFile openspec/.../.openspec.yaml
✓ Shell which openspec
/opt/node-musl/bin/openspec
✦ 已成功執行指令 openspec new change test-with-shim。&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;已知限制&lt;span class="hx:absolute hx:-mt-20" id="已知限制"&gt;&lt;/span&gt;
&lt;a href="#%e5%b7%b2%e7%9f%a5%e9%99%90%e5%88%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Headless 模式仍有問題&lt;span class="hx:absolute hx:-mt-20" id="headless-模式仍有問題"&gt;&lt;/span&gt;
&lt;a href="#headless-%e6%a8%a1%e5%bc%8f%e4%bb%8d%e6%9c%89%e5%95%8f%e9%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;gemini -p &amp;quot;...&amp;quot;&lt;/code&gt; 在 headless 模式下,即使套用此 shim,仍會看到:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Error executing tool run_shell_command: Tool &amp;#34;run_shell_command&amp;#34; not found.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;這是不同問題&lt;/strong&gt;,跟 musl/segfault 無關。Gemini CLI 在 headless 模式刻意限制工具白名單(見 &lt;a
href="https://github.com/google-gemini/gemini-cli/issues/5382"target="_blank" rel="noopener"&gt;Gemini CLI Issue #5382&lt;/a&gt;)。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;workaround&lt;/strong&gt;:用互動模式即可,本修復解決的就是互動模式問題。&lt;/p&gt;
&lt;h3&gt;Node 版本選擇&lt;span class="hx:absolute hx:-mt-20" id="node-版本選擇"&gt;&lt;/span&gt;
&lt;a href="#node-%e7%89%88%e6%9c%ac%e9%81%b8%e6%93%87" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;本文用 Node 22.11.0。理論上 Node 20.x 也可以(都有 unofficial musl prebuild)。Node 24 沒實測過,如果你想用 Node 24,記得驗證 N-API 9+ 支援。&lt;/p&gt;
&lt;h3&gt;Gemini CLI 升級後可能要重做&lt;span class="hx:absolute hx:-mt-20" id="gemini-cli-升級後可能要重做"&gt;&lt;/span&gt;
&lt;a href="#gemini-cli-%e5%8d%87%e7%b4%9a%e5%be%8c%e5%8f%af%e8%83%bd%e8%a6%81%e9%87%8d%e5%81%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;每次 &lt;code&gt;npm install -g @google/gemini-cli@latest&lt;/code&gt; 後,如果 Gemini 換了 PTY 的相依套件,可能需要重新檢查缺失符號清單(回到 Step 3),補進 shim.c 重編。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;參考資料&lt;span class="hx:absolute hx:-mt-20" id="參考資料"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/2251"target="_blank" rel="noopener"&gt;Gemini CLI Issue #2251 — Segfault in musl libc distros&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://github.com/google-gemini/gemini-cli/issues/12878"target="_blank" rel="noopener"&gt;Gemini CLI Issue #12878 — Optionalize node-pty with external backend&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://unofficial-builds.nodejs.org/download/release/"target="_blank" rel="noopener"&gt;nodejs/unofficial-builds — musl prebuilt Node&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/gcompat"target="_blank" rel="noopener"&gt;Alpine Linux gcompat&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;致謝&lt;span class="hx:absolute hx:-mt-20" id="致謝"&gt;&lt;/span&gt;
&lt;a href="#%e8%87%b4%e8%ac%9d" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;整個除錯過程靠 strace、core dump、ldd、readelf、nm 一步步收斂問題範圍,從「Gemini 莫名 crash」收斂到「2 個 glibc 符號缺失」。最終解法只有 11 行 C code,但沒有前面的系統性除錯,做不出來。&lt;/p&gt;
&lt;p&gt;工程除錯的價值不在解法本身,而在「定位問題的能力」。&lt;/p&gt;</description></item><item><title>驗證 kubelet `serializeImagePulls` 行為差異</title><link>https://blog.kubeantony.com/archive/misc/%E9%A9%97%E8%AD%89-kubelet-serializeimagepulls-%E8%A1%8C%E7%82%BA%E5%B7%AE%E7%95%B0/</link><pubDate>Wed, 29 Apr 2026 08:17:38 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/%E9%A9%97%E8%AD%89-kubelet-serializeimagepulls-%E8%A1%8C%E7%82%BA%E5%B7%AE%E7%95%B0/</guid><description>
&lt;blockquote&gt;
&lt;p&gt;透過實際部署多個 Pod,觀察 kubelet 在 &lt;code&gt;serializeImagePulls=true&lt;/code&gt; 與 &lt;code&gt;false&lt;/code&gt; 兩種設定下的 image 拉取行為差異。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;目錄&lt;span class="hx:absolute hx:-mt-20" id="目錄"&gt;&lt;/span&gt;
&lt;a href="#%e7%9b%ae%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="#%e8%83%8c%e6%99%af%e7%9f%a5%e8%ad%98"&gt;背景知識&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e5%89%8d%e7%bd%ae%e6%ba%96%e5%82%99"&gt;前置準備&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e7%ac%ac%e4%b8%80%e9%9a%8e%e6%ae%b5%e6%b8%ac%e8%a9%a6-serializeimagepullsfalse%e5%b9%b3%e8%a1%8c%e6%8b%89%e5%8f%96"&gt;第一階段:測試 &lt;code&gt;serializeImagePulls=false&lt;/code&gt;(平行拉取)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e7%ac%ac%e4%ba%8c%e9%9a%8e%e6%ae%b5%e6%b8%ac%e8%a9%a6-serializeimagepullstrue%e5%ba%8f%e5%88%97%e6%8b%89%e5%8f%96"&gt;第二階段:測試 &lt;code&gt;serializeImagePulls=true&lt;/code&gt;(序列拉取)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e7%ac%ac%e4%b8%89%e9%9a%8e%e6%ae%b5%e5%b0%8d%e7%85%a7%e5%88%86%e6%9e%90"&gt;第三階段:對照分析&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e9%82%84%e5%8e%9f%e6%ad%a5%e9%a9%9f"&gt;還原步驟&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85"&gt;注意事項&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99"&gt;參考資料&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;背景知識&lt;span class="hx:absolute hx:-mt-20" id="背景知識"&gt;&lt;/span&gt;
&lt;a href="#%e8%83%8c%e6%99%af%e7%9f%a5%e8%ad%98" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;兩個層級的序列化&lt;span class="hx:absolute hx:-mt-20" id="兩個層級的序列化"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%a9%e5%80%8b%e5%b1%a4%e7%b4%9a%e7%9a%84%e5%ba%8f%e5%88%97%e5%8c%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Kubernetes 的 image pull 序列化行為其實有&lt;strong&gt;兩個層級&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;跨 Pod 層級&lt;/strong&gt;:由 &lt;code&gt;serializeImagePulls&lt;/code&gt; 控制,決定不同 Pod 之間的 image 拉取是序列還是平行&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pod 內部層級&lt;/strong&gt;:kubelet 永遠會逐一處理同一個 Pod 內的 container,&lt;strong&gt;這個行為不受 &lt;code&gt;serializeImagePulls&lt;/code&gt; 影響&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;重要&lt;/strong&gt;:測試時若用「單一 Pod 多 container」,無論 &lt;code&gt;serializeImagePulls&lt;/code&gt; 設成什麼,都會看到序列行為。必須用「多 Pod 同時部署」才能觀察到差異。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;參數版本支援&lt;span class="hx:absolute hx:-mt-20" id="參數版本支援"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e6%95%b8%e7%89%88%e6%9c%ac%e6%94%af%e6%8f%b4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Kubernetes &lt;strong&gt;1.27+&lt;/strong&gt;:&lt;code&gt;maxParallelImagePulls&lt;/code&gt; 為 Alpha&lt;/li&gt;
&lt;li&gt;Kubernetes &lt;strong&gt;1.28+&lt;/strong&gt;:升為 Beta&lt;/li&gt;
&lt;li&gt;Kubernetes &lt;strong&gt;1.32+&lt;/strong&gt;:加入 e2e 測試&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;前置準備&lt;span class="hx:absolute hx:-mt-20" id="前置準備"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 選定測試用的 worker node&lt;span class="hx:absolute hx:-mt-20" id="1-選定測試用的-worker-node"&gt;&lt;/span&gt;
&lt;a href="#1-%e9%81%b8%e5%ae%9a%e6%b8%ac%e8%a9%a6%e7%94%a8%e7%9a%84-worker-node" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get nodes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;本次測試使用節點:&lt;code&gt;tk8s-worker2&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;2. 備份 kubelet 設定檔&lt;span class="hx:absolute hx:-mt-20" id="2-備份-kubelet-設定檔"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%82%99%e4%bb%bd-kubelet-%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;SSH 到目標 worker node:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /var/lib/kubelet/config.yaml /var/lib/kubelet/config.yaml.bak&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3. 準備測試用 YAML&lt;span class="hx:absolute hx:-mt-20" id="3-準備測試用-yaml"&gt;&lt;/span&gt;
&lt;a href="#3-%e6%ba%96%e5%82%99%e6%b8%ac%e8%a9%a6%e7%94%a8-yaml" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;建立檔案 &lt;code&gt;multi-pod-test.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Pod&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;pull-test-1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;tk8s-worker2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;c&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;nginx:1.25&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Always&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sleep&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3600&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Pod&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;pull-test-2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;tk8s-worker2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;c&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;redis:7.2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Always&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sleep&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3600&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Pod&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;pull-test-3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;tk8s-worker2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;c&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;mysql:8.0&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Always&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sleep&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3600&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Pod&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;pull-test-4&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;tk8s-worker2&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;c&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;postgres:16&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;imagePullPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Always&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sleep&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3600&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;第一階段:測試 &lt;code&gt;serializeImagePulls=false&lt;/code&gt;(平行拉取)&lt;span class="hx:absolute hx:-mt-20" id="第一階段測試-serializeimagepullsfalse平行拉取"&gt;&lt;/span&gt;
&lt;a href="#%e7%ac%ac%e4%b8%80%e9%9a%8e%e6%ae%b5%e6%b8%ac%e8%a9%a6-serializeimagepullsfalse%e5%b9%b3%e8%a1%8c%e6%8b%89%e5%8f%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;步驟 1:修改 kubelet 設定為 false&lt;span class="hx:absolute hx:-mt-20" id="步驟-1修改-kubelet-設定為-false"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-1%e4%bf%ae%e6%94%b9-kubelet-%e8%a8%ad%e5%ae%9a%e7%82%ba-false" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 worker node 上編輯設定檔:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo vi /var/lib/kubelet/config.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;加入或修改以下欄位:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;serializeImagePulls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;maxParallelImagePulls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 2:重啟 kubelet&lt;span class="hx:absolute hx:-mt-20" id="步驟-2重啟-kubelet"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-2%e9%87%8d%e5%95%9f-kubelet" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl restart kubelet
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl status kubelet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認狀態為 &lt;code&gt;active (running)&lt;/code&gt;。&lt;/p&gt;
&lt;h3&gt;步驟 3:驗證設定生效&lt;span class="hx:absolute hx:-mt-20" id="步驟-3驗證設定生效"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-3%e9%a9%97%e8%ad%89%e8%a8%ad%e5%ae%9a%e7%94%9f%e6%95%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get --raw &lt;span class="s2"&gt;&amp;#34;/api/v1/nodes/tk8s-worker2/proxy/configz&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; jq &lt;span class="s1"&gt;&amp;#39;.kubeletconfig | {serializeImagePulls, maxParallelImagePulls}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;serializeImagePulls&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;maxParallelImagePulls&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 4:清除節點上的舊 image&lt;span class="hx:absolute hx:-mt-20" id="步驟-4清除節點上的舊-image"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-4%e6%b8%85%e9%99%a4%e7%af%80%e9%bb%9e%e4%b8%8a%e7%9a%84%e8%88%8a-image" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 worker node 上執行:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo crictl rmi nginx:1.25 redis:7.2 mysql:8.0 postgres:16&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 5:開啟 events 監看視窗&lt;span class="hx:absolute hx:-mt-20" id="步驟-5開啟-events-監看視窗"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-5%e9%96%8b%e5%95%9f-events-%e7%9b%a3%e7%9c%8b%e8%a6%96%e7%aa%97" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;另開一個 terminal:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get events --watch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 6:部署 Pod 進行測試&lt;span class="hx:absolute hx:-mt-20" id="步驟-6部署-pod-進行測試"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-6%e9%83%a8%e7%bd%b2-pod-%e9%80%b2%e8%a1%8c%e6%b8%ac%e8%a9%a6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl apply -f multi-pod-test.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 7:實際執行結果&lt;span class="hx:absolute hx:-mt-20" id="步驟-7實際執行結果"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-7%e5%af%a6%e9%9a%9b%e5%9f%b7%e8%a1%8c%e7%b5%90%e6%9e%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-1 Pulling image &amp;#34;nginx:1.25&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-2 Pulling image &amp;#34;redis:7.2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-3 Pulling image &amp;#34;mysql:8.0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-4 Pulling image &amp;#34;postgres:16&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-2 Successfully pulled image &amp;#34;redis:7.2&amp;#34; in 3.559s (3.559s including waiting). Image size: 44645040 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-2 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-2 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-3 Successfully pulled image &amp;#34;mysql:8.0&amp;#34; in 3.792s (3.792s including waiting). Image size: 233592821 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-3 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-3 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-4 Successfully pulled image &amp;#34;postgres:16&amp;#34; in 4.077s (4.077s including waiting). Image size: 160157788 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-4 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-4 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-1 Successfully pulled image &amp;#34;nginx:1.25&amp;#34; in 5.568s (5.568s including waiting). Image size: 71005258 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-1 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-1 Container started&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 8:結果判讀(平行拉取的證據)&lt;span class="hx:absolute hx:-mt-20" id="步驟-8結果判讀平行拉取的證據"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-8%e7%b5%90%e6%9e%9c%e5%88%a4%e8%ae%80%e5%b9%b3%e8%a1%8c%e6%8b%89%e5%8f%96%e7%9a%84%e8%ad%89%e6%93%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Image&lt;/th&gt;
&lt;th&gt;pull time&lt;/th&gt;
&lt;th&gt;including waiting&lt;/th&gt;
&lt;th&gt;等待時間&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;redis:7.2&lt;/td&gt;
&lt;td&gt;3.559s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.559s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0s ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mysql:8.0&lt;/td&gt;
&lt;td&gt;3.792s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.792s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0s ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;postgres:16&lt;/td&gt;
&lt;td&gt;4.077s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.077s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0s ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nginx:1.25&lt;/td&gt;
&lt;td&gt;5.568s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5.568s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0s ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;判讀重點:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ 四個 &lt;code&gt;Pulling&lt;/code&gt; 事件&lt;strong&gt;同時發生&lt;/strong&gt;(時間戳同為 &lt;code&gt;0s&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;✅ 每個 image 的 &lt;code&gt;pull time&lt;/code&gt; = &lt;code&gt;including waiting&lt;/code&gt;,代表&lt;strong&gt;沒有任何排隊等待&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;✅ 完成順序與啟動順序&lt;strong&gt;不同&lt;/strong&gt;(redis 第一個拉完,但 nginx 第一個啟動)&lt;/li&gt;
&lt;li&gt;✅ 總時間 ≈ &lt;strong&gt;最慢 image 的時間&lt;/strong&gt;(~5.5 秒)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;步驟 9:清理測試環境&lt;span class="hx:absolute hx:-mt-20" id="步驟-9清理測試環境"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-9%e6%b8%85%e7%90%86%e6%b8%ac%e8%a9%a6%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl delete -f multi-pod-test.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;第二階段:測試 &lt;code&gt;serializeImagePulls=true&lt;/code&gt;(序列拉取)&lt;span class="hx:absolute hx:-mt-20" id="第二階段測試-serializeimagepullstrue序列拉取"&gt;&lt;/span&gt;
&lt;a href="#%e7%ac%ac%e4%ba%8c%e9%9a%8e%e6%ae%b5%e6%b8%ac%e8%a9%a6-serializeimagepullstrue%e5%ba%8f%e5%88%97%e6%8b%89%e5%8f%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;步驟 10:修改 kubelet 設定為 true&lt;span class="hx:absolute hx:-mt-20" id="步驟-10修改-kubelet-設定為-true"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-10%e4%bf%ae%e6%94%b9-kubelet-%e8%a8%ad%e5%ae%9a%e7%82%ba-true" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;SSH 到 worker node,編輯設定檔:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo vi /var/lib/kubelet/config.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修改為:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;serializeImagePulls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;注意&lt;/strong&gt;:設為 &lt;code&gt;true&lt;/code&gt; 時必須&lt;strong&gt;移除或註解&lt;/strong&gt; &lt;code&gt;maxParallelImagePulls&lt;/code&gt; 那一行,否則 kubelet 會啟動失敗。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;步驟 11:重啟 kubelet&lt;span class="hx:absolute hx:-mt-20" id="步驟-11重啟-kubelet"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-11%e9%87%8d%e5%95%9f-kubelet" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl restart kubelet
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl status kubelet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 12:驗證設定生效&lt;span class="hx:absolute hx:-mt-20" id="步驟-12驗證設定生效"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-12%e9%a9%97%e8%ad%89%e8%a8%ad%e5%ae%9a%e7%94%9f%e6%95%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get --raw &lt;span class="s2"&gt;&amp;#34;/api/v1/nodes/tk8s-worker2/proxy/configz&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; jq &lt;span class="s1"&gt;&amp;#39;.kubeletconfig.serializeImagePulls&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 13:清除節點上的 image&lt;span class="hx:absolute hx:-mt-20" id="步驟-13清除節點上的-image"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-13%e6%b8%85%e9%99%a4%e7%af%80%e9%bb%9e%e4%b8%8a%e7%9a%84-image" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 worker node 上執行:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo crictl rmi nginx:1.25 redis:7.2 mysql:8.0 postgres:16&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 14:重新部署 Pod 並監看 events&lt;span class="hx:absolute hx:-mt-20" id="步驟-14重新部署-pod-並監看-events"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-14%e9%87%8d%e6%96%b0%e9%83%a8%e7%bd%b2-pod-%e4%b8%a6%e7%9b%a3%e7%9c%8b-events" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get events --watch&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;另開 terminal:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl apply -f multi-pod-test.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 15:實際執行結果&lt;span class="hx:absolute hx:-mt-20" id="步驟-15實際執行結果"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-15%e5%af%a6%e9%9a%9b%e5%9f%b7%e8%a1%8c%e7%b5%90%e6%9e%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-3 Pulling image &amp;#34;mysql:8.0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-1 Pulling image &amp;#34;nginx:1.25&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-2 Pulling image &amp;#34;redis:7.2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulling pod/pull-test-4 Pulling image &amp;#34;postgres:16&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-3 Successfully pulled image &amp;#34;mysql:8.0&amp;#34; in 3.858s (3.858s including waiting). Image size: 233592821 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-3 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-3 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-1 Successfully pulled image &amp;#34;nginx:1.25&amp;#34; in 4.783s (8.629s including waiting). Image size: 71005258 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-1 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-1 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-2 Successfully pulled image &amp;#34;redis:7.2&amp;#34; in 3.565s (12.188s including waiting). Image size: 44645040 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-2 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-2 Container started
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Pulled pod/pull-test-4 Successfully pulled image &amp;#34;postgres:16&amp;#34; in 3.585s (15.751s including waiting). Image size: 160157788 bytes.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Created pod/pull-test-4 Container created
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;0s Normal Started pod/pull-test-4 Container started&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 16:結果判讀(序列拉取的證據)&lt;span class="hx:absolute hx:-mt-20" id="步驟-16結果判讀序列拉取的證據"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-16%e7%b5%90%e6%9e%9c%e5%88%a4%e8%ae%80%e5%ba%8f%e5%88%97%e6%8b%89%e5%8f%96%e7%9a%84%e8%ad%89%e6%93%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;順序&lt;/th&gt;
&lt;th&gt;Image&lt;/th&gt;
&lt;th&gt;pull time&lt;/th&gt;
&lt;th&gt;including waiting&lt;/th&gt;
&lt;th&gt;等待時間&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;mysql:8.0&lt;/td&gt;
&lt;td&gt;3.858s&lt;/td&gt;
&lt;td&gt;3.858s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;nginx:1.25&lt;/td&gt;
&lt;td&gt;4.783s&lt;/td&gt;
&lt;td&gt;8.629s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.846s&lt;/strong&gt; ⏳&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;redis:7.2&lt;/td&gt;
&lt;td&gt;3.565s&lt;/td&gt;
&lt;td&gt;12.188s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8.623s&lt;/strong&gt; ⏳&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;postgres:16&lt;/td&gt;
&lt;td&gt;3.585s&lt;/td&gt;
&lt;td&gt;15.751s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;12.166s&lt;/strong&gt; ⏳&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;判讀重點:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;⚠️ 雖然四個 &lt;code&gt;Pulling&lt;/code&gt; 事件看起來也是同一秒(這是事件精度只到秒的觀察陷阱),但底層&lt;strong&gt;只有一個真的在下載&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;✅ &lt;code&gt;including waiting&lt;/code&gt; 時間&lt;strong&gt;遞增&lt;/strong&gt;(0s → 3.8s → 8.6s → 12.2s),代表後面的 image 都在排隊&lt;/li&gt;
&lt;li&gt;✅ 等待時間 ≈ 前面所有 image 的 pull time 累加&lt;/li&gt;
&lt;li&gt;✅ 總時間 ≈ &lt;strong&gt;所有 image 拉取時間總和&lt;/strong&gt;(~15.7 秒)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;步驟 17:清理測試環境&lt;span class="hx:absolute hx:-mt-20" id="步驟-17清理測試環境"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-17%e6%b8%85%e7%90%86%e6%b8%ac%e8%a9%a6%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl delete -f multi-pod-test.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;第三階段:對照分析&lt;span class="hx:absolute hx:-mt-20" id="第三階段對照分析"&gt;&lt;/span&gt;
&lt;a href="#%e7%ac%ac%e4%b8%89%e9%9a%8e%e6%ae%b5%e5%b0%8d%e7%85%a7%e5%88%86%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;兩種模式並列比較&lt;span class="hx:absolute hx:-mt-20" id="兩種模式並列比較"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%a9%e7%a8%ae%e6%a8%a1%e5%bc%8f%e4%b8%a6%e5%88%97%e6%af%94%e8%bc%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;觀察項目&lt;/th&gt;
&lt;th&gt;&lt;code&gt;serializeImagePulls=false&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;serializeImagePulls=true&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;各 image 等待時間&lt;/td&gt;
&lt;td&gt;0s, 0s, 0s, 0s&lt;/td&gt;
&lt;td&gt;0s, 3.8s, 8.6s, &lt;strong&gt;12.2s&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pull time&lt;/code&gt; vs &lt;code&gt;including waiting&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;兩者相同&lt;/td&gt;
&lt;td&gt;&lt;code&gt;including waiting&lt;/code&gt; 大於 &lt;code&gt;pull time&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;完成順序&lt;/td&gt;
&lt;td&gt;取決於 image 大小與網速&lt;/td&gt;
&lt;td&gt;接近啟動順序&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;最後一個完成時間&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~5.5 秒&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~15.7 秒&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;總耗時特徵&lt;/td&gt;
&lt;td&gt;≈ 最慢 image 時間&lt;/td&gt;
&lt;td&gt;≈ 所有 image 時間總和&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;效能差異&lt;/td&gt;
&lt;td&gt;基準&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;慢約 2.85 倍&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;視覺化對照&lt;span class="hx:absolute hx:-mt-20" id="視覺化對照"&gt;&lt;/span&gt;
&lt;a href="#%e8%a6%96%e8%a6%ba%e5%8c%96%e5%b0%8d%e7%85%a7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;serializeImagePulls=false&lt;/code&gt;(平行)&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;時間軸: 0s ─────────── 5.5s
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mysql [████████] ← 同時下載
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nginx [██████████]
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;redis [████████]
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;postgres [██████████]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;serializeImagePulls=true&lt;/code&gt;(序列)&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;時間軸: 0s ─────────────────────── 15.7s
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mysql [████] ← 先下載
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nginx [█████] ← 等 mysql 完
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;redis [████] ← 再等
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;postgres [████] ← 最後&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;🎯 最關鍵的單一判斷依據&lt;span class="hx:absolute hx:-mt-20" id="-最關鍵的單一判斷依據"&gt;&lt;/span&gt;
&lt;a href="#-%e6%9c%80%e9%97%9c%e9%8d%b5%e7%9a%84%e5%96%ae%e4%b8%80%e5%88%a4%e6%96%b7%e4%be%9d%e6%93%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;看 &lt;code&gt;Pulled&lt;/code&gt; 事件訊息中的 &lt;strong&gt;&lt;code&gt;including waiting&lt;/code&gt;&lt;/strong&gt; 數字:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;in X (X including waiting)&lt;/code&gt; → &lt;strong&gt;平行拉取&lt;/strong&gt;(沒排隊)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;in X (Y including waiting)&lt;/code&gt; 且 &lt;strong&gt;&lt;code&gt;Y &amp;gt; X&lt;/code&gt;&lt;/strong&gt; → &lt;strong&gt;序列拉取&lt;/strong&gt;(有排隊)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;這個欄位就是 Kubernetes 為了幫使用者判斷序列化行為而特別設計的觀察點。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;還原步驟&lt;span class="hx:absolute hx:-mt-20" id="還原步驟"&gt;&lt;/span&gt;
&lt;a href="#%e9%82%84%e5%8e%9f%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;步驟 18:還原 kubelet 設定&lt;span class="hx:absolute hx:-mt-20" id="步驟-18還原-kubelet-設定"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-18%e9%82%84%e5%8e%9f-kubelet-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /var/lib/kubelet/config.yaml.bak /var/lib/kubelet/config.yaml
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl restart kubelet
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl status kubelet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;步驟 19:確認還原成功&lt;span class="hx:absolute hx:-mt-20" id="步驟-19確認還原成功"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f-19%e7%a2%ba%e8%aa%8d%e9%82%84%e5%8e%9f%e6%88%90%e5%8a%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get --raw &lt;span class="s2"&gt;&amp;#34;/api/v1/nodes/tk8s-worker2/proxy/configz&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; jq &lt;span class="s1"&gt;&amp;#39;.kubeletconfig.serializeImagePulls&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;注意事項&lt;span class="hx:absolute hx:-mt-20" id="注意事項"&gt;&lt;/span&gt;
&lt;a href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 測試節點選擇&lt;span class="hx:absolute hx:-mt-20" id="1-測試節點選擇"&gt;&lt;/span&gt;
&lt;a href="#1-%e6%b8%ac%e8%a9%a6%e7%af%80%e9%bb%9e%e9%81%b8%e6%93%87" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;選一台&lt;strong&gt;非生產關鍵&lt;/strong&gt;的 worker node。重啟 kubelet 期間該節點上的 Pod 會短暫斷線。&lt;/p&gt;
&lt;h3&gt;2. kubeadm 叢集警告&lt;span class="hx:absolute hx:-mt-20" id="2-kubeadm-叢集警告"&gt;&lt;/span&gt;
&lt;a href="#2-kubeadm-%e5%8f%a2%e9%9b%86%e8%ad%a6%e5%91%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;本機修改的 &lt;code&gt;/var/lib/kubelet/config.yaml&lt;/code&gt; 在執行 &lt;code&gt;kubeadm upgrade&lt;/code&gt; 時可能會被覆蓋。正式長期套用建議改 &lt;code&gt;kube-system&lt;/code&gt; 命名空間下的 &lt;code&gt;kubelet-config&lt;/code&gt; ConfigMap(但會影響全部節點)。&lt;/p&gt;
&lt;h3&gt;3. Image 必須不存在於節點&lt;span class="hx:absolute hx:-mt-20" id="3-image-必須不存在於節點"&gt;&lt;/span&gt;
&lt;a href="#3-image-%e5%bf%85%e9%a0%88%e4%b8%8d%e5%ad%98%e5%9c%a8%e6%96%bc%e7%af%80%e9%bb%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;每次測試前都要 &lt;code&gt;crictl rmi&lt;/code&gt;,否則 kubelet 會跳過 pull 階段直接顯示 &lt;code&gt;Container image already present&lt;/code&gt;,觀察不到差異。&lt;/p&gt;
&lt;h3&gt;4. &lt;code&gt;maxParallelImagePulls&lt;/code&gt; 限制規則&lt;span class="hx:absolute hx:-mt-20" id="4-maxparallelimagepulls-限制規則"&gt;&lt;/span&gt;
&lt;a href="#4-maxparallelimagepulls-%e9%99%90%e5%88%b6%e8%a6%8f%e5%89%87" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;需要 Kubernetes &lt;strong&gt;1.27+&lt;/strong&gt; 才支援&lt;/li&gt;
&lt;li&gt;設為 &lt;code&gt;≥ 2&lt;/code&gt; 時,&lt;strong&gt;必須&lt;/strong&gt;搭配 &lt;code&gt;serializeImagePulls: false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;若 &lt;code&gt;serializeImagePulls: true&lt;/code&gt;,則 &lt;code&gt;maxParallelImagePulls&lt;/code&gt; 必須設為 &lt;code&gt;1&lt;/code&gt; 或不設定&lt;/li&gt;
&lt;li&gt;違反規則 kubelet 會啟動失敗&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;5. Pod 內 container 不受影響&lt;span class="hx:absolute hx:-mt-20" id="5-pod-內-container-不受影響"&gt;&lt;/span&gt;
&lt;a href="#5-pod-%e5%85%a7-container-%e4%b8%8d%e5%8f%97%e5%bd%b1%e9%9f%bf" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;kubelet &lt;strong&gt;永遠&lt;/strong&gt;逐一處理同一個 Pod 內的多個 container 的 image 拉取,這是固定設計,與 &lt;code&gt;serializeImagePulls&lt;/code&gt; 設定無關。所以驗證時務必使用「多 Pod 同時部署」的方式。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;參考資料&lt;span class="hx:absolute hx:-mt-20" id="參考資料"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://kubernetes.io/docs/concepts/containers/images/"target="_blank" rel="noopener"&gt;Kubernetes Documentation - Images&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/3673-kubelet-parallel-image-pull-limit/README.md"target="_blank" rel="noopener"&gt;KEP-3673: Kubelet limit of Parallel Image Pulls&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Kubernetes kube-controller-manager 設定參數深度解析</title><link>https://blog.kubeantony.com/archive/kubernetes/kubernetes-kube-controller-manager-%E8%A8%AD%E5%AE%9A%E5%8F%83%E6%95%B8%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90/</link><pubDate>Thu, 23 Apr 2026 13:43:54 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/kubernetes-kube-controller-manager-%E8%A8%AD%E5%AE%9A%E5%8F%83%E6%95%B8%E6%B7%B1%E5%BA%A6%E8%A7%A3%E6%9E%90/</guid><description>
&lt;blockquote&gt;
&lt;p&gt;從 &lt;code&gt;node-cidr-mask-size&lt;/code&gt; 與 &lt;code&gt;terminated-pod-gc-threshold&lt;/code&gt; 出發,了解 PodGC Controller 的運作原理,並透過 Kind 本機環境實作驗證。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;文件資訊&lt;span class="hx:absolute hx:-mt-20" id="文件資訊"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%87%e4%bb%b6%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;內容&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;文件主題&lt;/td&gt;
&lt;td&gt;kube-controller-manager &lt;code&gt;extraArgs&lt;/code&gt; 參數解析與 PodGC 實作驗證&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;建立日期&lt;/td&gt;
&lt;td&gt;2026-04-23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;適用版本&lt;/td&gt;
&lt;td&gt;Kubernetes(以 master 分支原始碼為準)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;驗證環境&lt;/td&gt;
&lt;td&gt;Kind 本機叢集&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;主要參考&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://github.com/kubernetes/kubernetes/tree/master/pkg/controller/podgc"target="_blank" rel="noopener"&gt;kubernetes/pkg/controller/podgc&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;目錄&lt;span class="hx:absolute hx:-mt-20" id="目錄"&gt;&lt;/span&gt;
&lt;a href="#%e7%9b%ae%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="#%e4%b8%80%e8%83%8c%e6%99%af%e8%a8%ad%e5%ae%9a%e6%aa%94%e7%9a%84%e7%94%a8%e9%80%94"&gt;一、背景:設定檔的用途&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e4%ba%8c%e5%8f%83%e6%95%b8%e8%a7%a3%e6%9e%90"&gt;二、參數解析&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="#21-node-cidr-mask-size-25"&gt;2.1 &lt;code&gt;node-cidr-mask-size: &amp;quot;25&amp;quot;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#22-terminated-pod-gc-threshold-500"&gt;2.2 &lt;code&gt;terminated-pod-gc-threshold: &amp;quot;500&amp;quot;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#23-%e5%85%a9%e5%80%8b%e5%8f%83%e6%95%b8%e7%9a%84%e6%95%b4%e9%ab%94%e8%a8%ad%e8%a8%88%e6%84%8f%e5%9c%96"&gt;2.3 兩個參數的整體設計意圖&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#24-%e8%a8%ad%e5%ae%9a%e6%99%82%e7%9a%84%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85"&gt;2.4 設定時的注意事項&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e4%b8%89%e5%8e%9f%e7%90%86podgc-controller-%e5%a6%82%e4%bd%95%e8%aa%8d%e5%ae%9aterminated-pod"&gt;三、原理:PodGC Controller 如何認定「terminated Pod」&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="#31-%e5%8e%9f%e5%a7%8b%e7%a2%bc%e4%bd%8d%e7%bd%ae"&gt;3.1 原始碼位置&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#32-%e5%8e%9f%e5%a7%8b%e7%a2%bc%e5%b1%a4%e9%9d%a2%e7%9a%84-terminated-%e5%ae%9a%e7%be%a9"&gt;3.2 原始碼層面的 terminated 定義&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#33-%e7%94%a8-kubectl-%e5%88%a4%e6%96%b7-pod-%e6%98%af%e5%90%a6%e7%82%ba-terminated"&gt;3.3 用 kubectl 判斷 Pod 是否為 terminated&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#34-%e5%80%bc%e5%be%97%e6%b3%a8%e6%84%8f%e7%9a%84%e5%8e%9f%e5%a7%8b%e7%a2%bc%e7%b4%b0%e7%af%80"&gt;3.4 值得注意的原始碼細節&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e5%9b%9b%e9%a9%97%e8%ad%89%e5%af%a6%e9%a9%97%e7%94%a8-kind-%e9%a9%97%e8%ad%89-terminated-pod-gc-threshold"&gt;四、驗證實驗:用 Kind 驗證 &lt;code&gt;terminated-pod-gc-threshold&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="#41-%e5%af%a6%e9%a9%97%e8%a8%ad%e8%a8%88"&gt;4.1 實驗設計&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#42-%e5%ae%8c%e6%95%b4%e5%af%a6%e9%a9%97%e6%ad%a5%e9%a9%9f"&gt;4.2 完整實驗步驟&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#43-%e5%af%a6%e9%a9%97%e6%b8%85%e7%90%86"&gt;4.3 實驗清理&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e4%ba%94%e6%95%b4%e9%ab%94%e9%a9%97%e8%ad%89%e6%b5%81%e7%a8%8b%e7%b8%bd%e7%b5%90"&gt;五、整體驗證流程總結&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="#%e5%85%ad%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99"&gt;六、參考資料&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;一、背景:設定檔的用途&lt;span class="hx:absolute hx:-mt-20" id="一背景設定檔的用途"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%80%e8%83%8c%e6%99%af%e8%a8%ad%e5%ae%9a%e6%aa%94%e7%9a%84%e7%94%a8%e9%80%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本文件所討論的設定檔片段:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;controllerManager&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;extraArgs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;node-cidr-mask-size &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# set pod cidr per node&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;25&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Garbage Collection&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Max number of terminated pods to keep before cleaning up&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;terminated-pod-gc-threshold&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;500&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;這是 &lt;strong&gt;Kubernetes kubeadm &lt;code&gt;ClusterConfiguration&lt;/code&gt;&lt;/strong&gt; 中,用來傳遞額外參數給 &lt;strong&gt;kube-controller-manager&lt;/strong&gt; 的設定片段。&lt;code&gt;extraArgs&lt;/code&gt; 裡面的每一項,最終會被轉換成 kube-controller-manager 啟動時的命令列參數(例如 &lt;code&gt;--node-cidr-mask-size=25&lt;/code&gt;)。&lt;/p&gt;
&lt;p&gt;kube-controller-manager 是 Kubernetes 控制平面的核心元件之一,內部包含了許多 controller(如 Node Controller、Replication Controller、Garbage Collector 等),負責維持叢集的「期望狀態」。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;二、參數解析&lt;span class="hx:absolute hx:-mt-20" id="二參數解析"&gt;&lt;/span&gt;
&lt;a href="#%e4%ba%8c%e5%8f%83%e6%95%b8%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;2.1 &lt;code&gt;node-cidr-mask-size: &amp;quot;25&amp;quot;&lt;/code&gt;&lt;span class="hx:absolute hx:-mt-20" id="21-node-cidr-mask-size-25"&gt;&lt;/span&gt;
&lt;a href="#21-node-cidr-mask-size-25" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;字面意義&lt;span class="hx:absolute hx:-mt-20" id="字面意義"&gt;&lt;/span&gt;
&lt;a href="#%e5%ad%97%e9%9d%a2%e6%84%8f%e7%be%a9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;設定「每個 Node 分配到的 Pod CIDR 子網路遮罩大小」為 &lt;code&gt;/25&lt;/code&gt;。&lt;/p&gt;
&lt;h4&gt;運作原理&lt;span class="hx:absolute hx:-mt-20" id="運作原理"&gt;&lt;/span&gt;
&lt;a href="#%e9%81%8b%e4%bd%9c%e5%8e%9f%e7%90%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;當您在叢集建立時設定了整個叢集的 Pod 網段(&lt;code&gt;--cluster-cidr&lt;/code&gt;,例如 &lt;code&gt;10.244.0.0/16&lt;/code&gt;),kube-controller-manager 會從這個大網段中,&lt;strong&gt;切出一小塊子網段分配給每個加入叢集的 Node&lt;/strong&gt;,這塊子網段就是該 Node 上所有 Pod 的 IP 來源。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;node-cidr-mask-size=25&lt;/code&gt; 代表每個 Node 會拿到一個 &lt;code&gt;/25&lt;/code&gt; 的子網段。&lt;/p&gt;
&lt;h4&gt;實際影響(以 &lt;code&gt;/25&lt;/code&gt; 為例)&lt;span class="hx:absolute hx:-mt-20" id="實際影響以-25-為例"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e9%9a%9b%e5%bd%b1%e9%9f%bf%e4%bb%a5-25-%e7%82%ba%e4%be%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;每個 Node 可分配的 IP 數量:2^(32-25) = &lt;strong&gt;128 個 IP&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;扣除網路位址、廣播位址等保留 IP,&lt;strong&gt;每個 Node 實際可跑約 126 個 Pod&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;若叢集的 cluster-cidr 是 &lt;code&gt;/16&lt;/code&gt;(共 65,536 個 IP),理論上可切出 &lt;code&gt;2^(25-16) = 512&lt;/code&gt; 個 Node 的配額&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;與預設值的差異&lt;span class="hx:absolute hx:-mt-20" id="與預設值的差異"&gt;&lt;/span&gt;
&lt;a href="#%e8%88%87%e9%a0%90%e8%a8%ad%e5%80%bc%e7%9a%84%e5%b7%ae%e7%95%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Kubernetes 預設值是 &lt;code&gt;/24&lt;/code&gt;(每個 Node 可跑約 254 個 Pod)。設成 &lt;code&gt;/25&lt;/code&gt; 代表:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;節省 IP 位址&lt;/strong&gt;:在有限的 cluster-cidr 下可容納更多 Node&lt;/li&gt;
&lt;li&gt;⚠️ &lt;strong&gt;限制單一 Node 的 Pod 密度&lt;/strong&gt;:每個 Node 最多只能跑約 126 個 Pod(仍高於 kubelet 預設的 &lt;code&gt;max-pods=110&lt;/code&gt;,所以實務上通常夠用)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;什麼情境會這樣設定?&lt;span class="hx:absolute hx:-mt-20" id="什麼情境會這樣設定"&gt;&lt;/span&gt;
&lt;a href="#%e4%bb%80%e9%ba%bc%e6%83%85%e5%a2%83%e6%9c%83%e9%80%99%e6%a8%a3%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;Pod IP 網段資源有限(例如 VPC 內可用的 CIDR 不大)&lt;/li&gt;
&lt;li&gt;叢集 Node 數量多、但每個 Node 的 Pod 密度不高&lt;/li&gt;
&lt;li&gt;希望在有限網段內擴充 Node 規模&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3&gt;2.2 &lt;code&gt;terminated-pod-gc-threshold: &amp;quot;500&amp;quot;&lt;/code&gt;&lt;span class="hx:absolute hx:-mt-20" id="22-terminated-pod-gc-threshold-500"&gt;&lt;/span&gt;
&lt;a href="#22-terminated-pod-gc-threshold-500" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;字面意義&lt;span class="hx:absolute hx:-mt-20" id="字面意義-1"&gt;&lt;/span&gt;
&lt;a href="#%e5%ad%97%e9%9d%a2%e6%84%8f%e7%be%a9-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;當叢集中「已終止(terminated)狀態的 Pod」數量超過 500 個時,Garbage Collector 會開始自動清理這些 Pod。&lt;/p&gt;
&lt;h4&gt;運作原理&lt;span class="hx:absolute hx:-mt-20" id="運作原理-1"&gt;&lt;/span&gt;
&lt;a href="#%e9%81%8b%e4%bd%9c%e5%8e%9f%e7%90%86-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;當 Pod 執行完畢(Succeeded 或 Failed),它們&lt;strong&gt;不會立刻從 etcd 中刪除&lt;/strong&gt;,而是會保留下來供使用者查詢記錄(例如 &lt;code&gt;kubectl get pods&lt;/code&gt; 時看到 &lt;code&gt;Completed&lt;/code&gt; 狀態的 Pod)。這些 Pod 雖然不再消耗運算資源,但仍會佔用:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;etcd 儲存空間&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API Server 的查詢效能&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;這個參數控制「保留多少個已終止 Pod 才開始清理」。&lt;/p&gt;
&lt;h4&gt;實際影響(設為 500)&lt;span class="hx:absolute hx:-mt-20" id="實際影響設為-500"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e9%9a%9b%e5%bd%b1%e9%9f%bf%e8%a8%ad%e7%82%ba-500" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;當已終止 Pod 數量 ≤ 500:不會觸發清理,全部保留&lt;/li&gt;
&lt;li&gt;當已終止 Pod 數量 &amp;gt; 500:從最舊的開始刪除,直到數量回到 500 以下&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;與預設值的差異&lt;span class="hx:absolute hx:-mt-20" id="與預設值的差異-1"&gt;&lt;/span&gt;
&lt;a href="#%e8%88%87%e9%a0%90%e8%a8%ad%e5%80%bc%e7%9a%84%e5%b7%ae%e7%95%b0-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Kubernetes 預設值是 &lt;code&gt;12500&lt;/code&gt;,設成 &lt;code&gt;500&lt;/code&gt; 代表:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;更積極地清理&lt;/strong&gt;,減輕 etcd 負擔、加快 API Server 回應速度&lt;/li&gt;
&lt;li&gt;✅ 適合有大量 Job / CronJob 產生短命 Pod 的叢集&lt;/li&gt;
&lt;li&gt;⚠️ &lt;strong&gt;可保留的歷史記錄變少&lt;/strong&gt;,若需要排查較早的失敗 Pod 可能已被刪除(建議搭配 Log 收集系統,如 Loki、ELK)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;什麼情境會這樣設定?&lt;span class="hx:absolute hx:-mt-20" id="什麼情境會這樣設定-1"&gt;&lt;/span&gt;
&lt;a href="#%e4%bb%80%e9%ba%bc%e6%83%85%e5%a2%83%e6%9c%83%e9%80%99%e6%a8%a3%e8%a8%ad%e5%ae%9a-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;叢集會跑大量 Batch Job / CronJob&lt;/li&gt;
&lt;li&gt;etcd 效能是瓶頸、或想降低 etcd 儲存壓力&lt;/li&gt;
&lt;li&gt;已有完善的 log / event 外部保存機制,不需依賴 API Server 保留 Pod 記錄&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3&gt;2.3 兩個參數的整體設計意圖&lt;span class="hx:absolute hx:-mt-20" id="23-兩個參數的整體設計意圖"&gt;&lt;/span&gt;
&lt;a href="#23-%e5%85%a9%e5%80%8b%e5%8f%83%e6%95%b8%e7%9a%84%e6%95%b4%e9%ab%94%e8%a8%ad%e8%a8%88%e6%84%8f%e5%9c%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;關注點&lt;/th&gt;
&lt;th&gt;對應參數&lt;/th&gt;
&lt;th&gt;設計思路&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;IP 資源效率&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;node-cidr-mask-size=25&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;用比較小的 Pod CIDR 讓叢集能容納更多 Node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;控制平面效能&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;terminated-pod-gc-threshold=500&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;積極清理終止 Pod,減輕 etcd / API Server 壓力&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;兩者都指向同一個方向:&lt;strong&gt;這是一個偏向中大型、但希望控制資源使用效率的叢集&lt;/strong&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;2.4 設定時的注意事項&lt;span class="hx:absolute hx:-mt-20" id="24-設定時的注意事項"&gt;&lt;/span&gt;
&lt;a href="#24-%e8%a8%ad%e5%ae%9a%e6%99%82%e7%9a%84%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;node-cidr-mask-size&lt;/code&gt; 必須與 &lt;code&gt;cluster-cidr&lt;/code&gt;、&lt;code&gt;kubelet --max-pods&lt;/code&gt; 三者一起通盤考量&lt;/strong&gt;,避免出現 Node 配額超過 IP 可用量,或 Pod 配額超過網段容量的狀況。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;terminated-pod-gc-threshold&lt;/code&gt; 不能設太低&lt;/strong&gt;(例如幾十個),否則剛跑完的 Job 馬上被清掉,會讓 debug 非常困難。500 是一個相對平衡的數字。&lt;/li&gt;
&lt;li&gt;修改 &lt;code&gt;controllerManager.extraArgs&lt;/code&gt; 後,&lt;strong&gt;需要重啟 kube-controller-manager Pod&lt;/strong&gt; 才會生效(若是 kubeadm 叢集,修改 &lt;code&gt;/etc/kubernetes/manifests/kube-controller-manager.yaml&lt;/code&gt; 會自動重啟)。&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;三、原理:PodGC Controller 如何認定「terminated Pod」&lt;span class="hx:absolute hx:-mt-20" id="三原理podgc-controller-如何認定terminated-pod"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%89%e5%8e%9f%e7%90%86podgc-controller-%e5%a6%82%e4%bd%95%e8%aa%8d%e5%ae%9aterminated-pod" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;3.1 原始碼位置&lt;span class="hx:absolute hx:-mt-20" id="31-原始碼位置"&gt;&lt;/span&gt;
&lt;a href="#31-%e5%8e%9f%e5%a7%8b%e7%a2%bc%e4%bd%8d%e7%bd%ae" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Kubernetes 的 PodGC Controller 位於:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubernetes/pkg/controller/podgc/gc_controller.go&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.2 原始碼層面的 terminated 定義&lt;span class="hx:absolute hx:-mt-20" id="32-原始碼層面的-terminated-定義"&gt;&lt;/span&gt;
&lt;a href="#32-%e5%8e%9f%e5%a7%8b%e7%a2%bc%e5%b1%a4%e9%9d%a2%e7%9a%84-terminated-%e5%ae%9a%e7%be%a9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;根據 Kubernetes 官方 &lt;code&gt;pkg/controller/podgc&lt;/code&gt; 套件的 &lt;code&gt;doc.go&lt;/code&gt; 描述:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;PodGCController&amp;hellip; If the number of pods in &lt;strong&gt;terminated phases (right now either Failed or Succeeded)&lt;/strong&gt; surpasses a configurable threshold, the controller will delete pods in terminated state until the system reaches the allowed threshold again. The PodGCController prioritizes pods to delete by &lt;strong&gt;sorting by creation timestamp and deleting the oldest objects first&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;這段話給了我們三個關鍵定義:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;判定依據&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Pod 的 &lt;code&gt;status.phase&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;必須是 &lt;code&gt;Failed&lt;/code&gt; 或 &lt;code&gt;Succeeded&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. 判斷時機&lt;/td&gt;
&lt;td&gt;當 terminated Pod 總數 &amp;gt; threshold 才觸發清理&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. 刪除順序&lt;/td&gt;
&lt;td&gt;依照 &lt;code&gt;creationTimestamp&lt;/code&gt; 排序,&lt;strong&gt;最舊的先刪&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;在 &lt;code&gt;gc_controller.go&lt;/code&gt; 中也能看到這個判定邏輯的核心程式碼片段:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;phase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;pod&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Phase&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;phase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;v1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PodPending&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;phase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;v1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PodRunning&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;phase&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;v1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PodUnknown&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;// 這個 Pod 屬於 terminated,納入 GC 候選名單&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;這段程式碼使用&lt;strong&gt;反向列舉&lt;/strong&gt;的方式定義 terminated:&lt;strong&gt;只要不是 Pending / Running / Unknown,就是 terminated&lt;/strong&gt;。在 Kubernetes 的 Pod phase 定義中,剩下的就是 &lt;code&gt;Succeeded&lt;/code&gt; 和 &lt;code&gt;Failed&lt;/code&gt; 兩種。&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;3.3 用 kubectl 判斷 Pod 是否為 terminated&lt;span class="hx:absolute hx:-mt-20" id="33-用-kubectl-判斷-pod-是否為-terminated"&gt;&lt;/span&gt;
&lt;a href="#33-%e7%94%a8-kubectl-%e5%88%a4%e6%96%b7-pod-%e6%98%af%e5%90%a6%e7%82%ba-terminated" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;對應到 &lt;code&gt;kubectl&lt;/code&gt;,可以用 &lt;code&gt;status.phase&lt;/code&gt; 做 field selector 過濾:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 查詢所有 Succeeded 的 Pod&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods --all-namespaces --field-selector&lt;span class="o"&gt;=&lt;/span&gt;status.phase&lt;span class="o"&gt;=&lt;/span&gt;Succeeded
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 查詢所有 Failed 的 Pod&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods --all-namespaces --field-selector&lt;span class="o"&gt;=&lt;/span&gt;status.phase&lt;span class="o"&gt;=&lt;/span&gt;Failed
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 同時查詢兩者(field-selector 不支援 OR,需要用 jq 輔助)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods --all-namespaces -o json &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; jq &lt;span class="s1"&gt;&amp;#39;.items[] | select(.status.phase==&amp;#34;Succeeded&amp;#34; or .status.phase==&amp;#34;Failed&amp;#34;) | .metadata.name&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 快速統計 terminated Pod 數量&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods --all-namespaces -o json &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; jq &lt;span class="s1"&gt;&amp;#39;[.items[] | select(.status.phase==&amp;#34;Succeeded&amp;#34; or .status.phase==&amp;#34;Failed&amp;#34;)] | length&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;常見誤解澄清&lt;/strong&gt;
&lt;code&gt;kubectl get pods&lt;/code&gt; 看到的 &lt;code&gt;Completed&lt;/code&gt; &lt;strong&gt;不是&lt;/strong&gt; phase 值,而是 STATUS 欄位的顯示字串。真正的 phase 是 &lt;code&gt;Succeeded&lt;/code&gt;。同理 &lt;code&gt;Error&lt;/code&gt; 對應的是 &lt;code&gt;Failed&lt;/code&gt;。
驗證時一定要用 &lt;code&gt;status.phase&lt;/code&gt; 當條件,不要用 &lt;code&gt;STATUS&lt;/code&gt; 欄位的字串。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3&gt;3.4 值得注意的原始碼細節&lt;span class="hx:absolute hx:-mt-20" id="34-值得注意的原始碼細節"&gt;&lt;/span&gt;
&lt;a href="#34-%e5%80%bc%e5%be%97%e6%b3%a8%e6%84%8f%e7%9a%84%e5%8e%9f%e5%a7%8b%e7%a2%bc%e7%b4%b0%e7%af%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;細節 1:GC 只會把超出的部分刪掉,不會歸零&lt;span class="hx:absolute hx:-mt-20" id="細節-1gc-只會把超出的部分刪掉不會歸零"&gt;&lt;/span&gt;
&lt;a href="#%e7%b4%b0%e7%af%80-1gc-%e5%8f%aa%e6%9c%83%e6%8a%8a%e8%b6%85%e5%87%ba%e7%9a%84%e9%83%a8%e5%88%86%e5%88%aa%e6%8e%89%e4%b8%8d%e6%9c%83%e6%ad%b8%e9%9b%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;根據 GitHub Issue &lt;a
href="https://github.com/kubernetes/kubernetes/issues/71421"target="_blank" rel="noopener"&gt;#71421&lt;/a&gt; 的討論,PodGC 的設計行為是:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The current behavior seems to allow the terminated Pod amount fluctuate above and under the threshold, instead of clean up completely when threshold is met.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;實例&lt;/strong&gt;:假設 threshold = 500,當 terminated Pod 達到 600 時,GC 會刪掉 100 個(600 - 500),讓數量回到 500,&lt;strong&gt;而不是全部清光&lt;/strong&gt;。這個設計是刻意的。&lt;/p&gt;
&lt;h4&gt;細節 2:threshold ≤ 0 代表停用 GC&lt;span class="hx:absolute hx:-mt-20" id="細節-2threshold--0-代表停用-gc"&gt;&lt;/span&gt;
&lt;a href="#%e7%b4%b0%e7%af%80-2threshold--0-%e4%bb%a3%e8%a1%a8%e5%81%9c%e7%94%a8-gc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;blockquote&gt;
&lt;p&gt;when set &lt;code&gt;terminated-pod-gc-threshold &amp;lt;= 0&lt;/code&gt;, the terminated pod garbage collector is disabled.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4&gt;細節 3:GC 檢查週期&lt;span class="hx:absolute hx:-mt-20" id="細節-3gc-檢查週期"&gt;&lt;/span&gt;
&lt;a href="#%e7%b4%b0%e7%af%80-3gc-%e6%aa%a2%e6%9f%a5%e9%80%b1%e6%9c%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;原始碼中有個常數 &lt;code&gt;gcCheckPeriod&lt;/code&gt;,預設是 &lt;strong&gt;20 秒&lt;/strong&gt;。也就是 PodGC Controller 每 20 秒會檢查一次是否需要清理。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;四、驗證實驗:用 Kind 驗證 &lt;code&gt;terminated-pod-gc-threshold&lt;/code&gt;&lt;span class="hx:absolute hx:-mt-20" id="四驗證實驗用-kind-驗證-terminated-pod-gc-threshold"&gt;&lt;/span&gt;
&lt;a href="#%e5%9b%9b%e9%a9%97%e8%ad%89%e5%af%a6%e9%a9%97%e7%94%a8-kind-%e9%a9%97%e8%ad%89-terminated-pod-gc-threshold" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;4.1 實驗設計&lt;span class="hx:absolute hx:-mt-20" id="41-實驗設計"&gt;&lt;/span&gt;
&lt;a href="#41-%e5%af%a6%e9%a9%97%e8%a8%ad%e8%a8%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;設定值&lt;/th&gt;
&lt;th&gt;設計目的&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;叢集&lt;/td&gt;
&lt;td&gt;Kind 本機叢集&lt;/td&gt;
&lt;td&gt;快速建置、可改 controller-manager 參數&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;threshold&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;500&lt;/strong&gt;(接近真實情境)&lt;/td&gt;
&lt;td&gt;驗證實際設定檔的值&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Job 數量&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;600 個&lt;/strong&gt;(超過 threshold 100 個)&lt;/td&gt;
&lt;td&gt;驗證超量時的清理行為&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;觀察點 1&lt;/td&gt;
&lt;td&gt;Job 全部完成瞬間的 terminated Pod 數量&lt;/td&gt;
&lt;td&gt;應該是 600&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;觀察點 2&lt;/td&gt;
&lt;td&gt;GC 週期後(等 30~60 秒)&lt;/td&gt;
&lt;td&gt;應該被砍到 500 左右&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;觀察點 3&lt;/td&gt;
&lt;td&gt;被保留的 Pod creationTimestamp&lt;/td&gt;
&lt;td&gt;應該是較新的 500 個(舊的被刪)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h3&gt;4.2 完整實驗步驟&lt;span class="hx:absolute hx:-mt-20" id="42-完整實驗步驟"&gt;&lt;/span&gt;
&lt;a href="#42-%e5%ae%8c%e6%95%b4%e5%af%a6%e9%a9%97%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;Step 1: 建立 Kind 叢集並掛入自訂的 controller-manager 參數&lt;span class="hx:absolute hx:-mt-20" id="step-1-建立-kind-叢集並掛入自訂的-controller-manager-參數"&gt;&lt;/span&gt;
&lt;a href="#step-1-%e5%bb%ba%e7%ab%8b-kind-%e5%8f%a2%e9%9b%86%e4%b8%a6%e6%8e%9b%e5%85%a5%e8%87%aa%e8%a8%82%e7%9a%84-controller-manager-%e5%8f%83%e6%95%b8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;建立 &lt;code&gt;kind-config.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Cluster&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;kind.x-k8s.io/v1alpha4&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;podgc-test&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;nodes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;control-plane&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;kubeadmConfigPatches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="sd"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; kind: ClusterConfiguration
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; controllerManager:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; extraArgs:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; terminated-pod-gc-threshold: &amp;#34;500&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;worker&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;worker&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;建立叢集:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kind create cluster --config kind-config.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;Step 2: 驗證參數有正確套用到 kube-controller-manager&lt;span class="hx:absolute hx:-mt-20" id="step-2-驗證參數有正確套用到-kube-controller-manager"&gt;&lt;/span&gt;
&lt;a href="#step-2-%e9%a9%97%e8%ad%89%e5%8f%83%e6%95%b8%e6%9c%89%e6%ad%a3%e7%a2%ba%e5%a5%97%e7%94%a8%e5%88%b0-kube-controller-manager" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 進入 control-plane 容器查看 manifest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; podgc-test-control-plane &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; cat /etc/kubernetes/manifests/kube-controller-manager.yaml &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep terminated-pod-gc-threshold
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 應該看到: --terminated-pod-gc-threshold=500&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;另一個驗證方式是看 controller-manager Pod 的 command:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system get pod -l &lt;span class="nv"&gt;component&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kube-controller-manager &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].spec.containers[0].command}&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; tr &lt;span class="s1"&gt;&amp;#39;,&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;\n&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep terminated&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;Step 3: 建立 600 個會立即完成的 Job&lt;span class="hx:absolute hx:-mt-20" id="step-3-建立-600-個會立即完成的-job"&gt;&lt;/span&gt;
&lt;a href="#step-3-%e5%bb%ba%e7%ab%8b-600-%e5%80%8b%e6%9c%83%e7%ab%8b%e5%8d%b3%e5%ae%8c%e6%88%90%e7%9a%84-job" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;準備腳本 &lt;code&gt;create-jobs.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;set&lt;/span&gt; -e
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;NAMESPACE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;podgc-test&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl create namespace &lt;span class="nv"&gt;$NAMESPACE&lt;/span&gt; --dry-run&lt;span class="o"&gt;=&lt;/span&gt;client -o yaml &lt;span class="p"&gt;|&lt;/span&gt; kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;for&lt;/span&gt; i in &lt;span class="k"&gt;$(&lt;/span&gt;seq &lt;span class="m"&gt;1&lt;/span&gt; 600&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; cat &lt;span class="s"&gt;&amp;lt;&amp;lt;EOF | kubectl apply -f - &amp;gt;/dev/null
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;apiVersion: batch/v1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;kind: Job
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: quickjob-$(printf &amp;#34;%03d&amp;#34; $i)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; namespace: $NAMESPACE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ttlSecondsAfterFinished: 99999 # 避免 Job controller 自己先清掉 Pod,干擾實驗
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; backoffLimit: 0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; template:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; restartPolicy: Never
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; containers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; image: busybox:1.36
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; command: [&amp;#34;sh&amp;#34;, &amp;#34;-c&amp;#34;, &amp;#34;echo done&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# 每 50 個稍微喘一下,避免 API Server 過載&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt; i % &lt;span class="nv"&gt;50&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Created &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt; jobs...&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; sleep &lt;span class="m"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;All 600 jobs submitted.&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;關鍵設計&lt;/strong&gt;:&lt;code&gt;ttlSecondsAfterFinished&lt;/code&gt; 設得很大,是為了&lt;strong&gt;排除 Job Controller 的 TTL 機制&lt;/strong&gt;(那是另一個清理機制),確保清理行為&lt;strong&gt;只由 PodGC 觸發&lt;/strong&gt;,這樣實驗才乾淨。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;執行:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x create-jobs.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./create-jobs.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;Step 4: 持續觀察 terminated Pod 數量變化&lt;span class="hx:absolute hx:-mt-20" id="step-4-持續觀察-terminated-pod-數量變化"&gt;&lt;/span&gt;
&lt;a href="#step-4-%e6%8c%81%e7%ba%8c%e8%a7%80%e5%af%9f-terminated-pod-%e6%95%b8%e9%87%8f%e8%ae%8a%e5%8c%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;開啟另一個終端機,跑一個監控腳本 &lt;code&gt;watch-gc.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;NAMESPACE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;podgc-test&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;while&lt;/span&gt; true&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;TS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;date &lt;span class="s1"&gt;&amp;#39;+%H:%M:%S&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;TOTAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pods -n &lt;span class="nv"&gt;$NAMESPACE&lt;/span&gt; -o json 2&amp;gt;/dev/null &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; jq &lt;span class="s1"&gt;&amp;#39;[.items[] | select(.status.phase==&amp;#34;Succeeded&amp;#34; or .status.phase==&amp;#34;Failed&amp;#34;)] | length&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;RUNNING&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pods -n &lt;span class="nv"&gt;$NAMESPACE&lt;/span&gt; -o json 2&amp;gt;/dev/null &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; jq &lt;span class="s1"&gt;&amp;#39;[.items[] | select(.status.phase==&amp;#34;Running&amp;#34; or .status.phase==&amp;#34;Pending&amp;#34;)] | length&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;[&lt;/span&gt;&lt;span class="nv"&gt;$TS&lt;/span&gt;&lt;span class="s2"&gt;] terminated=&lt;/span&gt;&lt;span class="nv"&gt;$TOTAL&lt;/span&gt;&lt;span class="s2"&gt; active=&lt;/span&gt;&lt;span class="nv"&gt;$RUNNING&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; sleep &lt;span class="m"&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;done&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x watch-gc.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./watch-gc.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;Step 5: 預期觀察結果&lt;span class="hx:absolute hx:-mt-20" id="step-5-預期觀察結果"&gt;&lt;/span&gt;
&lt;a href="#step-5-%e9%a0%90%e6%9c%9f%e8%a7%80%e5%af%9f%e7%b5%90%e6%9e%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;您會看到類似以下的輸出序列:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[14:30:05] terminated=0 active=120 # Job 開始跑
[14:30:10] terminated=45 active=200
[14:30:20] terminated=180 active=300
[14:30:30] terminated=420 active=180
[14:30:40] terminated=590 active=10 # 接近高峰
[14:30:45] terminated=600 active=0 # 全部完成
[14:30:50] terminated=600 active=0
[14:30:55] terminated=600 active=0
[14:31:05] terminated=500 active=0 # ← GC 觸發!砍掉 100 個
[14:31:10] terminated=500 active=0 # 穩定在 threshold&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;驗證點&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ 高峰值達到 &lt;strong&gt;600&lt;/strong&gt; → 證明 Pod 確實累積&lt;/li&gt;
&lt;li&gt;✅ GC 觸發後剩 &lt;strong&gt;500&lt;/strong&gt;(而非 0) → 驗證「只砍超出部分」的設計&lt;/li&gt;
&lt;li&gt;✅ GC 觸發延遲 &lt;strong&gt;15~20 秒&lt;/strong&gt; → 對應原始碼中的 &lt;code&gt;gcCheckPeriod = 20s&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Step 6: 驗證「刪除順序是從最舊開始」&lt;span class="hx:absolute hx:-mt-20" id="step-6-驗證刪除順序是從最舊開始"&gt;&lt;/span&gt;
&lt;a href="#step-6-%e9%a9%97%e8%ad%89%e5%88%aa%e9%99%a4%e9%a0%86%e5%ba%8f%e6%98%af%e5%be%9e%e6%9c%80%e8%88%8a%e9%96%8b%e5%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 看留下來的 Pod 中,最早的 creationTimestamp 是什麼時候&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n podgc-test &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --field-selector&lt;span class="o"&gt;=&lt;/span&gt;status.phase&lt;span class="o"&gt;=&lt;/span&gt;Succeeded &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --sort-by&lt;span class="o"&gt;=&lt;/span&gt;.metadata.creationTimestamp &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o custom-columns&lt;span class="o"&gt;=&lt;/span&gt;NAME:.metadata.name,CREATED:.metadata.creationTimestamp &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; head -5
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 對照實驗:最早的 100 個 Pod(quickjob-001 ~ quickjob-100)應該都不見了&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pod quickjob-001 -n podgc-test 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -i &lt;span class="s2"&gt;&amp;#34;not found&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pod quickjob-600 -n podgc-test &lt;span class="c1"&gt;# 應該還在&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果 &lt;code&gt;quickjob-001&lt;/code&gt; 找不到、&lt;code&gt;quickjob-600&lt;/code&gt; 還在,就&lt;strong&gt;印證了原始碼中的排序刪除邏輯&lt;/strong&gt;:最舊的優先刪除。&lt;/p&gt;
&lt;h4&gt;Step 7: 查看 controller-manager 的 log 做最後驗證&lt;span class="hx:absolute hx:-mt-20" id="step-7-查看-controller-manager-的-log-做最後驗證"&gt;&lt;/span&gt;
&lt;a href="#step-7-%e6%9f%a5%e7%9c%8b-controller-manager-%e7%9a%84-log-%e5%81%9a%e6%9c%80%e5%be%8c%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system logs -l &lt;span class="nv"&gt;component&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kube-controller-manager &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --tail&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;200&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep -i &lt;span class="s2"&gt;&amp;#34;podgc\|garbage&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;會看到類似:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;I0423 14:31:05.123456 podgc_controller.go:xxx] &amp;#34;PodGC is force deleting Pod&amp;#34; pod=&amp;#34;podgc-test/quickjob-001&amp;#34;
I0423 14:31:05.234567 podgc_controller.go:xxx] &amp;#34;PodGC is force deleting Pod&amp;#34; pod=&amp;#34;podgc-test/quickjob-002&amp;#34;
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;這直接證明 &lt;strong&gt;PodGC Controller 確實在依照您設定的 threshold 工作&lt;/strong&gt;。&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;4.3 實驗清理&lt;span class="hx:absolute hx:-mt-20" id="43-實驗清理"&gt;&lt;/span&gt;
&lt;a href="#43-%e5%af%a6%e9%a9%97%e6%b8%85%e7%90%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kind delete cluster --name podgc-test&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;五、整體驗證流程總結&lt;span class="hx:absolute hx:-mt-20" id="五整體驗證流程總結"&gt;&lt;/span&gt;
&lt;a href="#%e4%ba%94%e6%95%b4%e9%ab%94%e9%a9%97%e8%ad%89%e6%b5%81%e7%a8%8b%e7%b8%bd%e7%b5%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;原始碼層面定義 terminated
└─ status.phase ∈ {Succeeded, Failed}
│
▼
kubectl 指令層面驗證
└─ --field-selector=status.phase=Succeeded/Failed
│
▼
實驗層面驗證(Kind &amp;#43; 600 Jobs &amp;#43; threshold=500)
├─ 驗證點 1: 達到 600 → 證明 Pod 有累積
├─ 驗證點 2: 砍到剩 500 → 證明 threshold 精準生效
├─ 驗證點 3: 留下的是新的 → 證明 oldest-first 排序
└─ 驗證點 4: controller-manager log 有 GC 紀錄 → 直接證據&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;六、參考資料&lt;span class="hx:absolute hx:-mt-20" id="六參考資料"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%ad%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;類型&lt;/th&gt;
&lt;th&gt;連結&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PodGC 原始碼&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/podgc/gc_controller.go"target="_blank" rel="noopener"&gt;https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/podgc/gc_controller.go&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PodGC 套件說明&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/podgc/doc.go"target="_blank" rel="noopener"&gt;https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/podgc/doc.go&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PodGC 行為討論 Issue&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://github.com/kubernetes/kubernetes/issues/71421"target="_blank" rel="noopener"&gt;https://github.com/kubernetes/kubernetes/issues/71421&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enhancement Proposal&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://github.com/kubernetes/enhancements/issues/2890"target="_blank" rel="noopener"&gt;https://github.com/kubernetes/enhancements/issues/2890&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pod Lifecycle 官方文件&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/"target="_blank" rel="noopener"&gt;https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;kubeadm ClusterConfiguration&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/"target="_blank" rel="noopener"&gt;https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kind 官方文件&lt;/td&gt;
&lt;td&gt;&lt;a
href="https://kind.sigs.k8s.io/"target="_blank" rel="noopener"&gt;https://kind.sigs.k8s.io/&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;本文件由 Claude 整理自對話紀錄,供學習與參考使用。&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Cilium Gateway API</title><link>https://blog.kubeantony.com/archive/kubernetes/cilium-gateway-api/</link><pubDate>Mon, 20 Apr 2026 02:44:58 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/cilium-gateway-api/</guid><description>
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;適用環境：&lt;/strong&gt; RKE2 bare-metal / VM + 外部 F5 / Nginx L4 LB
&lt;strong&gt;Envoy 模式：&lt;/strong&gt; Standalone DaemonSet（Cilium 1.16+ 預設）
&lt;strong&gt;目標：&lt;/strong&gt; 讓 Cilium Gateway API 透過 hostNetwork 直接在 worker node 上監聽 80/443，由外部 LB 分流&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;架構總覽&lt;span class="hx:absolute hx:-mt-20" id="架構總覽"&gt;&lt;/span&gt;
&lt;a href="#%e6%9e%b6%e6%a7%8b%e7%b8%bd%e8%a6%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/BJ-eyKys-g.png" alt="Cilium Gateway API Host Network 流量架構圖" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;流量路徑說明：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;外部 Client 發出請求&lt;/li&gt;
&lt;li&gt;F5 / Nginx (L4 LB) 將流量分發到 3 台標記為 &lt;code&gt;role=gateway&lt;/code&gt; 的 worker node IP&lt;/li&gt;
&lt;li&gt;每台 worker node 上的 Cilium Envoy 以 hostNetwork 模式監聽 80/443&lt;/li&gt;
&lt;li&gt;Cilium 的 eBPF 透過 TPROXY 機制將封包透明轉發給 Envoy&lt;/li&gt;
&lt;li&gt;Gateway API 的 HTTPRoute 根據 host / path 規則路由到對應的後端 K8s Service&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;前置條件&lt;span class="hx:absolute hx:-mt-20" id="前置條件"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Cilium 版本 &amp;gt;= 1.16（hostNetwork 模式自 1.16 起支援）&lt;/li&gt;
&lt;li&gt;Gateway API CRDs 已安裝&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubeProxyReplacement&lt;/code&gt; 已啟用&lt;/li&gt;
&lt;li&gt;至少 3 台 worker node 可供對外使用&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;Step 0：事前確認與備份&lt;span class="hx:absolute hx:-mt-20" id="step-0事前確認與備份"&gt;&lt;/span&gt;
&lt;a href="#step-0%e4%ba%8b%e5%89%8d%e7%a2%ba%e8%aa%8d%e8%88%87%e5%82%99%e4%bb%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;確認 Cilium 版本：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cilium version
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;helm list -n kube-system &lt;span class="p"&gt;|&lt;/span&gt; grep cilium&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;匯出目前的 Helm values 備份（重要，萬一需要 rollback）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;helm get values cilium -n kube-system -o yaml &amp;gt; cilium-backup-values.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;Step 1：為 Worker Node 打上 Label&lt;span class="hx:absolute hx:-mt-20" id="step-1為-worker-node-打上-label"&gt;&lt;/span&gt;
&lt;a href="#step-1%e7%82%ba-worker-node-%e6%89%93%e4%b8%8a-label" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;選擇要對外的 3 台 worker node，為它們打上 &lt;code&gt;role=gateway&lt;/code&gt; label：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl label node &amp;lt;worker-node-1&amp;gt; &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gateway
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl label node &amp;lt;worker-node-2&amp;gt; &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gateway
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl label node &amp;lt;worker-node-3&amp;gt; &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gateway&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證 label 是否正確：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get nodes -l &lt;span class="nv"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gateway&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
worker-node-1 Ready &amp;lt;none&amp;gt; 30d v1.xx.x
worker-node-2 Ready &amp;lt;none&amp;gt; 30d v1.xx.x
worker-node-3 Ready &amp;lt;none&amp;gt; 30d v1.xx.x&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;Step 2：準備 Helm Values 檔案&lt;span class="hx:absolute hx:-mt-20" id="step-2準備-helm-values-檔案"&gt;&lt;/span&gt;
&lt;a href="#step-2%e6%ba%96%e5%82%99-helm-values-%e6%aa%94%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;建立 &lt;code&gt;cilium-gateway-hostnetwork-values.yaml&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# ── Gateway API 設定 ──────────────────────────────────────────&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;gatewayAPI&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;hostNetwork&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# 只在有 role=gateway label 的 node 上暴露 listener&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# 如果要所有 node 都暴露，移除 nodes 區塊即可&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;nodes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;gateway&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# ── Envoy (Standalone DaemonSet 模式) ────────────────────────&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;envoy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;enabled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;securityContext&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# 允許 Envoy bind 80/443 等 privileged port&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;keepCapNetBindService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;envoy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;NET_ADMIN&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;PERFMON&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;BPF&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;NET_BIND_SERVICE&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# ── 基礎設定（通常已在現有 values 中，僅供確認）──────────────&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kubeProxyReplacement&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;重點說明：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gatewayAPI.hostNetwork.enabled: true&lt;/code&gt;：啟用後會自動停用 LoadBalancer type Service，兩者互斥（Cilium 不再為 Gateway 建立 LoadBalancer type Service，改為直接在 host network 上監聽。）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gatewayAPI.hostNetwork.nodes.matchLabels&lt;/code&gt;：控制只在指定 node 上暴露 listener&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NET_BIND_SERVICE&lt;/code&gt; capability：允許 Envoy bind 80/443 等 1024 以下的 privileged port&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;Step 3：執行 Helm Upgrade&lt;span class="hx:absolute hx:-mt-20" id="step-3執行-helm-upgrade"&gt;&lt;/span&gt;
&lt;a href="#step-3%e5%9f%b7%e8%a1%8c-helm-upgrade" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;helm upgrade cilium cilium/cilium &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --namespace kube-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --reuse-values &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -f cilium-gateway-hostnetwork-values.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; &lt;code&gt;--reuse-values&lt;/code&gt; 會保留現有的所有設定，只覆蓋 values 檔案中指定的項目。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;Step 4：重啟 Cilium 元件&lt;span class="hx:absolute hx:-mt-20" id="step-4重啟-cilium-元件"&gt;&lt;/span&gt;
&lt;a href="#step-4%e9%87%8d%e5%95%9f-cilium-%e5%85%83%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Helm upgrade 後需重啟相關元件使設定生效：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout restart deployment/cilium-operator
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout restart daemonset/cilium
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout restart daemonset/cilium-envoy&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;等待所有 Pod 就緒：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout status deployment/cilium-operator --timeout&lt;span class="o"&gt;=&lt;/span&gt;120s
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout status daemonset/cilium --timeout&lt;span class="o"&gt;=&lt;/span&gt;120s
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n kube-system rollout status daemonset/cilium-envoy --timeout&lt;span class="o"&gt;=&lt;/span&gt;120s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 Cilium 整體狀態正常：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cilium status&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;Step 5：安裝 Gateway API CRDs&lt;span class="hx:absolute hx:-mt-20" id="step-5安裝-gateway-api-crds"&gt;&lt;/span&gt;
&lt;a href="#step-5%e5%ae%89%e8%a3%9d-gateway-api-crds" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.4.1/config/crd/standard/gateway.networking.k8s.io_gatewayclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.4.1/config/crd/standard/gateway.networking.k8s.io_gateways.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.4.1/config/crd/standard/gateway.networking.k8s.io_httproutes.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.4.1/config/crd/standard/gateway.networking.k8s.io_referencegrants.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/gateway-api/v1.4.1/config/crd/standard/gateway.networking.k8s.io_grpcroutes.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 GatewayClass 已存在：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get gatewayclass&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CONTROLLER ACCEPTED AGE
cilium io.cilium/gateway-controller True 3m52s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step 6：部署 Demo App&lt;span class="hx:absolute hx:-mt-20" id="step-6部署-demo-app"&gt;&lt;/span&gt;
&lt;a href="#step-6%e9%83%a8%e7%bd%b2-demo-app" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.11/samples/bookinfo/platform/kube/bookinfo.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢視 Pods&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
details-v1-75c85494bb-b76bs 1/1 Running 0 36s
productpage-v1-7c9bf9c988-f7cpf 1/1 Running 0 36s
ratings-v1-6456c55c66-7fczr 1/1 Running 0 36s
reviews-v1-545b8ff7c8-4fdxk 1/1 Running 0 36s
reviews-v2-5f6c87ccdb-68ws8 1/1 Running 0 36s
reviews-v3-74fb78c454-2s6ng 1/1 Running 0 36s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step 7：Deploy the Cilium Gateway&lt;span class="hx:absolute hx:-mt-20" id="step-7deploy-the-cilium-gateway"&gt;&lt;/span&gt;
&lt;a href="#step-7deploy-the-cilium-gateway" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;⚠️ 關於 &lt;code&gt;spec.addresses&lt;/code&gt; 欄位：&lt;/strong&gt; 由於 &lt;a
href="https://github.com/cilium/cilium/issues/42786"target="_blank" rel="noopener"&gt;Issue #42786&lt;/a&gt; 的緣故，hostNetwork 模式下此欄位&lt;strong&gt;不會生效也不會被填入 Gateway status&lt;/strong&gt;。以下 YAML 中保留此欄位僅作為「此 Gateway 實際對外的 node IP」的文件化註記，Cilium 並不會使用它來分配位址。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: my-gateway
spec:
gatewayClassName: cilium
addresses:
- type: IPAddress
value: &amp;#34;192.168.11.173&amp;#34;
- type: IPAddress
value: &amp;#34;192.168.11.174&amp;#34;
- type: IPAddress
value: &amp;#34;192.168.11.175&amp;#34;
listeners:
- protocol: HTTP
port: 80
name: web-gw
allowedRoutes:
namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: http-app-1
spec:
parentRefs:
- name: my-gateway
namespace: default
rules:
- matches:
- path:
type: PathPrefix
value: /details
backendRefs:
- name: details
port: 9080
- matches:
- headers:
- type: Exact
name: magic
value: foo
queryParams:
- type: Exact
name: great
value: example
path:
type: PathPrefix
value: /
method: GET
backendRefs:
- name: productpage
port: 9080
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step 8：驗證端到端連通&lt;span class="hx:absolute hx:-mt-20" id="step-8驗證端到端連通"&gt;&lt;/span&gt;
&lt;a href="#step-8%e9%a9%97%e8%ad%89%e7%ab%af%e5%88%b0%e7%ab%af%e9%80%a3%e9%80%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;⚠️ 驗證方法變更：&lt;/strong&gt; 由於 &lt;a
href="https://github.com/cilium/cilium/issues/42786"target="_blank" rel="noopener"&gt;Issue #42786&lt;/a&gt;，Gateway 層的 &lt;code&gt;Programmed&lt;/code&gt; 條件會永遠是 &lt;code&gt;False&lt;/code&gt;，因此&lt;strong&gt;不能&lt;/strong&gt;用它來判定部署成功。請改用以下方法驗證。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;8.1 檢查 Gateway 與 Listener 狀態（預期輸出已修正）&lt;span class="hx:absolute hx:-mt-20" id="81-檢查-gateway-與-listener-狀態預期輸出已修正"&gt;&lt;/span&gt;
&lt;a href="#81-%e6%aa%a2%e6%9f%a5-gateway-%e8%88%87-listener-%e7%8b%80%e6%85%8b%e9%a0%90%e6%9c%9f%e8%bc%b8%e5%87%ba%e5%b7%b2%e4%bf%ae%e6%ad%a3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get gateway my-gateway
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl describe gateway my-gateway&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;預期輸出（受 Issue #42786 影響）：&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CLASS ADDRESS PROGRAMMED AGE
my-gateway cilium False 1m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在 &lt;code&gt;kubectl describe gateway&lt;/code&gt; 的輸出中，請確認以下條件皆為 &lt;strong&gt;True&lt;/strong&gt;（這些才是部署成功的實際指標）：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;層級&lt;/th&gt;
&lt;th&gt;Condition Type&lt;/th&gt;
&lt;th&gt;預期 Status&lt;/th&gt;
&lt;th&gt;預期 Reason&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gateway&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Accepted&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;True&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Accepted&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Listener&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Accepted&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;True&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Accepted&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Listener&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ResolvedRefs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;True&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ResolvedRefs&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gateway&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Programmed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;False（&lt;strong&gt;Known Issue，忽略&lt;/strong&gt;）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;AddressNotAssigned&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Listener&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Programmed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;False（&lt;strong&gt;Known Issue，忽略&lt;/strong&gt;）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Pending&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;只要上表中 &lt;code&gt;Accepted&lt;/code&gt; 與 &lt;code&gt;ResolvedRefs&lt;/code&gt; 為 True，即代表 Gateway 設定被成功接受與解析，可以進入下一步實際連通驗證。&lt;/p&gt;
&lt;h3&gt;8.2 確認 Envoy 已在 Gateway node 上監聽&lt;span class="hx:absolute hx:-mt-20" id="82-確認-envoy-已在-gateway-node-上監聽"&gt;&lt;/span&gt;
&lt;a href="#82-%e7%a2%ba%e8%aa%8d-envoy-%e5%b7%b2%e5%9c%a8-gateway-node-%e4%b8%8a%e7%9b%a3%e8%81%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;SSH 到任一 gateway node，確認 Envoy 有在監聽 80 port：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ss -tlnp &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s1"&gt;&amp;#39;:80&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;應該可以看到 &lt;code&gt;cilium-envoy&lt;/code&gt; 程序正在監聽 &lt;code&gt;0.0.0.0:80&lt;/code&gt;。&lt;/p&gt;
&lt;h3&gt;8.3 從外部實測 HTTP 連通性（&lt;strong&gt;最重要的驗證&lt;/strong&gt;）&lt;span class="hx:absolute hx:-mt-20" id="83-從外部實測-http-連通性最重要的驗證"&gt;&lt;/span&gt;
&lt;a href="#83-%e5%be%9e%e5%a4%96%e9%83%a8%e5%af%a6%e6%b8%ac-http-%e9%80%a3%e9%80%9a%e6%80%a7%e6%9c%80%e9%87%8d%e8%a6%81%e7%9a%84%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;從外部用 3 台 gateway node 的 IP 分別測試：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -H &lt;span class="s2"&gt;&amp;#34;Host: app.example.com&amp;#34;&lt;/span&gt; http://&amp;lt;worker-node-1-ip&amp;gt;/details/1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -H &lt;span class="s2"&gt;&amp;#34;Host: app.example.com&amp;#34;&lt;/span&gt; http://&amp;lt;worker-node-2-ip&amp;gt;/details/1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -H &lt;span class="s2"&gt;&amp;#34;Host: app.example.com&amp;#34;&lt;/span&gt; http://&amp;lt;worker-node-3-ip&amp;gt;/details/1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;只要能成功取得 HTTP 回應，代表整個路徑是通的 —— Gateway status 顯示 &lt;code&gt;Programmed: False&lt;/code&gt; 純粹是 Issue #42786 的顯示問題，不影響流量。&lt;/p&gt;
&lt;h3&gt;8.4 建議作法：用 listener 條件代替 gateway 條件作為自動化等待點&lt;span class="hx:absolute hx:-mt-20" id="84-建議作法用-listener-條件代替-gateway-條件作為自動化等待點"&gt;&lt;/span&gt;
&lt;a href="#84-%e5%bb%ba%e8%ad%b0%e4%bd%9c%e6%b3%95%e7%94%a8-listener-%e6%a2%9d%e4%bb%b6%e4%bb%a3%e6%9b%bf-gateway-%e6%a2%9d%e4%bb%b6%e4%bd%9c%e7%82%ba%e8%87%aa%e5%8b%95%e5%8c%96%e7%ad%89%e5%be%85%e9%bb%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;若有 CI/CD 需要「等待 Gateway 就緒」，請使用以下替代方式之一：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;方式 A：等待 Listener Accepted（不受 Issue #42786 影響）&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;wait&lt;/span&gt; --for&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.status.listeners[0].conditions[?(@.type==&amp;#34;Accepted&amp;#34;)].status}&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; gateway/my-gateway --timeout&lt;span class="o"&gt;=&lt;/span&gt;60s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;方式 B：直接 curl 實測&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;until&lt;/span&gt; curl -sf -H &lt;span class="s2"&gt;&amp;#34;Host: app.example.com&amp;#34;&lt;/span&gt; http://&amp;lt;worker-node-1-ip&amp;gt;/details/1 &amp;gt; /dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; sleep &lt;span class="m"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Gateway is serving traffic&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;⚠️ 請勿使用：&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 這個會永遠 timeout，因為 Programmed 條件受 Issue #42786 影響&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;wait&lt;/span&gt; --for&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;condition&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Programmed gateway/my-gateway --timeout&lt;span class="o"&gt;=&lt;/span&gt;60s&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;F5 / Nginx LB 設定&lt;span class="hx:absolute hx:-mt-20" id="f5--nginx-lb-設定"&gt;&lt;/span&gt;
&lt;a href="#f5--nginx-lb-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在外部 L4 LB 上設定 pool members，指向 3 台 gateway node：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Pool Members&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;worker-node-1-ip&amp;gt;:80&lt;/code&gt;, &lt;code&gt;&amp;lt;worker-node-2-ip&amp;gt;:80&lt;/code&gt;, &lt;code&gt;&amp;lt;worker-node-3-ip&amp;gt;:80&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTPS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;worker-node-1-ip&amp;gt;:443&lt;/code&gt;, &lt;code&gt;&amp;lt;worker-node-2-ip&amp;gt;:443&lt;/code&gt;, &lt;code&gt;&amp;lt;worker-node-3-ip&amp;gt;:443&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Health Check 建議：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;TCP monitor&lt;/strong&gt;（最簡單）：對 port 80 / 443 做 TCP 連線檢查&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HTTP monitor&lt;/strong&gt;（更精確）：HTTP GET &lt;code&gt;/&lt;/code&gt;，回傳 404 也算健康（Envoy 在沒有匹配 route 時的預設行為）&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;💡 提示：&lt;/strong&gt; F5/Nginx 的 pool member 設定&lt;strong&gt;不會&lt;/strong&gt;從 Gateway &lt;code&gt;status.addresses&lt;/code&gt; 讀取。所以 Issue #42786 不影響此設定流程，你仍然是手動指定 3 台 gateway node 的 IP。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;注意事項&lt;span class="hx:absolute hx:-mt-20" id="注意事項"&gt;&lt;/span&gt;
&lt;a href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;hostNetwork 與 LoadBalancer 互斥：&lt;/strong&gt; 啟用 hostNetwork 後，Cilium 不會再為 Gateway 建立 LoadBalancer type Service&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Port 衝突風險：&lt;/strong&gt; 確保 80/443 在 gateway node 上沒有被其他程式佔用（例如原本的 Ingress-Nginx）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;移除舊 Ingress-Nginx：&lt;/strong&gt; 如果要完全切換，記得先停用 RKE2 內建的 Ingress-Nginx，避免 port 衝突&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gateway listener port 唯一性：&lt;/strong&gt; 每個 Gateway 資源的 listener port 在所有 node 上必須唯一&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rollback 方式：&lt;/strong&gt; 如需還原，使用備份的 values 重新 upgrade 即可：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;helm upgrade cilium cilium/cilium &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --namespace kube-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -f cilium-backup-values.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gateway status 顯示問題（Issue #42786）：&lt;/strong&gt; 在 hostNetwork 模式下 Gateway 永遠顯示 &lt;code&gt;Programmed: False&lt;/code&gt; / &lt;code&gt;AddressNotAssigned&lt;/code&gt;，此為已知的 upstream issue（截至 2026-04-20 仍為 Open 狀態，尚無關聯修復 PR）。此現象&lt;strong&gt;僅影響 status 顯示&lt;/strong&gt;，&lt;strong&gt;不影響實際流量&lt;/strong&gt;。驗證部署是否成功請以 Listener 的 &lt;code&gt;Accepted/ResolvedRefs&lt;/code&gt; 條件與實際 &lt;code&gt;curl&lt;/code&gt; 測試為準，詳見 Step 8。&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;⚠️ 已知問題（Known Issue）— 必讀&lt;span class="hx:absolute hx:-mt-20" id="-已知問題known-issue-必讀"&gt;&lt;/span&gt;
&lt;a href="#-%e5%b7%b2%e7%9f%a5%e5%95%8f%e9%a1%8cknown-issue-%e5%bf%85%e8%ae%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Upstream Issue：&lt;/strong&gt; &lt;a
href="https://github.com/cilium/cilium/issues/42786"target="_blank" rel="noopener"&gt;cilium/cilium#42786 — Gateway API with Host Network: Gateway stays PROGRAMMED: False&lt;/a&gt;
&lt;strong&gt;最後確認時間：&lt;/strong&gt; 2026-04-20&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;症狀&lt;span class="hx:absolute hx:-mt-20" id="症狀"&gt;&lt;/span&gt;
&lt;a href="#%e7%97%87%e7%8b%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;code&gt;kubectl get gateway&lt;/code&gt; 的 &lt;strong&gt;ADDRESS 欄空白&lt;/strong&gt;、&lt;strong&gt;&lt;code&gt;PROGRAMMED&lt;/code&gt; 欄顯示 &lt;code&gt;False&lt;/code&gt;&lt;/strong&gt;（Reason: &lt;code&gt;AddressNotAssigned&lt;/code&gt;）。Listener 層的 &lt;code&gt;Programmed&lt;/code&gt; 同樣為 False（Reason: &lt;code&gt;Pending&lt;/code&gt;）。&lt;/p&gt;
&lt;h3&gt;Issue 現狀（截至 2026-04-20）&lt;span class="hx:absolute hx:-mt-20" id="issue-現狀截至-2026-04-20"&gt;&lt;/span&gt;
&lt;a href="#issue-%e7%8f%be%e7%8b%80%e6%88%aa%e8%87%b3-2026-04-20" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;GitHub Issue &lt;strong&gt;仍為 Open 狀態，無關聯修復 PR&lt;/strong&gt;，Cilium v1.19.x 亦未修復。詳細追蹤資訊請見文末附錄。&lt;/p&gt;
&lt;h3&gt;影響範圍與根因&lt;span class="hx:absolute hx:-mt-20" id="影響範圍與根因"&gt;&lt;/span&gt;
&lt;a href="#%e5%bd%b1%e9%9f%bf%e7%af%84%e5%9c%8d%e8%88%87%e6%a0%b9%e5%9b%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;回報者 &lt;code&gt;@dke&lt;/code&gt; 在 issue 中明確指出：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Not a regression, but wanted to state that I can get a working gateway-api if I don&amp;rsquo;t use host network mode, but rather a setup with, for example, cilium and bgp based load balancers.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;也就是說：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;這&lt;strong&gt;不是 regression&lt;/strong&gt;（不是新版本把舊版本弄壞的問題）&lt;/li&gt;
&lt;li&gt;這是 hostNetwork 模式&lt;strong&gt;特有&lt;/strong&gt;的行為——一旦改用 Cilium + BGP LoadBalancer（有真正的 Service 可供 LB-IPAM 指派 IP）就會恢復正常&lt;/li&gt;
&lt;li&gt;根因是 Cilium 的 &lt;code&gt;spec.addresses&lt;/code&gt; 實作與 LB-IPAM 強耦合，而 hostNetwork 模式會停用 LoadBalancer Service，導致 status.addresses 沒有 IP 來源可以填入&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;此問題&lt;strong&gt;不影響&lt;/strong&gt;的部分 ✅&lt;span class="hx:absolute hx:-mt-20" id="此問題不影響的部分-"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a4%e5%95%8f%e9%a1%8c%e4%b8%8d%e5%bd%b1%e9%9f%bf%e7%9a%84%e9%83%a8%e5%88%86-" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;實際流量 routing 完全正常&lt;/strong&gt;：Envoy 仍會在 host 的 80/443 port 監聽，F5 → node IP → Envoy → backend 的路徑運作如預期&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Listener 的 &lt;code&gt;Accepted&lt;/code&gt; 與 &lt;code&gt;ResolvedRefs&lt;/code&gt; 都會是 True&lt;/strong&gt;：代表 Gateway / HTTPRoute 的設定本身是有效、可接受的&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HTTPRoute 功能正常&lt;/strong&gt;：path 比對、header 比對、backend 轉發都會生效&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;此問題&lt;strong&gt;會影響&lt;/strong&gt;的部分 ❌&lt;span class="hx:absolute hx:-mt-20" id="此問題會影響的部分-"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a4%e5%95%8f%e9%a1%8c%e6%9c%83%e5%bd%b1%e9%9f%bf%e7%9a%84%e9%83%a8%e5%88%86-" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kubectl get gateway&lt;/code&gt; 的 ADDRESS 欄永遠是空白&lt;/li&gt;
&lt;li&gt;Gateway 層的 &lt;code&gt;Programmed&lt;/code&gt; 條件永遠是 &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;不可&lt;/strong&gt;使用 &lt;code&gt;kubectl wait --for=condition=programmed gateway/&amp;lt;name&amp;gt;&lt;/code&gt; 作為 CI/CD 或部署自動化的等待條件&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>etcd 寫入一筆資料後，Leader 和 Follower 做了哪些事？</title><link>https://blog.kubeantony.com/archive/kubernetes/etcd-%E5%AF%AB%E5%85%A5%E4%B8%80%E7%AD%86%E8%B3%87%E6%96%99%E5%BE%8C-leader-%E5%92%8C-follower-%E5%81%9A%E4%BA%86%E5%93%AA%E4%BA%9B%E4%BA%8B/</link><pubDate>Mon, 13 Apr 2026 08:58:06 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/etcd-%E5%AF%AB%E5%85%A5%E4%B8%80%E7%AD%86%E8%B3%87%E6%96%99%E5%BE%8C-leader-%E5%92%8C-follower-%E5%81%9A%E4%BA%86%E5%93%AA%E4%BA%9B%E4%BA%8B/</guid><description>
&lt;h2&gt;前置準備&lt;span class="hx:absolute hx:-mt-20" id="前置準備"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 建立 tkha HA 叢集&lt;span class="hx:absolute hx:-mt-20" id="1-建立-tkha-ha-叢集"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%bb%ba%e7%ab%8b-tkha-ha-%e5%8f%a2%e9%9b%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;本實驗需要一個 3 control-plane 的 etcd HA 叢集。如果還沒建立，先用 tk 工具建立：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/tk/bin/kto tkha&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;kto&lt;/code&gt; 會建立叢集並初始化第一個 control-plane（tkha-control-plane），但&lt;strong&gt;不會自動加入另外兩個 control-plane&lt;/strong&gt;。&lt;/p&gt;
&lt;h3&gt;2. 加入另外兩個 Control-plane 節點&lt;span class="hx:absolute hx:-mt-20" id="2-加入另外兩個-control-plane-節點"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%8a%a0%e5%85%a5%e5%8f%a6%e5%a4%96%e5%85%a9%e5%80%8b-control-plane-%e7%af%80%e9%bb%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;確認三個 control-plane 是否都已加入叢集：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl member list -w table&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果只有 1 個 member，需要手動加入另外兩個：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 產生 certificate key 和 join 指令&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CERT_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane bash -c &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;kubeadm init phase upload-certs --upload-certs&amp;#39;&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class="p"&gt;|&lt;/span&gt; tail -1 &lt;span class="p"&gt;|&lt;/span&gt; tr -d &lt;span class="s1"&gt;&amp;#39;\r&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;JOIN_CMD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane bash -c &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;kubeadm token create --print-join-command&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; tr -d &lt;span class="s1"&gt;&amp;#39;\r&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;IGNORE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;--ignore-preflight-errors=SystemVerification&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 加入第二個 control-plane&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane1 bash -c &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$JOIN_CMD&lt;/span&gt;&lt;span class="s2"&gt; --control-plane --certificate-key &lt;/span&gt;&lt;span class="nv"&gt;$CERT_KEY&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$IGNORE&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 等待加入完成&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sleep &lt;span class="m"&gt;30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 加入第三個 control-plane&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane2 bash -c &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$JOIN_CMD&lt;/span&gt;&lt;span class="s2"&gt; --control-plane --certificate-key &lt;/span&gt;&lt;span class="nv"&gt;$CERT_KEY&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$IGNORE&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 等待加入完成&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sleep &lt;span class="m"&gt;30&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;加入後再次確認，應該看到 3 個 member：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl member list -w table&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3. 安裝 host 上的工具&lt;span class="hx:absolute hx:-mt-20" id="3-安裝-host-上的工具"&gt;&lt;/span&gt;
&lt;a href="#3-%e5%ae%89%e8%a3%9d-host-%e4%b8%8a%e7%9a%84%e5%b7%a5%e5%85%b7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# tcpdump — 抓取網路封包&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;which tcpdump &lt;span class="o"&gt;||&lt;/span&gt; sudo apk add tcpdump
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# etcd-dump-logs — 解析 etcd WAL 檔案（需要 Go 環境）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;which etcd-dump-logs &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; go install go.etcd.io/etcd/tools/etcd-dump-logs@latest
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; sudo cp &lt;span class="k"&gt;$(&lt;/span&gt;go env GOPATH&lt;span class="k"&gt;)&lt;/span&gt;/bin/etcd-dump-logs /usr/local/bin/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;容器內的 &lt;code&gt;etcdctl&lt;/code&gt;、&lt;code&gt;crictl&lt;/code&gt;、&lt;code&gt;sed&lt;/code&gt; 是 tkha 叢集自帶的，不需要額外安裝。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;實驗環境&lt;span class="hx:absolute hx:-mt-20" id="實驗環境"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e9%a9%97%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;叢集&lt;/td&gt;
&lt;td&gt;tkha（3 control-plane HA）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;etcd 版本&lt;/td&gt;
&lt;td&gt;3.6.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Leader&lt;/td&gt;
&lt;td&gt;172.22.64.1（tkha-control-plane）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Follower&lt;/td&gt;
&lt;td&gt;172.22.64.2、172.22.64.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Heartbeat 間隔&lt;/td&gt;
&lt;td&gt;250ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Election Timeout&lt;/td&gt;
&lt;td&gt;2500ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;先搞懂這些術語&lt;span class="hx:absolute hx:-mt-20" id="先搞懂這些術語"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%88%e6%90%9e%e6%87%82%e9%80%99%e4%ba%9b%e8%a1%93%e8%aa%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Leader / Follower&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;At any given time, one server is the leader and the others are followers. The leader handles all client requests.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：老大和跟班。叢集中只有一個老大（Leader），其他都是跟班（Follower）。所有寫入都必須先經過老大，由老大負責分發給跟班。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AppendEntries&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;AppendEntries RPCs are initiated by the leader to replicate log entries and to provide a form of heartbeat.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：老大把「要做的事」抄送給跟班的動作。像是老大寫了一張便條紙，影印後發給每個跟班說：「照著做，做完回報。」&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;WAL（Write Ahead Log）&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;The write ahead log is a persistent ordered record of every change made to etcd&amp;rsquo;s data.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：「先寫日記再做事」的日記本。不管是老大還是跟班，收到一筆操作後都要先寫進這本日記。這樣即使突然當機，重開機後看日記就能恢復。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;fsync&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;fsync() transfers all modified in-core data of the file to the disk device, ensuring that all changed data is physically written to disk.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：把資料真正刷到磁碟上。一般寫檔案只是寫到記憶體的快取，斷電就沒了。fsync 強制把快取刷到磁碟，確保斷電也不丟。這是整個流程中最花時間的地方之一。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;ACK（Acknowledgement）&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;A response from a follower indicating that it has successfully written the entry to its log.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：跟班回報「收到，我已經記在日記裡了」。老大要等到夠多跟班回報 ACK 才算寫入成功。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Quorum&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;The minimum number of members that must agree for a change to be committed. For a cluster of N members, quorum is (N/2)+1.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：多數決。超過半數的節點都寫好日記了，才算數。3 個節點需要 2 個同意（老大自己算 1 個，只要再有 1 個跟班 ACK 就夠了）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Commit&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;A log entry is committed once the leader that created the entry has replicated it on a majority of the servers.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：老大確認多數決通過後，把這筆操作正式生效——寫入真正的資料庫（BoltDB），而不只是日記。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RAFT INDEX&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;Each log entry stores a state machine command along with the term number and log index. The log index is an integer that identifies its position in the log.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：每筆操作的全域流水號。老大和跟班共用同一組編號，同一個 index 在所有節點上代表的是同一筆操作。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RAFT TERM&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;原文：&lt;em&gt;Each term begins with an election. Terms act as a logical clock in Raft and allow servers to detect obsolete information.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;白話：老大的「任期編號」。每次選出新老大，term 就加 1。可以把它想成「第幾屆」。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;結果：完整寫入流程&lt;span class="hx:absolute hx:-mt-20" id="結果完整寫入流程"&gt;&lt;/span&gt;
&lt;a href="#%e7%b5%90%e6%9e%9c%e5%ae%8c%e6%95%b4%e5%af%ab%e5%85%a5%e6%b5%81%e7%a8%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;當 Client 執行 &lt;code&gt;etcdctl put /hello world&lt;/code&gt; 時，etcd 內部會經過以下 7 個步驟，Client 才會收到 &amp;ldquo;OK&amp;rdquo;：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;步驟&lt;/th&gt;
&lt;th&gt;誰做的&lt;/th&gt;
&lt;th&gt;做了什麼&lt;/th&gt;
&lt;th&gt;影響因素&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(1)&lt;/td&gt;
&lt;td&gt;Client&lt;/td&gt;
&lt;td&gt;發送 put 請求給 Leader（port 2379）&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(2)&lt;/td&gt;
&lt;td&gt;Leader&lt;/td&gt;
&lt;td&gt;寫入自己的 WAL，fsync 到磁碟&lt;/td&gt;
&lt;td&gt;:floppy_disk: 磁碟延遲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(3)&lt;/td&gt;
&lt;td&gt;Leader&lt;/td&gt;
&lt;td&gt;發送 AppendEntries 給 Follower（port 2380）&lt;/td&gt;
&lt;td&gt;:globe_with_meridians: 網路延遲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(4)&lt;/td&gt;
&lt;td&gt;Follower&lt;/td&gt;
&lt;td&gt;寫入自己的 WAL，fsync 到磁碟&lt;/td&gt;
&lt;td&gt;:floppy_disk: 磁碟延遲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(5)&lt;/td&gt;
&lt;td&gt;Follower&lt;/td&gt;
&lt;td&gt;回覆 ACK 給 Leader&lt;/td&gt;
&lt;td&gt;:globe_with_meridians: 網路延遲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(6)&lt;/td&gt;
&lt;td&gt;Leader&lt;/td&gt;
&lt;td&gt;確認 Quorum（2/3），commit，回覆 Client &amp;ldquo;OK&amp;rdquo;&lt;/td&gt;
&lt;td&gt;:floppy_disk: 磁碟延遲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(7)&lt;/td&gt;
&lt;td&gt;Leader&lt;/td&gt;
&lt;td&gt;非同步通知 Follower commit（Client 已收到 OK）&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;時序圖：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; Client Leader (172.22.64.1) Follower (172.22.64.2)
| | |
| (1) put /hello world | |
| --------------------------&amp;gt; | |
| (port 2379) | |
| | |
| (2) Leader 寫入自己的 WAL |
| (fsync 到磁碟) |
| | |
| | (3) AppendEntries |
| | ----------------------------&amp;gt; |
| | (port 2380, 639 bytes) |
| | |
| | (4) Follower 寫入 WAL
| | (fsync 到磁碟)
| | |
| | (5) ACK |
| | &amp;lt;---------------------------- |
| | (port 2380, 75 bytes) |
| | (間隔 2.040ms) |
| | |
| (6) Quorum 達成 (2/3) |
| Leader commit |
| | |
| &amp;#34;OK&amp;#34; | |
| &amp;lt;-------------------------- | |
| | |
| | (7) 通知 commit（非同步） |
| | ----------------------------&amp;gt; |
| | Follower commit
| | |&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Client 收到 &amp;ldquo;OK&amp;rdquo; 的時間點是在步驟 (6)&lt;/strong&gt;，不是 (7)。Follower commit 是非同步的，不影響 Client 感受到的延遲。&lt;/p&gt;
&lt;p&gt;以下用 5 個實驗，一步一步驗證上述流程是對的。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 1：辨識誰是 Leader&lt;span class="hx:absolute hx:-mt-20" id="驗證-1辨識誰是-leader"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-1%e8%be%a8%e8%ad%98%e8%aa%b0%e6%98%af-leader" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;對應步驟 (1)：Client 要把 put 請求送給 Leader，所以我們先確認誰是 Leader。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --endpoints&lt;span class="o"&gt;=&lt;/span&gt;https://172.22.64.1:2379,https://172.22.64.2:2379,https://172.22.64.3:2379 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; endpoint status -w table&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;（節錄關鍵欄位）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;#43;--------------------------&amp;#43;------------------&amp;#43;---------&amp;#43;-----------&amp;#43;-----------&amp;#43;
| ENDPOINT | ID | VERSION | IS LEADER | RAFT TERM |
&amp;#43;--------------------------&amp;#43;------------------&amp;#43;---------&amp;#43;-----------&amp;#43;-----------&amp;#43;
| https://172.22.64.1:2379 | f49dafb8a84b142e | 3.6.5 | true | 2 |
| https://172.22.64.2:2379 | bc789b7376e525b5 | 3.6.5 | false | 2 |
| https://172.22.64.3:2379 | b8399ab2942e1696 | 3.6.5 | false | 2 |
&amp;#43;--------------------------&amp;#43;------------------&amp;#43;---------&amp;#43;-----------&amp;#43;-----------&amp;#43;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;實際輸出會包含更多欄位（DB SIZE、QUOTA 等），以上只列出關鍵欄位。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;這證明了什麼？&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;172.22.64.1 是 Leader（&lt;code&gt;IS LEADER = true&lt;/code&gt;）&lt;/li&gt;
&lt;li&gt;三個節點的 RAFT TERM 都是 2，代表目前是「第 2 屆」Leader&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 2：開啟 Follower 的 debug log&lt;span class="hx:absolute hx:-mt-20" id="驗證-2開啟-follower-的-debug-log"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-2%e9%96%8b%e5%95%9f-follower-%e7%9a%84-debug-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;為了在後面的驗證中看到 Follower 收到 AppendEntries 的日誌，需要先開啟 debug log。&lt;strong&gt;這個步驟必須在寫入資料之前完成。&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane1 bash -c &lt;span class="s1"&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; sed -i &amp;#34;/- etcd$/a\\ - --log-level=debug&amp;#34; /etc/kubernetes/manifests/etcd.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;kubelet 偵測到 manifest 變更，會自動重啟 Follower 的 etcd pod。等約 1~2 分鐘後確認叢集恢復健康（如果還是 unhealthy，再等 30 秒重試）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --endpoints&lt;span class="o"&gt;=&lt;/span&gt;https://172.22.64.1:2379,https://172.22.64.2:2379,https://172.22.64.3:2379 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; endpoint health -w table&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;（三個 endpoint 都要是 healthy 才能繼續）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;#43;--------------------------&amp;#43;--------&amp;#43;
| ENDPOINT | HEALTH |
&amp;#43;--------------------------&amp;#43;--------&amp;#43;
| https://172.22.64.1:2379 | true |
| https://172.22.64.2:2379 | true |
| https://172.22.64.3:2379 | true |
&amp;#43;--------------------------&amp;#43;--------&amp;#43;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果 172.22.64.2 還是 unhealthy，每隔 30 秒重試一次，直到三個都是 true。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 3：tcpdump 觀察 Leader 發封包給 Follower&lt;span class="hx:absolute hx:-mt-20" id="驗證-3tcpdump-觀察-leader-發封包給-follower"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-3tcpdump-%e8%a7%80%e5%af%9f-leader-%e7%99%bc%e5%b0%81%e5%8c%85%e7%b5%a6-follower" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;對應步驟 (3) 和 (5)：Leader 透過 port 2380 發送 AppendEntries 給 Follower，Follower 回覆 ACK。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;準備：在 host 上啟動 tcpdump&lt;span class="hx:absolute hx:-mt-20" id="準備在-host-上啟動-tcpdump"&gt;&lt;/span&gt;
&lt;a href="#%e6%ba%96%e5%82%99%e5%9c%a8-host-%e4%b8%8a%e5%95%9f%e5%8b%95-tcpdump" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;（Terminal 1）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tcpdump -i any host 172.22.64.1 and host 172.22.64.2 and port &lt;span class="m"&gt;2380&lt;/span&gt; -nn -ttt -q -c &lt;span class="m"&gt;100&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;觸發：寫入一筆資料&lt;span class="hx:absolute hx:-mt-20" id="觸發寫入一筆資料"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%b8%e7%99%bc%e5%af%ab%e5%85%a5%e4%b8%80%e7%ad%86%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;（Terminal 2）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl put /hello &lt;span class="s2"&gt;&amp;#34;world&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;OK&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;tcpdump 抓到的封包&lt;span class="hx:absolute hx:-mt-20" id="tcpdump-抓到的封包"&gt;&lt;/span&gt;
&lt;a href="#tcpdump-%e6%8a%93%e5%88%b0%e7%9a%84%e5%b0%81%e5%8c%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;（Terminal 1，節錄重點）：&lt;/p&gt;
&lt;p&gt;Heartbeat 封包（背景流量，大小固定 ~84-85 bytes）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;00:00:00.000000 IP 172.22.64.1.2380 &amp;gt; 172.22.64.2.43206: tcp 85
00:00:00.000034 IP 172.22.64.2.43206 &amp;gt; 172.22.64.1.2380: tcp 0
00:00:00.000157 IP 172.22.64.2.2380 &amp;gt; 172.22.64.1.58336: tcp 84
00:00:00.000027 IP 172.22.64.1.58336 &amp;gt; 172.22.64.2.2380: tcp 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;資料寫入觸發的封包：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;00:00:00.005596 IP 172.22.64.1.2380 &amp;gt; 172.22.64.2.43192: tcp 639 &amp;lt;-- AppendEntries
00:00:00.000034 IP 172.22.64.2.43192 &amp;gt; 172.22.64.1.2380: tcp 0 &amp;lt;-- TCP ACK
00:00:00.002040 IP 172.22.64.2.2380 &amp;gt; 172.22.64.1.58336: tcp 75 &amp;lt;-- Follower ACK&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;實際的 port 號和封包大小會略有不同，重點是觀察 Leader→Follower 出現一個比 heartbeat 大很多的封包，以及 Follower→Leader 的回覆。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;這證明了什麼？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;步驟 (3) 已驗證&lt;/strong&gt; — Leader (172.22.64.1) 發了一個 &lt;strong&gt;639 bytes&lt;/strong&gt; 的封包給 Follower (172.22.64.2)，比 heartbeat 的 85 bytes 大很多。這就是包含 &lt;code&gt;/hello = world&lt;/code&gt; 的 AppendEntries。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;步驟 (5) 已驗證&lt;/strong&gt; — Follower 在 &lt;strong&gt;2.040ms&lt;/strong&gt; 後回覆了一個 &lt;strong&gt;75 bytes&lt;/strong&gt; 的小封包（ACK），比 request 小很多，只是在說「我記好了」。2.040ms 的間隔就是 Follower 處理 + 寫入 WAL (fsync) 的時間。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 4：debug log 觀察 Follower 收到資料&lt;span class="hx:absolute hx:-mt-20" id="驗證-4debug-log-觀察-follower-收到資料"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-4debug-log-%e8%a7%80%e5%af%9f-follower-%e6%94%b6%e5%88%b0%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;對應步驟 (4)：Follower 收到 AppendEntries 後，寫入自己的 WAL。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane1 bash -c &lt;span class="s1"&gt;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; crictl logs $(crictl ps -q --name etcd) 2&amp;gt;&amp;amp;1 | grep &amp;#34;hello&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;level&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;debug&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;ts&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;2026-04-13T08:17:16.219400Z&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;caller&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;etcdserver/server.go:1971&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;msg&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;applyEntryNormal&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;raftReq&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;header:&amp;lt;ID:1454272925698278610 username:\&amp;#34;kube-apiserver-etcd-client\&amp;#34; auth_revision:1 &amp;gt; put:&amp;lt;key:\&amp;#34;/hello\&amp;#34; value:\&amp;#34;world\&amp;#34; &amp;gt; &amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;實際的 timestamp 和 ID 會不同，重點是看到 &lt;code&gt;applyEntryNormal&lt;/code&gt; 和 &lt;code&gt;put:&amp;lt;key:&amp;quot;/hello&amp;quot; value:&amp;quot;world&amp;quot;&amp;gt;&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;這證明了什麼？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;步驟 (4) 已驗證&lt;/strong&gt; — Follower 的 &lt;code&gt;applyEntryNormal&lt;/code&gt; 日誌明確顯示收到了 &lt;code&gt;put:&amp;lt;key:&amp;quot;/hello&amp;quot; value:&amp;quot;world&amp;quot;&amp;gt;&lt;/code&gt;。這就是 Leader 透過 AppendEntries 送過來的資料，Follower 寫入 WAL 後 apply 到狀態機。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 5：WAL dump 比對 Leader 和 Follower&lt;span class="hx:absolute hx:-mt-20" id="驗證-5wal-dump-比對-leader-和-follower"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-5wal-dump-%e6%af%94%e5%b0%8d-leader-%e5%92%8c-follower" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;對應步驟 (2) 和 (4)：Leader 和 Follower 都會把操作寫入 WAL，兩邊的 WAL 應該包含相同的 entry。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;寫入測試資料&lt;span class="hx:absolute hx:-mt-20" id="寫入測試資料"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%ab%e5%85%a5%e6%b8%ac%e8%a9%a6%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl put /wal-test &lt;span class="s2"&gt;&amp;#34;raft-replicated-data&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;複製 WAL 到 host 並用 etcd-dump-logs 解析&lt;span class="hx:absolute hx:-mt-20" id="複製-wal-到-host-並用-etcd-dump-logs-解析"&gt;&lt;/span&gt;
&lt;a href="#%e8%a4%87%e8%a3%bd-wal-%e5%88%b0-host-%e4%b8%a6%e7%94%a8-etcd-dump-logs-%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 複製 WAL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman cp tkha-control-plane:/var/lib/etcd/member /tmp/leader-member
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman cp tkha-control-plane1:/var/lib/etcd/member /tmp/follower-member
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 建立 etcd-dump-logs 需要的目錄結構&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /tmp/leader-data/member /tmp/follower-data/member
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -sf /tmp/leader-member/wal /tmp/leader-data/member/wal
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -sf /tmp/leader-member/snap /tmp/leader-data/member/snap
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -sf /tmp/follower-member/wal /tmp/follower-data/member/wal
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -sf /tmp/follower-member/snap /tmp/follower-data/member/snap
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Dump Leader WAL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo etcd-dump-logs /tmp/leader-data &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;wal-test&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Dump Follower WAL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo etcd-dump-logs /tmp/follower-data &lt;span class="p"&gt;|&lt;/span&gt; grep &lt;span class="s2"&gt;&amp;#34;wal-test&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;：&lt;/p&gt;
&lt;p&gt;Leader WAL：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; 2 41857 norm header:&amp;lt;ID:1454272925698278720 username:&amp;#34;kube-apiserver-etcd-client&amp;#34; auth_revision:1 &amp;gt; put:&amp;lt;key:&amp;#34;/wal-test&amp;#34; value:&amp;#34;raft-replicated-data&amp;#34; &amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Follower WAL：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; 2 41857 norm header:&amp;lt;ID:1454272925698278720 username:&amp;#34;kube-apiserver-etcd-client&amp;#34; auth_revision:1 &amp;gt; put:&amp;lt;key:&amp;#34;/wal-test&amp;#34; value:&amp;#34;raft-replicated-data&amp;#34; &amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;實際的 index 和 ID 會不同，重點是兩邊的 term、index、data 完全一致。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;這證明了什麼？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;步驟 (2) 和 (4) 已驗證&lt;/strong&gt; — Leader 和 Follower 的 WAL 中都有完全一致的 entry。term、index、data 一模一樣，證明 Leader 複製給 Follower 的是原封不動的 Raft entry。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;驗證 6：從 Follower 讀取確認 commit&lt;span class="hx:absolute hx:-mt-20" id="驗證-6從-follower-讀取確認-commit"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-6%e5%be%9e-follower-%e8%ae%80%e5%8f%96%e7%a2%ba%e8%aa%8d-commit" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;對應步驟 (7)：Leader 非同步通知 Follower commit 後，Follower 應該也能讀到這筆資料。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;執行命令&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl --endpoints&lt;span class="o"&gt;=&lt;/span&gt;https://172.22.64.2:2379 get /hello&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;執行結果&lt;/strong&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/hello
world&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;這證明了什麼？&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;步驟 (7) 已驗證&lt;/strong&gt; — 從 Follower（172.22.64.2）的 endpoint 直接讀取，確認 &lt;code&gt;/hello = world&lt;/code&gt; 已經 commit 並 apply 到 Follower 的 BoltDB。整個 Raft 寫入流程走完了。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;清理&lt;span class="hx:absolute hx:-mt-20" id="清理"&gt;&lt;/span&gt;
&lt;a href="#%e6%b8%85%e7%90%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 刪除測試 key&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl del /hello
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane etcdctl del /wal-test
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 還原 Follower 的 log level&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; tkha-control-plane1 bash -c &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;sed -i &amp;#34;/--log-level=debug/d&amp;#34; /etc/kubernetes/manifests/etcd.yaml&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 清理 host 上的暫存檔&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo rm -rf /tmp/leader-member /tmp/follower-member /tmp/leader-data /tmp/follower-data&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;驗證結果總表&lt;span class="hx:absolute hx:-mt-20" id="驗證結果總表"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89%e7%b5%90%e6%9e%9c%e7%b8%bd%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;步驟&lt;/th&gt;
&lt;th&gt;理論描述&lt;/th&gt;
&lt;th&gt;驗證編號&lt;/th&gt;
&lt;th&gt;驗證方式&lt;/th&gt;
&lt;th&gt;結果&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(1)&lt;/td&gt;
&lt;td&gt;Client 發送 put 請求&lt;/td&gt;
&lt;td&gt;驗證 3&lt;/td&gt;
&lt;td&gt;etcdctl put&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(2)&lt;/td&gt;
&lt;td&gt;Leader 寫入 WAL&lt;/td&gt;
&lt;td&gt;驗證 5&lt;/td&gt;
&lt;td&gt;WAL dump&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(3)&lt;/td&gt;
&lt;td&gt;Leader 發送 AppendEntries&lt;/td&gt;
&lt;td&gt;驗證 3&lt;/td&gt;
&lt;td&gt;tcpdump: 639B 封包&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(4)&lt;/td&gt;
&lt;td&gt;Follower 寫入 WAL&lt;/td&gt;
&lt;td&gt;驗證 4+5&lt;/td&gt;
&lt;td&gt;debug log + WAL dump&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(5)&lt;/td&gt;
&lt;td&gt;Follower 回覆 ACK&lt;/td&gt;
&lt;td&gt;驗證 3&lt;/td&gt;
&lt;td&gt;tcpdump: 75B 封包, 2.040ms&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(6)&lt;/td&gt;
&lt;td&gt;Leader commit&lt;/td&gt;
&lt;td&gt;驗證 3&lt;/td&gt;
&lt;td&gt;Client 收到 &amp;ldquo;OK&amp;rdquo;&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(7)&lt;/td&gt;
&lt;td&gt;Follower commit&lt;/td&gt;
&lt;td&gt;驗證 6&lt;/td&gt;
&lt;td&gt;從 Follower 讀到 &lt;code&gt;world&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;:white_check_mark:&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;寫入延遲的組成&lt;span class="hx:absolute hx:-mt-20" id="寫入延遲的組成"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%ab%e5%85%a5%e5%bb%b6%e9%81%b2%e7%9a%84%e7%b5%84%e6%88%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Client 感受到的延遲 = (2) Leader fsync &amp;#43; (3) 網路傳輸 &amp;#43; (4) Follower fsync &amp;#43; (5) 網路回覆 &amp;#43; (6) Leader commit
實測：(3) -&amp;gt; (5) 的時間差 = 2.040ms（包含網路 &amp;#43; Follower fsync）&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;因素&lt;/th&gt;
&lt;th&gt;影響的步驟&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;:floppy_disk: &lt;strong&gt;磁碟延遲&lt;/strong&gt;（fsync）&lt;/td&gt;
&lt;td&gt;(2)、(4)、(6)&lt;/td&gt;
&lt;td&gt;每個步驟各需要一次 fsync，把資料刷到磁碟&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;:globe_with_meridians: &lt;strong&gt;網路延遲&lt;/strong&gt;（peer 通訊）&lt;/td&gt;
&lt;td&gt;(3)、(5)&lt;/td&gt;
&lt;td&gt;Leader 和 Follower 之間各需要一次單程傳輸&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</description></item><item><title>Docker Mail Server 完整部署指南</title><link>https://blog.kubeantony.com/archive/container/docker-mail-server-%E5%AE%8C%E6%95%B4%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97/</link><pubDate>Tue, 31 Mar 2026 10:01:38 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/docker-mail-server-%E5%AE%8C%E6%95%B4%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97/</guid><description>
&lt;h2&gt;前置條件&lt;span class="hx:absolute hx:-mt-20" id="前置條件"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;開始部署前，請確認以下環境條件皆已滿足。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;基礎架構&lt;span class="hx:absolute hx:-mt-20" id="基礎架構"&gt;&lt;/span&gt;
&lt;a href="#%e5%9f%ba%e7%a4%8e%e6%9e%b6%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;需求&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;DNS Server&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;內網需有可控的 DNS Server（如 BIND），用於新增 MX / SPF / DKIM / DMARC 等 TXT Record。本文以 &lt;code&gt;nsupdate&lt;/code&gt; 動態更新為例&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;DNS MX Record&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;域名的 MX 記錄需指向 Mail Server（例如 &lt;code&gt;kubeantony.com. MX 10 mx1.kubeantony.com.&lt;/code&gt;）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;DNS A Record&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;Mail Server 主機名需有對應的 A 記錄（例如 &lt;code&gt;mx1.kubeantony.com. A 192.168.11.3&lt;/code&gt;）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;固定 IP&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;建議&lt;/td&gt;
&lt;td&gt;Mail Server 應使用固定 IP，避免 DNS 記錄失效&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Mail Server 主機&lt;span class="hx:absolute hx:-mt-20" id="mail-server-主機"&gt;&lt;/span&gt;
&lt;a href="#mail-server-%e4%b8%bb%e6%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;需求&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;作業系統&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Linux（Debian/Ubuntu/RHEL/Rocky 等）&lt;/td&gt;
&lt;td&gt;需支援 Podman 4.4+&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Podman&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4.4 以上&lt;/td&gt;
&lt;td&gt;需支援 Quadlet（&lt;code&gt;.kube&lt;/code&gt; 單元檔）。確認版本：&lt;code&gt;podman --version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Git&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;用於下載 mkcert 憑證工具&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OpenSSL&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;用於產生自簽憑證及驗證 TLS。確認版本：&lt;code&gt;openssl version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;systemd&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;Quadlet 依賴 systemd generator 產生 service&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;網路 Port&lt;span class="hx:absolute hx:-mt-20" id="網路-port"&gt;&lt;/span&gt;
&lt;a href="#%e7%b6%b2%e8%b7%af-port" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Mail Server 需開放以下 Port（使用 &lt;code&gt;hostNetwork&lt;/code&gt; 模式會直接綁定主機 Port）：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;協定&lt;/th&gt;
&lt;th&gt;服務&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;SMTP&lt;/td&gt;
&lt;td&gt;接收外部郵件&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;465&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;SMTPS&lt;/td&gt;
&lt;td&gt;SMTP over TLS（隱式 TLS）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;587&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Submission&lt;/td&gt;
&lt;td&gt;SMTP 寄信（STARTTLS + 認證）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;993&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;IMAPS&lt;/td&gt;
&lt;td&gt;IMAP over TLS（收信）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;995&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;POP3S&lt;/td&gt;
&lt;td&gt;POP3 over TLS（收信）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11334&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Rspamd Web UI&lt;/td&gt;
&lt;td&gt;Rspamd 管理介面（HTTP）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;測試機器&lt;span class="hx:absolute hx:-mt-20" id="測試機器"&gt;&lt;/span&gt;
&lt;a href="#%e6%b8%ac%e8%a9%a6%e6%a9%9f%e5%99%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;需求&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;同網段的其他機器&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;必須&lt;/td&gt;
&lt;td&gt;測試寄信步驟需在內網其他機器執行（不是 Mail Server 本機）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;s-nail 或 msmtp&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;建議&lt;/td&gt;
&lt;td&gt;用於 SMTP 寄信測試。步驟十一會說明安裝方式&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;dig&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;建議&lt;/td&gt;
&lt;td&gt;用於驗證 DNS Record。安裝：&lt;code&gt;apt install dnsutils&lt;/code&gt; 或 &lt;code&gt;apk add bind-tools&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;快速檢查腳本&lt;span class="hx:absolute hx:-mt-20" id="快速檢查腳本"&gt;&lt;/span&gt;
&lt;a href="#%e5%bf%ab%e9%80%9f%e6%aa%a2%e6%9f%a5%e8%85%b3%e6%9c%ac" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 Mail Server 主機上執行，一次確認所有前置條件：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;SCRIPT&amp;#39; | sudo tee /usr/local/bin/check-mail-prereqs.sh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Mail Server 前置條件檢查腳本
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# 用法：bash check-mail-prereqs.sh &amp;lt;DNS_IP&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;DNS_IP=&amp;#34;${1:?用法: bash $0 &amp;lt;DNS_IP&amp;gt;}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;R=&amp;#39;\033[31m&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;G=&amp;#39;\033[32m&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;N=&amp;#39;\033[0m&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;P=0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;F=0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c(){
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; local label=&amp;#34;$1&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; local cmd=&amp;#34;$2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; if eval &amp;#34;$cmd&amp;#34; &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; echo -e &amp;#34; [${G}PASS${N}] ${label}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ((P++))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; else
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; echo -e &amp;#34; [${R}FAIL${N}] ${label}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ((F++))
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; fi
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# 檢查 Port 是否被非 mail 服務佔用
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# 排除 master (Postfix)、dovecot、rspamd — Container 內的 mail 服務屬正常
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;check_port(){
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; local port=&amp;#34;$1&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ! ss -tlnp 2&amp;gt;/dev/null | grep -E &amp;#34;:${port}\b&amp;#34; | grep -Eqv &amp;#39;master|dovecot|rspamd&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;echo &amp;#34;===== Mail Server 前置條件檢查 =====&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;PODMAN_MAJOR=$(podman --version 2&amp;gt;/dev/null | awk &amp;#39;{print $3}&amp;#39; | cut -d. -f1)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Podman &amp;gt;= 4.4&amp;#34; &amp;#34;test ${PODMAN_MAJOR:-0} -ge 4&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Quadlet generator&amp;#34; &amp;#34;test -f /usr/libexec/podman/quadlet&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;OpenSSL&amp;#34; &amp;#34;openssl version&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Git&amp;#34; &amp;#34;git --version&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;systemd&amp;#34; &amp;#34;systemctl is-system-running | grep -qE &amp;#39;running|degraded&amp;#39;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 25 未被其他服務佔用&amp;#34; &amp;#34;check_port 25&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 465 未被其他服務佔用&amp;#34; &amp;#34;check_port 465&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 587 未被其他服務佔用&amp;#34; &amp;#34;check_port 587&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 993 未被其他服務佔用&amp;#34; &amp;#34;check_port 993&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 995 未被其他服務佔用&amp;#34; &amp;#34;check_port 995&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;Port 11334 未被其他服務佔用&amp;#34; &amp;#34;check_port 11334&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;c &amp;#34;DNS Server ${DNS_IP}&amp;#34; &amp;#34;dig @${DNS_IP} google.com +short +time=3&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;echo &amp;#34;===== ${P} 通過 / ${F} 失敗 =====&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SCRIPT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod +x /usr/local/bin/check-mail-prereqs.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行檢查（帶入 DNS Server IP）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo bash /usr/local/bin/check-mail-prereqs.sh 192.168.11.2 &lt;span class="c1"&gt;# ← 根據環境修改&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; Port 檢查會排除 Postfix（master）、Dovecot、Rspamd，因為使用 &lt;code&gt;hostNetwork&lt;/code&gt; 模式時
Container 內的服務會直接綁定主機 Port，這是正常的。檢查目的是確認沒有&lt;strong&gt;其他非 Mail Server 的服務&lt;/strong&gt;佔用這些 Port。
如果 Mail Server 尚未啟動，所有 Port 檢查應顯示 PASS。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;環境變數速查表&lt;span class="hx:absolute hx:-mt-20" id="環境變數速查表"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e8%ae%8a%e6%95%b8%e9%80%9f%e6%9f%a5%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;後續每個步驟的開頭都會列出該步驟所需的環境變數，請根據你的環境修改後再執行。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;變數&lt;/th&gt;
&lt;th&gt;範例值&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;郵件域名&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MAIL_HOST&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mx1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;郵件主機名稱前綴&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MAIL_FQDN&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mx1.kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;郵件主機 FQDN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MAIL_IP&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;192.168.11.3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mail Server IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DNS_IP&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;192.168.11.2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;內網 DNS Server IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MY_NETWORKS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;127.0.0.0/8,192.168.11.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;允許 relay 的網段&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NET_IF&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ens18&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mail Server 網路介面名稱&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POSTMASTER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bigred&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Postmaster 帳號名稱&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RSPAMD_PW&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;$2$zmnrfh...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rspamd Web UI 密碼 hash&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;一、建立 Container Image&lt;span class="hx:absolute hx:-mt-20" id="一建立-container-image"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%80%e5%bb%ba%e7%ab%8b-container-image" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1.1 建立 Dockerfile&lt;span class="hx:absolute hx:-mt-20" id="11-建立-dockerfile"&gt;&lt;/span&gt;
&lt;a href="#11-%e5%bb%ba%e7%ab%8b-dockerfile" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/zfs/images/dkmail-rspamd
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; | sudo tee /opt/zfs/images/dkmail-rspamd/Dockerfile
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;FROM docker.io/mailserver/docker-mailserver
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ARG DN=&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ENV OVERRIDE_HOSTNAME=&amp;#34;mx1.${DN}&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; DMS_DEBUG=&amp;#34;1&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; POSTMASTER_ADDRESS=&amp;#34;bigred@${DN}&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_RSPAMD=&amp;#34;1&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_OPENDKIM=&amp;#34;0&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_OPENDMARC=&amp;#34;0&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_POLICYD_SPF=&amp;#34;0&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_AMAVIS=&amp;#34;0&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_SPAMASSASSIN=&amp;#34;0&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_IMAP=&amp;#34;1&amp;#34; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ENABLE_POP3=&amp;#34;1&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;RUN apt-get update &amp;amp;&amp;amp; apt-get install -y net-tools curl wget nano &amp;amp;&amp;amp; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; setup email add bigred@${DN} bigred &amp;amp;&amp;amp; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; setup email add rbean@${DN} rbean &amp;amp;&amp;amp; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; setup email add gbean@${DN} gbean &amp;amp;&amp;amp; \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; touch /tmp/docker-mailserver/postfix-main.cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1.2 Build 映像檔&lt;span class="hx:absolute hx:-mt-20" id="12-build-映像檔"&gt;&lt;/span&gt;
&lt;a href="#12-build-%e6%98%a0%e5%83%8f%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman build &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --build-arg &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --format docker &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --no-cache &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -t dkmail.rspamd &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/images/dkmail-rspamd/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1.3 標記映像檔（Kubernetes YAML 需要 localhost 前綴）&lt;span class="hx:absolute hx:-mt-20" id="13-標記映像檔kubernetes-yaml-需要-localhost-前綴"&gt;&lt;/span&gt;
&lt;a href="#13-%e6%a8%99%e8%a8%98%e6%98%a0%e5%83%8f%e6%aa%94kubernetes-yaml-%e9%9c%80%e8%a6%81-localhost-%e5%89%8d%e7%b6%b4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman tag dkmail.rspamd localhost/dkmail.rspamd:latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;二、產生自簽 TLS 憑證&lt;span class="hx:absolute hx:-mt-20" id="二產生自簽-tls-憑證"&gt;&lt;/span&gt;
&lt;a href="#%e4%ba%8c%e7%94%a2%e7%94%9f%e8%87%aa%e7%b0%bd-tls-%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;mx1&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機名稱前綴&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機 FQDN（自動組合）&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2.1 下載 mkcert 工具&lt;span class="hx:absolute hx:-mt-20" id="21-下載-mkcert-工具"&gt;&lt;/span&gt;
&lt;a href="#21-%e4%b8%8b%e8%bc%89-mkcert-%e5%b7%a5%e5%85%b7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo git clone https://github.com/braveantony/mkcert.git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod +x /opt/mkcert/certctl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2.2 編輯設定檔&lt;span class="hx:absolute hx:-mt-20" id="22-編輯設定檔"&gt;&lt;/span&gt;
&lt;a href="#22-%e7%b7%a8%e8%bc%af%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF | sudo tee /opt/mkcert/config
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# CA 相關設定
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;CA_KEY=&amp;#34;ca.key&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;CA_CRT=&amp;#34;ca.crt&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;CA_DAYS=3650
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;CA_SUBJ=&amp;#34;/C=TW/ST=Taipei/L=Taipei/O=${DN}/OU=Mail/CN=${DN} Root CA&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Server 相關設定
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;DOMAIN_NAME=&amp;#34;${DN}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SERVER_KEY=&amp;#34;\${DOMAIN_NAME}.key&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SERVER_CSR=&amp;#34;\${DOMAIN_NAME}.csr&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SERVER_CRT=&amp;#34;\${DOMAIN_NAME}.crt&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SERVER_DAYS=3650
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;SERVER_SUBJ=&amp;#34;/C=TW/ST=Taipei/L=Taipei/O=${DN}/OU=Mail/CN=${MAIL_FQDN}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;V3_EXT=&amp;#34;v3.ext&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ALT_NAMES=(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; &amp;#34;DNS.1=*.\${DOMAIN_NAME}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; &amp;#34;DNS.2=\${DOMAIN_NAME}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; &amp;#34;DNS.3=${MAIL_FQDN}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2.3 產生憑證&lt;span class="hx:absolute hx:-mt-20" id="23-產生憑證"&gt;&lt;/span&gt;
&lt;a href="#23-%e7%94%a2%e7%94%9f%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /opt/mkcert/certctl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2.4 確認產生結果&lt;span class="hx:absolute hx:-mt-20" id="24-確認產生結果"&gt;&lt;/span&gt;
&lt;a href="#24-%e7%a2%ba%e8%aa%8d%e7%94%a2%e7%94%9f%e7%b5%90%e6%9e%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -l /opt/mkcert/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ca.crt # CA 根憑證
ca.key # CA 私鑰
&amp;lt;DN&amp;gt;.crt # 伺服器憑證
&amp;lt;DN&amp;gt;.key # 伺服器私鑰&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;三、部署 TLS 憑證與設定檔&lt;span class="hx:absolute hx:-mt-20" id="三部署-tls-憑證與設定檔"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%89%e9%83%a8%e7%bd%b2-tls-%e6%86%91%e8%ad%89%e8%88%87%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MY_NETWORKS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;127.0.0.0/8,192.168.11.0/24&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 允許 relay 的網段&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;RSPAMD_PW&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;$2$zmnrfhkhbr9sb411b8eykyxgs1do4jeg$3fjncbo78qfsymbzu7nhfi35inhwezqh313trc7if4ie3d6sj1fy&amp;#39;&lt;/span&gt; &lt;span class="c1"&gt;# Rspamd Web UI 密碼 hash&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.1 建立目錄結構&lt;span class="hx:absolute hx:-mt-20" id="31-建立目錄結構"&gt;&lt;/span&gt;
&lt;a href="#31-%e5%bb%ba%e7%ab%8b%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/dkmail/data &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/dkmail/conf/ssl &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/dkmail/conf/rspamd/override.d&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.2 複製憑證&lt;span class="hx:absolute hx:-mt-20" id="32-複製憑證"&gt;&lt;/span&gt;
&lt;a href="#32-%e8%a4%87%e8%a3%bd%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /opt/mkcert/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;.key /opt/zfs/dkmail/conf/ssl/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo bash -c &lt;span class="s2"&gt;&amp;#34;cat \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; /opt/mkcert/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.crt \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; /opt/mkcert/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/ca.crt \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;gt; /opt/zfs/dkmail/conf/ssl/fullchain.pem&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;644&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/fullchain.pem
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;600&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.3 Rspamd 設定&lt;span class="hx:absolute hx:-mt-20" id="33-rspamd-設定"&gt;&lt;/span&gt;
&lt;a href="#33-rspamd-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; | sudo tee /opt/zfs/dkmail/conf/rspamd/override.d/options.inc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;local_networks = [&amp;#34;127.0.0.1/8&amp;#34;];
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF | sudo tee /opt/zfs/dkmail/conf/rspamd/override.d/worker-controller.inc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;password = ${RSPAMD_PW}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; | sudo tee /opt/zfs/dkmail/conf/rspamd/override.d/hfilter.conf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;enabled = false;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.4 Postfix 額外設定&lt;span class="hx:absolute hx:-mt-20" id="34-postfix-額外設定"&gt;&lt;/span&gt;
&lt;a href="#34-postfix-%e9%a1%8d%e5%a4%96%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重要：&lt;/strong&gt; docker-mailserver 透過 &lt;code&gt;SSL_TYPE=manual&lt;/code&gt; 環境變數會自動設定 Postfix TLS（&lt;code&gt;smtpd_tls_chain_files&lt;/code&gt;）、
Dovecot TLS、以及 SASL 認證 socket。&lt;code&gt;postfix-main.cf&lt;/code&gt; 只需放 docker-mailserver 沒有自動處理的額外設定，
不可手動設定 &lt;code&gt;smtpd_tls_cert_file&lt;/code&gt; / &lt;code&gt;smtpd_tls_key_file&lt;/code&gt;，否則會與 &lt;code&gt;smtpd_tls_chain_files&lt;/code&gt; 衝突。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF | sudo tee /opt/zfs/dkmail/conf/postfix-main.cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# Relay 設定（允許內網寄信）
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;mynetworks = ${MY_NETWORKS}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# 寄出郵件啟用 TLS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtp_tls_security_level = may
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtp_tls_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;四、建立 Kubernetes YAML&lt;span class="hx:absolute hx:-mt-20" id="四建立-kubernetes-yaml"&gt;&lt;/span&gt;
&lt;a href="#%e5%9b%9b%e5%bb%ba%e7%ab%8b-kubernetes-yaml" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;mx1&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機名稱前綴&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機 FQDN（自動組合）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.2&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 內網 DNS Server IP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;NET_IF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ens18&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Mail Server 網路介面名稱&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF | sudo tee /etc/containers/systemd/dkmail.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;apiVersion: v1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;kind: Pod
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: dkmail
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; labels:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; app: dkmail
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostname: ${MAIL_FQDN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostNetwork: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; dnsConfig:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; nameservers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - ${DNS_IP}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; searches:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - ${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; containers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: dkmail
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; image: localhost/dkmail.rspamd:latest
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; env:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: NETWORK_INTERFACE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; value: &amp;#34;${NET_IF}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: SSL_TYPE
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; value: &amp;#34;manual&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: SSL_CERT_PATH
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; value: &amp;#34;/etc/ssl/mail/fullchain.pem&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: SSL_KEY_PATH
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; value: &amp;#34;/etc/ssl/mail/${DN}.key&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; volumeMounts:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: mail-data
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; mountPath: /var/mail
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: postfix-main-cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; mountPath: /tmp/docker-mailserver/postfix-main.cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; readOnly: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: rspamd-config
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; mountPath: /tmp/docker-mailserver/rspamd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: ssl-certs
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; mountPath: /etc/ssl/mail
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; readOnly: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; volumes:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: mail-data
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostPath:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; path: /opt/zfs/dkmail/data
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; type: Directory
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: postfix-main-cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostPath:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; path: /opt/zfs/dkmail/conf/postfix-main.cf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; type: File
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: rspamd-config
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostPath:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; path: /opt/zfs/dkmail/conf/rspamd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; type: Directory
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: ssl-certs
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hostPath:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; path: /opt/zfs/dkmail/conf/ssl
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; type: Directory
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;YAML 與原始 podman run 參數對照&lt;span class="hx:absolute hx:-mt-20" id="yaml-與原始-podman-run-參數對照"&gt;&lt;/span&gt;
&lt;a href="#yaml-%e8%88%87%e5%8e%9f%e5%a7%8b-podman-run-%e5%8f%83%e6%95%b8%e5%b0%8d%e7%85%a7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;原始 &lt;code&gt;podman run&lt;/code&gt; 參數&lt;/th&gt;
&lt;th&gt;YAML 對應欄位&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--name dkmail&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;metadata.name: dkmail&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-h ${MAIL_FQDN}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;spec.hostname&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--network=host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;spec.hostNetwork: true&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--dns ${DNS_IP}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;spec.dnsConfig.nameservers&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--dns-search ${DN}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;spec.dnsConfig.searches&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-e NETWORK_INTERFACE=${NET_IF}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;containers[].env&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-e SSL_TYPE=manual&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;containers[].env&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v ...:/var/mail&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;volumes&lt;/code&gt; + &lt;code&gt;volumeMounts&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v ...:ro&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;volumeMounts&lt;/code&gt; 加上 &lt;code&gt;readOnly: true&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;說明：&lt;/strong&gt; 不需要掛載 Dovecot SSL 設定檔。docker-mailserver 會根據
&lt;code&gt;SSL_TYPE=manual&lt;/code&gt; + &lt;code&gt;SSL_CERT_PATH&lt;/code&gt; + &lt;code&gt;SSL_KEY_PATH&lt;/code&gt; 自動設定
Postfix TLS、Dovecot TLS 和 SASL 認證 socket。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;五、建立 Quadlet .kube 檔案&lt;span class="hx:absolute hx:-mt-20" id="五建立-quadlet-kube-檔案"&gt;&lt;/span&gt;
&lt;a href="#%e4%ba%94%e5%bb%ba%e7%ab%8b-quadlet-kube-%e6%aa%94%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; | sudo tee /etc/containers/systemd/dkmail.kube
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;[Unit]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Description=Docker Mail Server (dkmail) with TLS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;After=network-online.target
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Wants=network-online.target
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;[Kube]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Yaml=/etc/containers/systemd/dkmail.yaml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Network=host
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;[Service]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;Restart=always
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;RestartSec=10
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;TimeoutStartSec=120
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;[Install]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;WantedBy=multi-user.target default.target
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;.kube 各區塊說明&lt;span class="hx:absolute hx:-mt-20" id="kube-各區塊說明"&gt;&lt;/span&gt;
&lt;a href="#kube-%e5%90%84%e5%8d%80%e5%a1%8a%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;區塊&lt;/th&gt;
&lt;th&gt;設定&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Unit]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;After=network-online.target&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;網路就緒後才啟動&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Kube]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Yaml=...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;指向 Kubernetes YAML 路徑&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Kube]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Network=host&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;使用 host 網路（郵件服務需直接綁定 Port）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Service]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Restart=always&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;異常退出自動重啟&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Service]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;TimeoutStartSec=120&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;給 Container 足夠啟動時間&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;[Install]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;WantedBy=multi-user.target&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;開機自動啟動&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;六、啟動服務&lt;span class="hx:absolute hx:-mt-20" id="六啟動服務"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%ad%e5%95%9f%e5%8b%95%e6%9c%8d%e5%8b%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 重新載入 systemd（讓 Quadlet generator 產生 service）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 啟動服務&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl start dkmail.service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定開機自動啟動&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; dkmail.service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認狀態&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl status dkmail.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;七、驗證 TLS&lt;span class="hx:absolute hx:-mt-20" id="七驗證-tls"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%83%e9%a9%97%e8%ad%89-tls" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;mx1.kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機 FQDN&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7.1 確認 Pod 與 Container&lt;span class="hx:absolute hx:-mt-20" id="71-確認-pod-與-container"&gt;&lt;/span&gt;
&lt;a href="#71-%e7%a2%ba%e8%aa%8d-pod-%e8%88%87-container" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman pod ps
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps --pod&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7.2 確認 TLS&lt;span class="hx:absolute hx:-mt-20" id="72-確認-tls"&gt;&lt;/span&gt;
&lt;a href="#72-%e7%a2%ba%e8%aa%8d-tls" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# SMTP STARTTLS（Port 587）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:587 -starttls smtp
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# SMTPS（Port 465）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:465
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# IMAPS（Port 993）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:993
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# POP3S（Port 995）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:995&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正常輸出應包含：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;subject: CN = &amp;lt;MAIL_FQDN&amp;gt;
issuer: CN = &amp;lt;DN&amp;gt; Root CA
Verify return code: 21 (unable to verify the first certificate) ← 自簽憑證正常現象&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;八、設定 SPF Record&lt;span class="hx:absolute hx:-mt-20" id="八設定-spf-record"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%ab%e8%a8%ad%e5%ae%9a-spf-record" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.3&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Mail Server IP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.2&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 內網 DNS Server IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;透過 &lt;code&gt;nsupdate&lt;/code&gt; 將 SPF 記錄新增至內網 DNS（BIND）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nsupdate &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;server ${DNS_IP}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;zone ${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update del ${DN}. TXT
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update add ${DN}. 300 IN TXT &amp;#34;v=spf1 ip4:${MAIL_IP} ~all&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;send
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證 SPF Record：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig @&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;. TXT +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;#34;v=spf1 ip4:&amp;lt;MAIL_IP&amp;gt; ~all&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;九、設定 DKIM&lt;span class="hx:absolute hx:-mt-20" id="九設定-dkim"&gt;&lt;/span&gt;
&lt;a href="#%e4%b9%9d%e8%a8%ad%e5%ae%9a-dkim" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.2&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 內網 DNS Server IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.1 產生 DKIM Key&lt;span class="hx:absolute hx:-mt-20" id="91-產生-dkim-key"&gt;&lt;/span&gt;
&lt;a href="#91-%e7%94%a2%e7%94%9f-dkim-key" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; -it dkmail-dkmail setup config dkim domain &lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INFO rspamd-dkim: Creating DKIM keys of type &amp;#39;rsa&amp;#39; and length &amp;#39;2048&amp;#39; with selector &amp;#39;mail&amp;#39; for domain &amp;#39;&amp;lt;DN&amp;gt;&amp;#39;
INFO rspamd-dkim: Successfully created DKIM keys
INFO rspamd-dkim: Here is the content of the TXT DNS record mail._domainkey.&amp;lt;DN&amp;gt; that you need to create:
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQE...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.2 啟用內網寄信的 DKIM 簽署&lt;span class="hx:absolute hx:-mt-20" id="92-啟用內網寄信的-dkim-簽署"&gt;&lt;/span&gt;
&lt;a href="#92-%e5%95%9f%e7%94%a8%e5%85%a7%e7%b6%b2%e5%af%84%e4%bf%a1%e7%9a%84-dkim-%e7%b0%bd%e7%bd%b2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重要：&lt;/strong&gt; docker-mailserver 預設產生的 &lt;code&gt;dkim_signing.conf&lt;/code&gt; 中 &lt;code&gt;sign_local = false&lt;/code&gt;，
這會導致從內網直接寄出的郵件不會被 DKIM 簽署。必須改為 &lt;code&gt;true&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sed -i &lt;span class="s1"&gt;&amp;#39;s/sign_local = false/sign_local = true/&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/dkmail/conf/rspamd/override.d/dkim_signing.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證修改結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;grep &lt;span class="s1"&gt;&amp;#39;sign_local&amp;#39;&lt;/span&gt; /opt/zfs/dkmail/conf/rspamd/override.d/dkim_signing.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sign_local = true;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.3 確認產生的檔案&lt;span class="hx:absolute hx:-mt-20" id="93-確認產生的檔案"&gt;&lt;/span&gt;
&lt;a href="#93-%e7%a2%ba%e8%aa%8d%e7%94%a2%e7%94%9f%e7%9a%84%e6%aa%94%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tree /opt/zfs/dkmail/conf/rspamd/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期結構：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/opt/zfs/dkmail/conf/rspamd/
├── dkim
│ ├── rsa-2048-mail-&amp;lt;DN&amp;gt;.private.txt
│ ├── rsa-2048-mail-&amp;lt;DN&amp;gt;.public.dns.txt
│ └── rsa-2048-mail-&amp;lt;DN&amp;gt;.public.txt
└── override.d
├── dkim_signing.conf
├── hfilter.conf
├── options.inc
└── worker-controller.inc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.4 擷取 DKIM Public Key&lt;span class="hx:absolute hx:-mt-20" id="94-擷取-dkim-public-key"&gt;&lt;/span&gt;
&lt;a href="#94-%e6%93%b7%e5%8f%96-dkim-public-key" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DKIM_K8S_TXT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;sed -n &lt;span class="s1"&gt;&amp;#39;s|.*&amp;#34;\([^&amp;#34;]*\)&amp;#34;.*|&amp;#34;\1&amp;#34;|p&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /opt/zfs/dkmail/conf/rspamd/dkim/rsa-2048-mail-&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;.public.txt &lt;span class="p"&gt;|&lt;/span&gt; tr &lt;span class="s1"&gt;&amp;#39;\n&amp;#39;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$DKIM_K8S_TXT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.5 新增 DKIM TXT Record（以 BIND DNS 為例）&lt;span class="hx:absolute hx:-mt-20" id="95-新增-dkim-txt-record以-bind-dns-為例"&gt;&lt;/span&gt;
&lt;a href="#95-%e6%96%b0%e5%a2%9e-dkim-txt-record%e4%bb%a5-bind-dns-%e7%82%ba%e4%be%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nsupdate &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;server ${DNS_IP}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;zone ${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update del mail._domainkey.${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update add mail._domainkey.${DN} 3600 IN TXT $DKIM_K8S_TXT
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;send
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.6 驗證 DKIM Record&lt;span class="hx:absolute hx:-mt-20" id="96-驗證-dkim-record"&gt;&lt;/span&gt;
&lt;a href="#96-%e9%a9%97%e8%ad%89-dkim-record" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig @&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; mail._domainkey.&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;. TXT +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;#34;v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;9.7 重啟 Container 套用 DKIM 設定&lt;span class="hx:absolute hx:-mt-20" id="97-重啟-container-套用-dkim-設定"&gt;&lt;/span&gt;
&lt;a href="#97-%e9%87%8d%e5%95%9f-container-%e5%a5%97%e7%94%a8-dkim-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl restart dkmail.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;十、設定 DMARC Record&lt;span class="hx:absolute hx:-mt-20" id="十設定-dmarc-record"&gt;&lt;/span&gt;
&lt;a href="#%e5%8d%81%e8%a8%ad%e5%ae%9a-dmarc-record" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.2&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 內網 DNS Server IP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;POSTMASTER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;bigred&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Postmaster 帳號名稱&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;說明：&lt;/strong&gt; DMARC 需在 SPF 和 DKIM 都設定完成後再新增。
&lt;code&gt;p=none&lt;/code&gt; 表示僅監控模式，不影響郵件遞送，待確認運作正常後可改為 &lt;code&gt;p=quarantine&lt;/code&gt; 或 &lt;code&gt;p=reject&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nsupdate &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;server ${DNS_IP}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;zone ${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update del _dmarc.${DN}. TXT
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;update add _dmarc.${DN}. 300 IN TXT &amp;#34;v=DMARC1; p=none; rua=mailto:${POSTMASTER}@${DN}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;send
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證 DMARC Record：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig @&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DNS_IP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; _dmarc.&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;. TXT +short&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&amp;#34;v=DMARC1; p=none; rua=mailto:&amp;lt;POSTMASTER&amp;gt;@&amp;lt;DN&amp;gt;&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;十一、測試寄信&lt;span class="hx:absolute hx:-mt-20" id="十一測試寄信"&gt;&lt;/span&gt;
&lt;a href="#%e5%8d%81%e4%b8%80%e6%b8%ac%e8%a9%a6%e5%af%84%e4%bf%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重要：&lt;/strong&gt; 以下測試步驟必須在&lt;strong&gt;同一內網的其他機器&lt;/strong&gt;上執行（不是 Mail Server 本機）。
從其他機器寄信才能正確模擬實際使用情境，驗證 &lt;code&gt;mynetworks&lt;/code&gt; relay 設定、TLS 連線、SMTP 認證、
以及 DKIM 簽署（&lt;code&gt;sign_local&lt;/code&gt; 是否對內網來源生效）等功能是否正常。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改（在測試機器上執行）=====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;mx1&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機名稱前綴&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_FQDN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_HOST&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件主機 FQDN（自動組合）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.3&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Mail Server IP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;POSTMASTER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;bigred&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Postmaster 帳號名稱&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;11.1 安裝寄信工具（在內網其他機器上執行）&lt;span class="hx:absolute hx:-mt-20" id="111-安裝寄信工具在內網其他機器上執行"&gt;&lt;/span&gt;
&lt;a href="#111-%e5%ae%89%e8%a3%9d%e5%af%84%e4%bf%a1%e5%b7%a5%e5%85%b7%e5%9c%a8%e5%85%a7%e7%b6%b2%e5%85%b6%e4%bb%96%e6%a9%9f%e5%99%a8%e4%b8%8a%e5%9f%b7%e8%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Debian/Ubuntu&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install -y s-nail
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Alpine Linux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apk add s-nail&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;11.2 從內網直接寄信測試（不經 SMTP 認證）&lt;span class="hx:absolute hx:-mt-20" id="112-從內網直接寄信測試不經-smtp-認證"&gt;&lt;/span&gt;
&lt;a href="#112-%e5%be%9e%e5%85%a7%e7%b6%b2%e7%9b%b4%e6%8e%a5%e5%af%84%e4%bf%a1%e6%b8%ac%e8%a9%a6%e4%b8%8d%e7%b6%93-smtp-%e8%aa%8d%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Test Mail&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; s-nail &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -S &lt;span class="nv"&gt;mta&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;smtp://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_IP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -s &lt;span class="s2"&gt;&amp;#34;Mail Server Test&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;sreantony@gmail.com&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;11.3 透過 SMTP 認證寄信測試（msmtp）&lt;span class="hx:absolute hx:-mt-20" id="113-透過-smtp-認證寄信測試msmtp"&gt;&lt;/span&gt;
&lt;a href="#113-%e9%80%8f%e9%81%8e-smtp-%e8%aa%8d%e8%ad%89%e5%af%84%e4%bf%a1%e6%b8%ac%e8%a9%a6msmtp" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在內網其他機器上安裝 msmtp 並建立設定檔（自簽憑證需關閉憑證檢查）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt; EOF &amp;gt; ~/.msmtprc
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;account test
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;host ${MAIL_FQDN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;port 587
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;from ${POSTMASTER}@${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;auth plain
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;user ${POSTMASTER}@${DN}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;password ${POSTMASTER}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;tls on
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;tls_starttls on
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;tls_certcheck off
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;logfile /tmp/msmtp.log
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod &lt;span class="m"&gt;600&lt;/span&gt; ~/.msmtprc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; 帳號為 &lt;code&gt;${POSTMASTER}@${DN}&lt;/code&gt;（不是 &lt;code&gt;${POSTMASTER}@${MAIL_FQDN}&lt;/code&gt;），
對應 Dockerfile 中 &lt;code&gt;setup email add bigred@${DN}&lt;/code&gt; 的設定。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;寄信測試：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; -e &lt;span class="s2"&gt;&amp;#34;To: sreantony@gmail.com\nSubject: Auth Test\n\n認證測試&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; msmtp -a &lt;span class="nb"&gt;test&lt;/span&gt; sreantony@gmail.com&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;11.4 驗證 Rspamd 評分&lt;span class="hx:absolute hx:-mt-20" id="114-驗證-rspamd-評分"&gt;&lt;/span&gt;
&lt;a href="#114-%e9%a9%97%e8%ad%89-rspamd-%e8%a9%95%e5%88%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;開啟 Rspamd Web UI（&lt;code&gt;http://${MAIL_FQDN}:11334&lt;/code&gt;）查看 History，
SPF / DKIM / DMARC 設定正確後，以下 Symbol 應消失或轉為通過：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symbol&lt;/th&gt;
&lt;th&gt;修正前&lt;/th&gt;
&lt;th&gt;修正後&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;R_SPF_NA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;+1.5（無 SPF）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;R_SPF_ALLOW&lt;/code&gt;（SPF 通過）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;R_DKIM_NA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;+1.0（無 DKIM）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;R_DKIM_ALLOW&lt;/code&gt;（DKIM 通過）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;DMARC_NA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;+0.5（無 DMARC）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DMARC_POLICY_ALLOW&lt;/code&gt;（DMARC 通過）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AUTH_NA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;+2.5（未認證）&lt;/td&gt;
&lt;td&gt;消失（經 SMTP 認證寄信）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;十二、日常管理&lt;span class="hx:absolute hx:-mt-20" id="十二日常管理"&gt;&lt;/span&gt;
&lt;a href="#%e5%8d%81%e4%ba%8c%e6%97%a5%e5%b8%b8%e7%ae%a1%e7%90%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;操作&lt;/th&gt;
&lt;th&gt;指令&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;啟動&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl start dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;停止&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl stop dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;重啟&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl restart dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;查看狀態&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl status dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;查看 log&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo journalctl -u dkmail.service -f&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;開機啟動&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl enable dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;取消開機啟動&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo systemctl disable dkmail.service&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;進入 Container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman exec -it dkmail-dkmail bash&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Container log&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman logs -f dkmail-dkmail&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Postfix log&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo podman exec -it dkmail-dkmail tail -50 /var/log/mail/mail.log&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; Container 名稱為 &lt;code&gt;dkmail-dkmail&lt;/code&gt;（Pod 名稱 + Container 名稱）。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;十三、客戶端匯入 CA 根憑證&lt;span class="hx:absolute hx:-mt-20" id="十三客戶端匯入-ca-根憑證"&gt;&lt;/span&gt;
&lt;a href="#%e5%8d%81%e4%b8%89%e5%ae%a2%e6%88%b6%e7%ab%af%e5%8c%af%e5%85%a5-ca-%e6%a0%b9%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ===== 根據環境修改 =====&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# 郵件域名&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;MAIL_IP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;192.168.11.3&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Mail Server IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;自簽憑證需在每台客戶端匯入 &lt;code&gt;ca.crt&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 從伺服器下載 ca.crt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;scp user@&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAIL_IP&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:/opt/mkcert/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/ca.crt ~/Desktop/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;客戶端&lt;/th&gt;
&lt;th&gt;匯入方式&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Thunderbird&lt;/td&gt;
&lt;td&gt;設定 → 隱私與安全 → 憑證 → 匯入 → 選 &lt;code&gt;ca.crt&lt;/code&gt; → 勾選「信任此 CA 識別網站」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;雙擊 &lt;code&gt;ca.crt&lt;/code&gt; → 安裝憑證 → 「受信任的根憑證授權單位」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;macOS&lt;/td&gt;
&lt;td&gt;雙擊 &lt;code&gt;ca.crt&lt;/code&gt; → 加入鑰匙圈 → 設定為「永遠信任」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linux&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo cp ca.crt /usr/local/share/ca-certificates/ &amp;amp;&amp;amp; sudo update-ca-certificates&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;十四、故障排除&lt;span class="hx:absolute hx:-mt-20" id="十四故障排除"&gt;&lt;/span&gt;
&lt;a href="#%e5%8d%81%e5%9b%9b%e6%95%85%e9%9a%9c%e6%8e%92%e9%99%a4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Quadlet 沒有產生 service&lt;span class="hx:absolute hx:-mt-20" id="quadlet-沒有產生-service"&gt;&lt;/span&gt;
&lt;a href="#quadlet-%e6%b2%92%e6%9c%89%e7%94%a2%e7%94%9f-service" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 手動執行 generator 檢查錯誤&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /usr/libexec/podman/quadlet --dryrun&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;手動測試 YAML 是否正確&lt;span class="hx:absolute hx:-mt-20" id="手動測試-yaml-是否正確"&gt;&lt;/span&gt;
&lt;a href="#%e6%89%8b%e5%8b%95%e6%b8%ac%e8%a9%a6-yaml-%e6%98%af%e5%90%a6%e6%ad%a3%e7%a2%ba" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 用 podman kube play 直接測試&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman kube play /etc/containers/systemd/dkmail.yaml
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 測試完畢清除&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman kube down /etc/containers/systemd/dkmail.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;映像檔找不到&lt;span class="hx:absolute hx:-mt-20" id="映像檔找不到"&gt;&lt;/span&gt;
&lt;a href="#%e6%98%a0%e5%83%8f%e6%aa%94%e6%89%be%e4%b8%8d%e5%88%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman images &lt;span class="p"&gt;|&lt;/span&gt; grep dkmail
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 如果缺少 localhost 前綴，重新標記&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman tag dkmail.rspamd localhost/dkmail.rspamd:latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;SMTP 寄信出現 Relay access denied&lt;span class="hx:absolute hx:-mt-20" id="smtp-寄信出現-relay-access-denied"&gt;&lt;/span&gt;
&lt;a href="#smtp-%e5%af%84%e4%bf%a1%e5%87%ba%e7%8f%be-relay-access-denied" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;確認 &lt;code&gt;postfix-main.cf&lt;/code&gt; 中 &lt;code&gt;mynetworks&lt;/code&gt; 包含發信主機的網段：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; -it dkmail-dkmail postconf mynetworks&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;SMTP 認證失敗（SASL）&lt;span class="hx:absolute hx:-mt-20" id="smtp-認證失敗sasl"&gt;&lt;/span&gt;
&lt;a href="#smtp-%e8%aa%8d%e8%ad%89%e5%a4%b1%e6%95%97sasl" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;確認 Dovecot auth socket 存在：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; -it dkmail-dkmail ls -l /dev/shm/sasl-auth.sock&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 Postfix 指向正確的 socket 路徑：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman &lt;span class="nb"&gt;exec&lt;/span&gt; -it dkmail-dkmail postconf smtpd_sasl_path&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; docker-mailserver 的 Dovecot auth socket 位於 &lt;code&gt;/dev/shm/sasl-auth.sock&lt;/code&gt;，
不是 Postfix 預設的 &lt;code&gt;private/auth&lt;/code&gt;。不要在 &lt;code&gt;postfix-main.cf&lt;/code&gt; 手動設定
&lt;code&gt;smtpd_sasl_path&lt;/code&gt; / &lt;code&gt;smtpd_sasl_type&lt;/code&gt;，讓 docker-mailserver 自動處理。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;TLS 憑證與 docker-mailserver 衝突&lt;span class="hx:absolute hx:-mt-20" id="tls-憑證與-docker-mailserver-衝突"&gt;&lt;/span&gt;
&lt;a href="#tls-%e6%86%91%e8%ad%89%e8%88%87-docker-mailserver-%e8%a1%9d%e7%aa%81" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重要：&lt;/strong&gt; 不要在 &lt;code&gt;postfix-main.cf&lt;/code&gt; 設定 &lt;code&gt;smtpd_tls_cert_file&lt;/code&gt; / &lt;code&gt;smtpd_tls_key_file&lt;/code&gt;。
docker-mailserver 的 &lt;code&gt;SSL_TYPE=manual&lt;/code&gt; 會使用 &lt;code&gt;smtpd_tls_chain_files&lt;/code&gt;，
兩者同時存在會產生衝突警告且舊的設定會被忽略。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2&gt;完整目錄結構&lt;span class="hx:absolute hx:-mt-20" id="完整目錄結構"&gt;&lt;/span&gt;
&lt;a href="#%e5%ae%8c%e6%95%b4%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/etc/containers/systemd/ # Quadlet 檔案
├── dkmail.kube # Quadlet 單元檔
└── dkmail.yaml # Kubernetes Pod YAML
/opt/zfs/dkmail/ # 資料與設定
├── data/ # 郵件資料（/var/mail）
└── conf/
├── postfix-main.cf # Postfix 額外設定（mynetworks &amp;#43; smtp_tls）
├── ssl/
│ ├── fullchain.pem # 伺服器憑證 &amp;#43; CA 憑證
│ └── &amp;lt;DN&amp;gt;.key # 伺服器私鑰
└── rspamd/
├── dkim/ # DKIM Keys（步驟九產生）
│ ├── rsa-2048-mail-&amp;lt;DN&amp;gt;.private.txt
│ ├── rsa-2048-mail-&amp;lt;DN&amp;gt;.public.dns.txt
│ └── rsa-2048-mail-&amp;lt;DN&amp;gt;.public.txt
└── override.d/
├── dkim_signing.conf # DKIM 簽署設定（步驟九產生）
├── options.inc
├── worker-controller.inc
└── hfilter.conf
/opt/mkcert/ # 憑證產生工具（備份保留）
├── certctl
├── config
└── &amp;lt;DN&amp;gt;/
├── ca.crt
├── ca.key
├── &amp;lt;DN&amp;gt;.crt
└── &amp;lt;DN&amp;gt;.key
/opt/zfs/images/dkmail-rspamd/ # Container Image Dockerfile
└── Dockerfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Podman Start Docker Mail Server with TLS</title><link>https://blog.kubeantony.com/archive/container/podman-start-docker-mail-server-with-tls/</link><pubDate>Tue, 31 Mar 2026 07:37:44 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/podman-start-docker-mail-server-with-tls/</guid><description>
&lt;h2&gt;環境資訊&lt;span class="hx:absolute hx:-mt-20" id="環境資訊"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;項目&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;域名&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;主機名&lt;/td&gt;
&lt;td&gt;&lt;code&gt;mx1.kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;容器引擎&lt;/td&gt;
&lt;td&gt;Podman（&lt;code&gt;--network=host&lt;/code&gt;）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;網路環境&lt;/td&gt;
&lt;td&gt;內網，無 Public IP&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DNS 管理&lt;/td&gt;
&lt;td&gt;Cloudflare&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;套用服務&lt;/td&gt;
&lt;td&gt;SMTP（25/465/587）、IMAP（993）、POP3（995）、Rspamd Web UI&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h2&gt;方案比較&lt;span class="hx:absolute hx:-mt-20" id="方案比較"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%b9%e6%a1%88%e6%af%94%e8%bc%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;方案 A：mkcert 自簽憑證&lt;/th&gt;
&lt;th&gt;方案 B：Let&amp;rsquo;s Encrypt + Cloudflare DNS&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;費用&lt;/td&gt;
&lt;td&gt;免費&lt;/td&gt;
&lt;td&gt;免費&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;需要 Public IP&lt;/td&gt;
&lt;td&gt;否&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;否&lt;/strong&gt;（DNS-01 驗證不需要）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;客戶端信任&lt;/td&gt;
&lt;td&gt;需手動匯入 CA 憑證&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;自動信任&lt;/strong&gt;（公開 CA）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;有效期限&lt;/td&gt;
&lt;td&gt;10 年&lt;/td&gt;
&lt;td&gt;90 天（自動續期）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;適用場景&lt;/td&gt;
&lt;td&gt;內部測試 / 個人使用&lt;/td&gt;
&lt;td&gt;正式環境 / 對外服務&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;維護難度&lt;/td&gt;
&lt;td&gt;低（幾乎不用管）&lt;/td&gt;
&lt;td&gt;低（cron 自動續期）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h1&gt;方案 A：使用 braveantony/mkcert 自簽憑證&lt;/h1&gt;&lt;h2&gt;A-1：產生自簽憑證&lt;span class="hx:absolute hx:-mt-20" id="a-1產生自簽憑證"&gt;&lt;/span&gt;
&lt;a href="#a-1%e7%94%a2%e7%94%9f%e8%87%aa%e7%b0%bd%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 下載 mkcert 工具&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /opt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo git clone https://github.com/braveantony/mkcert.git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod +x /opt/mkcert/certctl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;編輯設定檔：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nano /opt/mkcert/config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修改為以下內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# CA 相關設定&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CA_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ca.key&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CA_CRT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ca.crt&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CA_DAYS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;3650&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CA_SUBJ&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/C=TW/ST=Taipei/L=Taipei/O=kubeantony/OU=Mail/CN=kubeantony Root CA&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Server 相關設定&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kubeantony.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SERVER_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.key&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SERVER_CSR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.csr&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SERVER_CRT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.crt&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SERVER_DAYS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;3650&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;SERVER_SUBJ&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/C=TW/ST=Taipei/L=Taipei/O=kubeantony/OU=Mail/CN=mx1.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;V3_EXT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;v3.ext&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;ALT_NAMES&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;DNS.1=*.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;DNS.2=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;DNS.3=mx1.&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 產生憑證&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /opt/mkcert/certctl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認結果&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ls -l /opt/mkcert/kubeantony.com/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 預期：ca.crt ca.key kubeantony.com.crt kubeantony.com.key&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;A-2：部署憑證&lt;span class="hx:absolute hx:-mt-20" id="a-2部署憑證"&gt;&lt;/span&gt;
&lt;a href="#a-2%e9%83%a8%e7%bd%b2%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/zfs/dkmail/conf/ssl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /opt/mkcert/kubeantony.com/kubeantony.com.key /opt/zfs/dkmail/conf/ssl/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /opt/mkcert/kubeantony.com/kubeantony.com.crt /opt/zfs/dkmail/conf/ssl/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 產生 fullchain（伺服器憑證 + CA 憑證）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo bash -c &lt;span class="s1"&gt;&amp;#39;cat /opt/mkcert/kubeantony.com/kubeantony.com.crt \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; /opt/mkcert/kubeantony.com/ca.crt \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; &amp;gt; /opt/zfs/dkmail/conf/ssl/fullchain.pem&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;644&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/fullchain.pem
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;600&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/kubeantony.com.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;A-3：客戶端匯入 CA 根憑證&lt;span class="hx:absolute hx:-mt-20" id="a-3客戶端匯入-ca-根憑證"&gt;&lt;/span&gt;
&lt;a href="#a-3%e5%ae%a2%e6%88%b6%e7%ab%af%e5%8c%af%e5%85%a5-ca-%e6%a0%b9%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;自簽憑證需要在每台客戶端手動匯入 &lt;code&gt;ca.crt&lt;/code&gt;：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;客戶端&lt;/th&gt;
&lt;th&gt;匯入方式&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Thunderbird&lt;/td&gt;
&lt;td&gt;設定 → 隱私與安全 → 憑證 → 匯入 → 選 &lt;code&gt;ca.crt&lt;/code&gt; → 勾選「信任此 CA 識別網站」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;雙擊 &lt;code&gt;ca.crt&lt;/code&gt; → 安裝憑證 → 「受信任的根憑證授權單位」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;macOS&lt;/td&gt;
&lt;td&gt;雙擊 &lt;code&gt;ca.crt&lt;/code&gt; → 加入鑰匙圈 → 設定為「永遠信任」&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linux&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sudo cp ca.crt /usr/local/share/ca-certificates/ &amp;amp;&amp;amp; sudo update-ca-certificates&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;完成後，跳至「&lt;strong&gt;共通步驟：設定 Mail Server 並啟動容器&lt;/strong&gt;」。&lt;/p&gt;
&lt;hr&gt;
&lt;h1&gt;方案 B：Let&amp;rsquo;s Encrypt + Cloudflare DNS-01 驗證&lt;/h1&gt;&lt;blockquote&gt;
&lt;p&gt;核心原理：acme.sh 透過 Cloudflare API 在 DNS 自動建立 &lt;code&gt;_acme-challenge&lt;/code&gt; TXT 記錄，
Let&amp;rsquo;s Encrypt 驗證該記錄後簽發憑證。全程不需要 Public IP 或開放任何 Port。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;B-1：在 Cloudflare 建立 API Token&lt;span class="hx:absolute hx:-mt-20" id="b-1在-cloudflare-建立-api-token"&gt;&lt;/span&gt;
&lt;a href="#b-1%e5%9c%a8-cloudflare-%e5%bb%ba%e7%ab%8b-api-token" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;登入 &lt;a
href="https://dash.cloudflare.com"target="_blank" rel="noopener"&gt;Cloudflare Dashboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;右上角點擊個人頭像 → &lt;strong&gt;My Profile&lt;/strong&gt; → &lt;strong&gt;API Tokens&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;點擊 &lt;strong&gt;Create Token&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;選擇 &lt;strong&gt;Edit zone DNS&lt;/strong&gt; 模板（Use template）&lt;/li&gt;
&lt;li&gt;設定權限：
&lt;ul&gt;
&lt;li&gt;Permissions：&lt;code&gt;Zone&lt;/code&gt; / &lt;code&gt;DNS&lt;/code&gt; / &lt;code&gt;Edit&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Zone Resources：&lt;code&gt;Include&lt;/code&gt; → &lt;code&gt;Specific zone&lt;/code&gt; → &lt;code&gt;kubeantony.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;建立後&lt;strong&gt;複製 Token&lt;/strong&gt;（只會顯示一次）&lt;/li&gt;
&lt;li&gt;到 &lt;code&gt;kubeantony.com&lt;/code&gt; 的 Overview 頁面，記下右側的 &lt;strong&gt;Zone ID&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;B-2：安裝 acme.sh&lt;span class="hx:absolute hx:-mt-20" id="b-2安裝-acmesh"&gt;&lt;/span&gt;
&lt;a href="#b-2%e5%ae%89%e8%a3%9d-acmesh" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 安裝 acme.sh（不需要 root，但建議用 root 方便管理憑證路徑）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo -i
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl https://get.acme.sh &lt;span class="p"&gt;|&lt;/span&gt; sh -s &lt;span class="nv"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;bigred@kubeantony.com
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 讓 acme.sh 指令在當前 shell 可用&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定預設 CA 為 Let&amp;#39;s Encrypt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/.acme.sh/acme.sh --set-default-ca --server letsencrypt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;B-3：簽發憑證&lt;span class="hx:absolute hx:-mt-20" id="b-3簽發憑證"&gt;&lt;/span&gt;
&lt;a href="#b-3%e7%b0%bd%e7%99%bc%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定 Cloudflare API 認證&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;CF_Token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;你的_Cloudflare_API_Token&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;CF_Zone_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;你的_Zone_ID&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 簽發萬用字元憑證（含 kubeantony.com 和 *.kubeantony.com）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/.acme.sh/acme.sh --issue &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --dns dns_cf &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d kubeantony.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;*.kubeantony.com&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;acme.sh 會自動透過 Cloudflare API 建立 TXT 記錄進行驗證，
驗證通過後自動清除 TXT 記錄。整個過程完全不需要 Public IP。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;B-4：安裝憑證到 Mail Server 目錄&lt;span class="hx:absolute hx:-mt-20" id="b-4安裝憑證到-mail-server-目錄"&gt;&lt;/span&gt;
&lt;a href="#b-4%e5%ae%89%e8%a3%9d%e6%86%91%e8%ad%89%e5%88%b0-mail-server-%e7%9b%ae%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/zfs/dkmail/conf/ssl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/.acme.sh/acme.sh --install-cert &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d kubeantony.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;*.kubeantony.com&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --key-file /opt/zfs/dkmail/conf/ssl/kubeantony.com.key &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --fullchain-file /opt/zfs/dkmail/conf/ssl/fullchain.pem &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --reloadcmd &lt;span class="s2"&gt;&amp;#34;podman restart dkmail&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;644&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/fullchain.pem
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;600&lt;/span&gt; /opt/zfs/dkmail/conf/ssl/kubeantony.com.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;說明：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--install-cert&lt;/code&gt; 會將憑證複製到你指定的路徑&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--reloadcmd&lt;/code&gt; 會在每次續期後自動重啟容器套用新憑證&lt;/li&gt;
&lt;li&gt;acme.sh 會自動建立 cron job，每天檢查是否需要續期（到期前 30 天自動續期）&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h2&gt;B-5：確認自動續期 cron&lt;span class="hx:absolute hx:-mt-20" id="b-5確認自動續期-cron"&gt;&lt;/span&gt;
&lt;a href="#b-5%e7%a2%ba%e8%aa%8d%e8%87%aa%e5%8b%95%e7%ba%8c%e6%9c%9f-cron" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;crontab -l
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 應該會看到類似這行：&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 0 0 * * * &amp;#34;/root/.acme.sh&amp;#34;/acme.sh --cron --home &amp;#34;/root/.acme.sh&amp;#34; &amp;gt; /dev/null&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;完成後，跳至「&lt;strong&gt;共通步驟：設定 Mail Server 並啟動容器&lt;/strong&gt;」。&lt;/p&gt;
&lt;hr&gt;
&lt;h1&gt;共通步驟：設定 Mail Server 並啟動容器&lt;/h1&gt;&lt;p&gt;以下步驟不論方案 A 或方案 B 都相同。此時你的 &lt;code&gt;/opt/zfs/dkmail/conf/ssl/&lt;/code&gt; 應該已有：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/opt/zfs/dkmail/conf/ssl/
├── fullchain.pem # 完整憑證鏈
└── kubeantony.com.key # 私鑰&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;C-1：設定 Postfix（SMTP TLS）&lt;span class="hx:absolute hx:-mt-20" id="c-1設定-postfixsmtp-tls"&gt;&lt;/span&gt;
&lt;a href="#c-1%e8%a8%ad%e5%ae%9a-postfixsmtp-tls" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /opt/zfs/dkmail/conf/postfix-main.cf &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# TLS 設定
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_cert_file = /etc/ssl/mail/fullchain.pem
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_key_file = /etc/ssl/mail/kubeantony.com.key
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_security_level = may
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_mandatory_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtpd_tls_mandatory_ciphers = medium
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# 寄出郵件也啟用 TLS
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtp_tls_security_level = may
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;smtp_tls_protocols = !SSLv2,!SSLv3,!TLSv1,!TLSv1.1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;C-2：設定 Dovecot（IMAP/POP3 TLS）&lt;span class="hx:absolute hx:-mt-20" id="c-2設定-dovecotimappop3-tls"&gt;&lt;/span&gt;
&lt;a href="#c-2%e8%a8%ad%e5%ae%9a-dovecotimappop3-tls" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/zfs/dkmail/conf/dovecot
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /opt/zfs/dkmail/conf/dovecot/10-ssl.conf &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ssl = required
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ssl_cert = &amp;lt;/etc/ssl/mail/fullchain.pem
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ssl_key = &amp;lt;/etc/ssl/mail/kubeantony.com.key
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ssl_min_protocol = TLSv1.2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;ssl_prefer_server_ciphers = yes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; Dovecot 設定中 &lt;code&gt;&amp;lt;&lt;/code&gt; 是必要語法，代表「讀取此檔案內容」，不是打字錯誤。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;C-3：停止舊容器並重新啟動&lt;span class="hx:absolute hx:-mt-20" id="c-3停止舊容器並重新啟動"&gt;&lt;/span&gt;
&lt;a href="#c-3%e5%81%9c%e6%ad%a2%e8%88%8a%e5%ae%b9%e5%99%a8%e4%b8%a6%e9%87%8d%e6%96%b0%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman stop dkmail
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman rm dkmail&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman run --name dkmail -itd &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -h mx1.kubeantony.com --network&lt;span class="o"&gt;=&lt;/span&gt;host &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -e &lt;span class="nv"&gt;NETWORK_INTERFACE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ens18 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -e &lt;span class="nv"&gt;SSL_TYPE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;manual &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -e &lt;span class="nv"&gt;SSL_CERT_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/ssl/mail/fullchain.pem &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -e &lt;span class="nv"&gt;SSL_KEY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/ssl/mail/kubeantony.com.key &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --dns 192.168.11.253 --dns-search kubeantony.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /opt/zfs/dkmail/data:/var/mail &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /opt/zfs/dkmail/conf/postfix-main.cf:/tmp/docker-mailserver/postfix-main.cf:ro &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /opt/zfs/dkmail/conf/rspamd:/tmp/docker-mailserver/rspamd &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /opt/zfs/dkmail/conf/ssl:/etc/ssl/mail:ro &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /opt/zfs/dkmail/conf/dovecot/10-ssl.conf:/etc/dovecot/conf.d/10-ssl.conf:ro &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; dkmail.rspamd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;與你原始指令相比新增的項目：&lt;/strong&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;新增項目&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-e SSL_TYPE=manual&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;告訴 docker-mailserver 使用手動指定的憑證&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-e SSL_CERT_PATH=...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;容器內憑證路徑&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-e SSL_KEY_PATH=...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;容器內私鑰路徑&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v .../ssl:/etc/ssl/mail:ro&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;掛載憑證目錄&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-v .../10-ssl.conf:...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;覆蓋 Dovecot SSL 設定&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;C-4：Rspamd Web UI 的 TLS（選用，透過 Nginx 反向代理）&lt;span class="hx:absolute hx:-mt-20" id="c-4rspamd-web-ui-的-tls選用透過-nginx-反向代理"&gt;&lt;/span&gt;
&lt;a href="#c-4rspamd-web-ui-%e7%9a%84-tls%e9%81%b8%e7%94%a8%e9%80%8f%e9%81%8e-nginx-%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Rspamd Web UI 本身不支援 TLS，需要用 Nginx 做反向代理：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install -y nginx
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/nginx/ssl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /opt/zfs/dkmail/conf/ssl/fullchain.pem /etc/nginx/ssl/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp /opt/zfs/dkmail/conf/ssl/kubeantony.com.key /etc/nginx/ssl/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /etc/nginx/sites-available/rspamd &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;server {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; listen 443 ssl;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; server_name mx1.kubeantony.com;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_certificate /etc/nginx/ssl/fullchain.pem;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_certificate_key /etc/nginx/ssl/kubeantony.com.key;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_protocols TLSv1.2 TLSv1.3;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; location / {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; proxy_pass http://127.0.0.1:11334;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; proxy_set_header Host $host;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; proxy_set_header X-Real-IP $remote_addr;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; proxy_set_header X-Forwarded-Proto $scheme;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ln -s /etc/nginx/sites-available/rspamd /etc/nginx/sites-enabled/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nginx -t &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo systemctl restart nginx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h1&gt;驗證 TLS 是否生效&lt;/h1&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# SMTP STARTTLS（Port 587）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect mx1.kubeantony.com:587 -starttls smtp
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# SMTPS（Port 465）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect mx1.kubeantony.com:465
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# IMAPS（Port 993）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect mx1.kubeantony.com:993
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# POP3S（Port 995）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl s_client -connect mx1.kubeantony.com:995&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;正常輸出應包含：&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;方案 A（自簽）：&lt;code&gt;issuer: CN = kubeantony Root CA&lt;/code&gt;，&lt;code&gt;Verify return code: 21&lt;/code&gt; — 這是正常的&lt;/li&gt;
&lt;li&gt;方案 B（Let&amp;rsquo;s Encrypt）：&lt;code&gt;issuer: C = US, O = Let's Encrypt&lt;/code&gt;，&lt;code&gt;Verify return code: 0 (ok)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h1&gt;完整目錄結構&lt;/h1&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/opt/zfs/dkmail/
├── data/ # 郵件資料（/var/mail）
└── conf/
├── postfix-main.cf # Postfix TLS 設定
├── ssl/
│ ├── fullchain.pem # 完整憑證鏈
│ └── kubeantony.com.key # 私鑰
├── dovecot/
│ └── 10-ssl.conf # Dovecot SSL 設定
└── rspamd/
└── override.d/
├── options.inc
├── worker-controller.inc
└── hfilter.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>RKE2 &amp; Rancher Prime Installation</title><link>https://blog.kubeantony.com/archive/rancher/rke2-rancher-prime-installation/</link><pubDate>Tue, 31 Mar 2026 04:15:32 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/rke2-rancher-prime-installation/</guid><description>
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;
&lt;h2&gt;Preface&lt;span class="hx:absolute hx:-mt-20" id="preface"&gt;&lt;/span&gt;
&lt;a href="#preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;本篇文章會主要會介紹，如何安裝 Rancher Kubernetes Engine 2 或 K3S，並在 Kubernetes 之中部署 Rancher Prime&lt;/p&gt;
&lt;p&gt;可以透過點擊以下目錄，選擇想看的內容，跳轉至特定章節&lt;/p&gt;
&lt;/div&gt;
&lt;h1&gt;Install RKE2 v1.34.4&lt;/h1&gt;&lt;h2&gt;一、 安裝前環境檢查&lt;span class="hx:absolute hx:-mt-20" id="一-安裝前環境檢查"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%80-%e5%ae%89%e8%a3%9d%e5%89%8d%e7%92%b0%e5%a2%83%e6%aa%a2%e6%9f%a5" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;請確保你的環境符合要求
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://docs.rke2.io/install/requirements"target="_blank" rel="noopener"&gt;RKE2 Requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;如果你的主機上安裝並啟用了 NetworkManager，確保它被配置為忽略 CNI 管理的接口。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;對於 1.21 及以上版本的 RKE2，如果主機核心支持 AppArmor，那麼在安裝 RKE2 之前還必須有 AppArmor 工具（通常通過 apparmor-parser 軟件包獲得）。&lt;/li&gt;
&lt;li&gt;RKE2 的安裝過程必須以 root 用戶或通過 sudo 運行。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Hardware&lt;span class="hx:absolute hx:-mt-20" id="hardware"&gt;&lt;/span&gt;
&lt;a href="#hardware" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;Linux/Windows&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;RAM: 4GB Minimum (we recommend at least 8GB)&lt;/li&gt;
&lt;li&gt;CPU: 2 Minimum (we recommend at least 4CPU)&lt;/li&gt;
&lt;li&gt;Disks: SSD&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;a
href="https://docs.rke2.io/install/requirements#hardware"target="_blank" rel="noopener"&gt;RKE2 Hardware&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h2&gt;二、Server Node Installation&lt;span class="hx:absolute hx:-mt-20" id="二server-node-installation"&gt;&lt;/span&gt;
&lt;a href="#%e4%ba%8cserver-node-installation" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. Config RKE2 Basic Parameters&lt;span class="hx:absolute hx:-mt-20" id="1-config-rke2-basic-parameters"&gt;&lt;/span&gt;
&lt;a href="#1-config-rke2-basic-parameters" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;1-1. 下載 RKE2 的安裝腳本，並賦予執行權限&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在 Server node 的機器上執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sfL https://get.rke2.io --output install.sh &amp;amp;&amp;amp; chmod &amp;#43;x install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;RKE2 提供了一個安裝腳本，在 systemd 的系統上將其作為一個服務來安裝。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;1-2. 編輯 Server Node 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;advertise-address&lt;/code&gt;, &lt;code&gt;node-ip&lt;/code&gt; 和 &lt;code&gt;tls-san&lt;/code&gt; 的 IP 需要依據不同的環境來設定。&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 K8s 要跑在哪張網卡上(以下指令預設會去找 default gateway 的網卡)
NIC=&amp;#34;$(ip route show default | cut -d&amp;#39; &amp;#39; -f5)&amp;#34;
IP=$(ip -4 -o addr show ${NIC} | awk &amp;#39;{print $4}&amp;#39; | cut -d/ -f1)
# 定義節點名稱
NODE_NAME=&amp;#34;$(hostname -f 2&amp;gt;/dev/null)&amp;#34;
NODE_NAME=&amp;#34;${NODE_NAME:-$(hostname)}&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/rancher/rke2/ &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/rancher/rke2/config.yaml
write-kubeconfig-mode: &amp;#34;0644&amp;#34;
debug: false
# =============================================
# 每台節點不同的設定
# =============================================
# 本機對外廣播的 IP（其他節點透過此 IP 連線）
advertise-address: &amp;#34;${IP}&amp;#34;
# 本機 IP
node-ip: &amp;#34;${IP}&amp;#34;
# 節點名稱（每台不同）
node-name: &amp;#34;${NODE_NAME}&amp;#34;
# TLS 憑證允許的 SAN（第一台 server 需完整設定）
tls-san:
- &amp;#34;${NODE_NAME}&amp;#34;
- &amp;#34;${IP}&amp;#34;
- &amp;#34;127.0.0.1&amp;#34;
# 第二台以後需加入此行，指向第一台 server（第一台不需要）
# server: &amp;#34;https://&amp;lt;第一台IP&amp;gt;:9345&amp;#34;
# =============================================
# 所有 Server Node 必須相同的設定
# =============================================
# 叢集加入金鑰
token: &amp;#34;hehe&amp;#34;
# 各元件時區設定
etcd-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-apiserver-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-controller-manager-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-scheduler-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
cloud-controller-manager-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
# kubelet 參數
kubelet-arg:
- &amp;#34;container-log-max-files=5&amp;#34; # 最多保留 5 個 log 檔
- &amp;#34;container-log-max-size=10Mi&amp;#34; # 每個 log 檔最大 10Mi
- &amp;#34;config=/etc/kubernetes/kubeletconfig.yml&amp;#34;
- &amp;#34;eviction-hard=memory.available&amp;lt;1000Mi,imagefs.available&amp;lt;5%,nodefs.available&amp;lt;5%&amp;#34; # 資源不足時驅逐 Pod 的閾值
# 停用內建 cloud controller
disable-cloud-controller: true
# 停用 kube-proxy，改由 Cilium 接管
disable-kube-proxy: true
# 停用不需要的內建元件
disable:
- rke2-canal # 停用預設 CNI Canal
- rke2-kube-proxy # 停用內建 kube-proxy
# 使用 Cilium 作為 CNI
cni:
- &amp;#34;cilium&amp;#34;
# 啟用 CIS security profile
#profile: &amp;#34;cis&amp;#34;
# API Server 額外參數
#kube-apiserver-arg:
# - &amp;#34;service-account-extend-token-expiration=false&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;1-3. 編輯 cilium 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /var/lib/rancher/rke2/server/manifests &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /var/lib/rancher/rke2/server/manifests/rke2-cilium-config.yaml
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: rke2-cilium
namespace: kube-system
spec:
valuesContent: |-
operator:
replicas: 1
podAnnotations:
container.apparmor.security.beta.kubernetes.io/cilium-agent: &amp;#34;unconfined&amp;#34;
container.apparmor.security.beta.kubernetes.io/clean-cilium-state: &amp;#34;unconfined&amp;#34;
container.apparmor.security.beta.kubernetes.io/mount-cgroup: &amp;#34;unconfined&amp;#34;
container.apparmor.security.beta.kubernetes.io/apply-sysctl-overwrites: &amp;#34;unconfined&amp;#34;
devices: &amp;#34;$NIC&amp;#34;
nodePort:
directRoutingDevice: &amp;#34;$NIC&amp;#34;
autoDirectNodeRoutes: true
hubble:
enabled: false
relay:
enabled: false
ui:
enabled: false
frontend:
server:
ipv6:
enabled: false
service:
type: NodePort
enableLBIPAM: false
ipv4NativeRoutingCIDR: 10.42.0.0/16
k8sServiceHost: 127.0.0.1
k8sServicePort: 6443
kubeProxyReplacement: true
routingMode: native
l2announcements:
enabled: true
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;1-4. 編輯 kubelet 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/kubernetes &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/kubernetes/kubeletconfig.yml
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;evictionHard&lt;/code&gt;&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;用途&lt;/strong&gt;：設定強制驅逐的值，當系統資源（如記憶體）低於此設定值時，kubelet 會立即終止部分 Pod，以釋放資源，確保系統穩定運行。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;預設值&lt;/strong&gt;: 預設打開，Memory 是 100MiB, Ephemeral-Storage 是 10% (開源的 K8s), rke2 預設值是 imagefs 和 nodefs = 5%&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;範例&lt;/strong&gt;：&lt;code&gt;memory.available: &amp;quot;500Mi&amp;quot;&lt;/code&gt; 表示當可用記憶體少於 500MiB 時，kubelet 會觸發驅逐機制。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;evictionMinimumReclaim&lt;/code&gt;&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;用途&lt;/strong&gt;：設定在驅逐 Pod 時，kubelet 希望至少回收的資源量。這有助於避免頻繁的驅逐操作，確保每次驅逐能有效釋放足夠的資源。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;範例&lt;/strong&gt;：&lt;code&gt;memory.available: &amp;quot;10Mi&amp;quot;&lt;/code&gt; 表示每次驅逐操作至少要回收 10MiB 的記憶體。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;systemReserved&lt;/code&gt;&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;用途&lt;/strong&gt;：為系統背景程序（如 sshd、networking 等非 Kubernetes 組件）預留資源，確保這些系統服務在資源緊張時仍能正常運行。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;範例&lt;/strong&gt;：&lt;code&gt;memory: &amp;quot;1Gi&amp;quot;&lt;/code&gt; 表示為系統服務預留 1GiB 的記憶體。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;kubeReserved&lt;/code&gt;&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;用途&lt;/strong&gt;：為 Kubernetes 系統的背景程序（如 kubelet、container runtime 時等）預留資源，確保這些組件在資源緊張時的穩定性。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;範例&lt;/strong&gt;：&lt;code&gt;memory: &amp;quot;2Gi&amp;quot;&lt;/code&gt; 表示為 Kubernetes 系統的背景程序預留 2GiB 的記憶體。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h3&gt;2. Install RKE2 with v1.34.4 version&lt;span class="hx:absolute hx:-mt-20" id="2-install-rke2-with-v1344-version"&gt;&lt;/span&gt;
&lt;a href="#2-install-rke2-with-v1344-version" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;2-1. 執行以下安裝命令&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo INSTALL_RKE2_CHANNEL=v1.34.4&amp;#43;rke2r1 ./install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INSTALL_RKE2_CHANNEL&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;指定要下載 RKE2 URL 的 Channel，預設是 &lt;code&gt;latest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[INFO] finding release for channel v1.34.4&amp;#43;rke2r1
[INFO] using v1.34.4&amp;#43;rke2r1 as release
[INFO] downloading checksums at https://github.com/rancher/rke2/releases/download/v1.34.4%2Brke2r1/sha256sum-amd64.txt
[INFO] downloading tarball at https://github.com/rancher/rke2/releases/download/v1.34.4%2Brke2r1/rke2.linux-amd64.tar.gz
[INFO] verifying tarball
[INFO] unpacking tarball file to /usr/local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3. enable rke2 and setup kubeconfig&lt;span class="hx:absolute hx:-mt-20" id="3-enable-rke2-and-setup-kubeconfig"&gt;&lt;/span&gt;
&lt;a href="#3-enable-rke2-and-setup-kubeconfig" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;3-1. 將 rke2-server 的服務設為開機自動啟動，並立即啟動服務&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable rke2-server --now&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;以上命令執行後的螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Created symlink /etc/systemd/system/multi-user.target.wants/rke2-server.service → /etc/systemd/system/rke2-server.service.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;3-2. Setup kubeconfig and crictl&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{
# 1. 建立目錄並設定 Kubeconfig
mkdir -p $HOME/.kube &amp;amp;&amp;amp; \
sudo cp /etc/rancher/rke2/rke2.yaml $HOME/.kube/config &amp;amp;&amp;amp; \
sudo chown $(id -u):$(id -g) $HOME/.kube/config &amp;amp;&amp;amp; \
# 2. 搬移執行檔
sudo cp /var/lib/rancher/rke2/bin/* /usr/local/bin/ &amp;amp;&amp;amp; \
# 3. 寫入 crictl 設定 (使用 printf 保持單行邏輯)
printf &amp;#34;runtime-endpoint: unix:///run/k3s/containerd/containerd.sock\nimage-endpoint: unix:///run/k3s/containerd/containerd.sock\ntimeout: 10\n&amp;#34; | sudo tee /etc/crictl.yaml &amp;gt; /dev/null &amp;amp;&amp;amp; \
# 4. 設定 Bash Alias 與補全
printf &amp;#34;\nsource &amp;lt;(kubectl completion bash)\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n&amp;#34; &amp;gt;&amp;gt; ~/.bashrc &amp;amp;&amp;amp; \
# 5. 立即生效
source ~/.bashrc
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;4. check pod status&lt;span class="hx:absolute hx:-mt-20" id="4-check-pod-status"&gt;&lt;/span&gt;
&lt;a href="#4-check-pod-status" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get po -A&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system cilium-j7jf2 1/1 Running 0 2m12s
kube-system cilium-operator-6fb6d5b896-jj2nx 1/1 Running 0 2m12s
kube-system etcd-rms-1.kubeantony.com 1/1 Running 0 2m31s
kube-system helm-install-rke2-cilium-qhdsl 0/1 Completed 0 2m24s
kube-system helm-install-rke2-coredns-hwsqp 0/1 Completed 0 2m24s
kube-system helm-install-rke2-ingress-nginx-bxt7n 0/1 Completed 0 2m24s
kube-system helm-install-rke2-metrics-server-qln6s 0/1 Completed 0 2m24s
kube-system helm-install-rke2-runtimeclasses-5kj6v 0/1 Completed 0 2m23s
kube-system helm-install-rke2-snapshot-controller-crd-vsbjv 0/1 Completed 0 2m23s
kube-system helm-install-rke2-snapshot-controller-z9kfv 0/1 Completed 1 2m23s
kube-system kube-apiserver-rms-1.kubeantony.com 1/1 Running 0 2m31s
kube-system kube-controller-manager-rms-1.kubeantony.com 1/1 Running 0 2m31s
kube-system kube-scheduler-rms-1.kubeantony.com 1/1 Running 0 2m31s
kube-system rke2-coredns-rke2-coredns-77f54456d4-kqbtc 1/1 Running 0 2m12s
kube-system rke2-coredns-rke2-coredns-autoscaler-6c58bf4677-wj7gp 1/1 Running 0 2m12s
kube-system rke2-ingress-nginx-controller-bhf7h 1/1 Running 0 62s
kube-system rke2-metrics-server-69f4f95bf7-tb6rc 1/1 Running 0 76s
kube-system rke2-snapshot-controller-bc4c494bf-cqj7t 1/1 Running 0 76s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;三、Join Additional Server Nodes&lt;span class="hx:absolute hx:-mt-20" id="三join-additional-server-nodes"&gt;&lt;/span&gt;
&lt;a href="#%e4%b8%89join-additional-server-nodes" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. Config RKE2 Basic Parameters&lt;span class="hx:absolute hx:-mt-20" id="1-config-rke2-basic-parameters-1"&gt;&lt;/span&gt;
&lt;a href="#1-config-rke2-basic-parameters-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;1-1. 下載 RKE2 的安裝腳本，並賦予執行權限&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;以下命令請在 Additional Server node 上執行&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sfL https://get.rke2.io --output install.sh &amp;amp;&amp;amp; chmod &amp;#43;x install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;RKE2 提供了一個安裝腳本，在 systemd 的系統上將其作為一個服務來安裝。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;1-2. 編輯 RKE2 Additional Server Node 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 K8s 要跑在哪張網卡上(以下指令預設會去找 default gateway 的網卡)
NIC=&amp;#34;$(ip route show default | cut -d&amp;#39; &amp;#39; -f5)&amp;#34;
IP=$(ip -4 -o addr show ${NIC} | awk &amp;#39;{print $4}&amp;#39; | cut -d/ -f1)
# 定義節點名稱
NODE_NAME=&amp;#34;$(hostname -f 2&amp;gt;/dev/null)&amp;#34;
NODE_NAME=&amp;#34;${NODE_NAME:-$(hostname)}&amp;#34;
# 定義第一台 Control-plane node 的 ip
ServerIP=&amp;#34;192.168.11.161&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/rancher/rke2/ &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/rancher/rke2/config.yaml
write-kubeconfig-mode: &amp;#34;0644&amp;#34;
debug: false
# =============================================
# 每台節點不同的設定
# =============================================
# 本機對外廣播的 IP（其他節點透過此 IP 連線）
advertise-address: &amp;#34;${IP}&amp;#34;
# 本機 IP
node-ip: &amp;#34;${IP}&amp;#34;
# 節點名稱（每台不同）
node-name: &amp;#34;${NODE_NAME}&amp;#34;
# TLS 憑證允許的 SAN（第一台 server 需完整設定）
tls-san:
- &amp;#34;${NODE_NAME}&amp;#34;
- &amp;#34;${IP}&amp;#34;
- &amp;#34;127.0.0.1&amp;#34;
# 第二台以後需加入此行，指向第一台 server（第一台不需要）
server: &amp;#34;https://${ServerIP}:9345&amp;#34;
# =============================================
# 所有 Server Node 必須相同的設定
# =============================================
# 叢集加入金鑰
token: &amp;#34;hehe&amp;#34;
# 各元件時區設定
etcd-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-apiserver-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-controller-manager-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
kube-scheduler-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
cloud-controller-manager-extra-env:
- &amp;#34;TZ=Asia/Taipei&amp;#34;
# kubelet 參數
kubelet-arg:
- &amp;#34;container-log-max-files=5&amp;#34; # 最多保留 5 個 log 檔
- &amp;#34;container-log-max-size=10Mi&amp;#34; # 每個 log 檔最大 10Mi
- &amp;#34;config=/etc/kubernetes/kubeletconfig.yml&amp;#34;
- &amp;#34;eviction-hard=memory.available&amp;lt;1000Mi,imagefs.available&amp;lt;5%,nodefs.available&amp;lt;5%&amp;#34; # 資源不足時驅逐 Pod 的閾值
# 停用內建 cloud controller
disable-cloud-controller: true
# 停用 kube-proxy，改由 Cilium 接管
disable-kube-proxy: true
# 停用不需要的內建元件
disable:
- rke2-canal # 停用預設 CNI Canal
- rke2-kube-proxy # 停用內建 kube-proxy
# 使用 Cilium 作為 CNI
cni:
- &amp;#34;cilium&amp;#34;
# 啟用 CIS security profile
#profile: &amp;#34;cis&amp;#34;
# API Server 額外參數
#kube-apiserver-arg:
# - &amp;#34;service-account-extend-token-expiration=false&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note: 要指定第一台 RKE2 Server node 的 IP&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;1-3. 編輯 kubelet 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/kubernetes &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/kubernetes/kubeletconfig.yml
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2. Install RKE2 with v1.34.4 veersion&lt;span class="hx:absolute hx:-mt-20" id="2-install-rke2-with-v1344-veersion"&gt;&lt;/span&gt;
&lt;a href="#2-install-rke2-with-v1344-veersion" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;2-1. 執行以下安裝命令&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo INSTALL_RKE2_CHANNEL=v1.34.4&amp;#43;rke2r1 ./install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INSTALL_RKE2_CHANNEL&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;指定要下載 RKE2 URL 的 Channel，預設是 &lt;code&gt;latest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[WARN] /usr/local is read-only or a mount point; installing to /opt/rke2
[INFO] finding release for channel v1.23.9&amp;#43;rke2r1
[INFO] using v1.23.9&amp;#43;rke2r1 as release
[INFO] downloading checksums at https://github.com/rancher/rke2/releases/download/v1.23.9&amp;#43;rke2r1/sha256sum-amd64.txt
[INFO] downloading tarball at https://github.com/rancher/rke2/releases/download/v1.23.9&amp;#43;rke2r1/rke2.linux-amd64.tar.gz
[INFO] verifying tarball
[INFO] unpacking tarball file to /opt/rke2
[INFO] updating tarball contents to reflect install path
[INFO] moving systemd units to /etc/systemd/system
[INFO] install complete; you may want to run: export PATH=$PATH:/opt/rke2/bin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3. enable rke2 and setup kubeconfig&lt;span class="hx:absolute hx:-mt-20" id="3-enable-rke2-and-setup-kubeconfig-1"&gt;&lt;/span&gt;
&lt;a href="#3-enable-rke2-and-setup-kubeconfig-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;3-1. 將 rke2-server 的服務設為開機自動啟動，並立即啟動服務&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable rke2-server --now&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;以上命令執行後的螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Created symlink /etc/systemd/system/multi-user.target.wants/rke2-server.service → /etc/systemd/system/rke2-server.service.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;4. check pod status&lt;span class="hx:absolute hx:-mt-20" id="4-check-pod-status-1"&gt;&lt;/span&gt;
&lt;a href="#4-check-pod-status-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get po -A&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system cilium-79sx5 1/1 Running 0 2m35s
kube-system cilium-j7jf2 1/1 Running 0 19m
kube-system cilium-operator-6fb6d5b896-jj2nx 1/1 Running 0 19m
kube-system etcd-rms-1.kubeantony.com 1/1 Running 0 19m
kube-system etcd-rms-2.kubeantony.com 1/1 Running 0 2m35s
kube-system helm-install-rke2-cilium-qhdsl 0/1 Completed 0 19m
kube-system helm-install-rke2-coredns-hwsqp 0/1 Completed 0 19m
kube-system helm-install-rke2-ingress-nginx-bxt7n 0/1 Completed 0 19m
kube-system helm-install-rke2-metrics-server-qln6s 0/1 Completed 0 19m
kube-system helm-install-rke2-runtimeclasses-5kj6v 0/1 Completed 0 19m
kube-system helm-install-rke2-snapshot-controller-crd-vsbjv 0/1 Completed 0 19m
kube-system helm-install-rke2-snapshot-controller-z9kfv 0/1 Completed 1 19m
kube-system kube-apiserver-rms-1.kubeantony.com 1/1 Running 0 19m
kube-system kube-apiserver-rms-2.kubeantony.com 1/1 Running 0 2m35s
kube-system kube-controller-manager-rms-1.kubeantony.com 1/1 Running 0 19m
kube-system kube-controller-manager-rms-2.kubeantony.com 1/1 Running 0 2m34s
kube-system kube-scheduler-rms-1.kubeantony.com 1/1 Running 0 19m
kube-system kube-scheduler-rms-2.kubeantony.com 1/1 Running 0 2m34s
kube-system rke2-coredns-rke2-coredns-77f54456d4-4n5k5 1/1 Running 0 82s
kube-system rke2-coredns-rke2-coredns-77f54456d4-kqbtc 1/1 Running 0 19m
kube-system rke2-coredns-rke2-coredns-autoscaler-6c58bf4677-wj7gp 1/1 Running 0 19m
kube-system rke2-ingress-nginx-controller-bhf7h 1/1 Running 0 18m
kube-system rke2-ingress-nginx-controller-vhmtb 1/1 Running 0 85s
kube-system rke2-metrics-server-69f4f95bf7-tb6rc 1/1 Running 0 18m
kube-system rke2-snapshot-controller-bc4c494bf-cqj7t 1/1 Running 0 18m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;四、Join Agent Nodes&lt;span class="hx:absolute hx:-mt-20" id="四join-agent-nodes"&gt;&lt;/span&gt;
&lt;a href="#%e5%9b%9bjoin-agent-nodes" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. Config RKE2 Basic Parameters&lt;span class="hx:absolute hx:-mt-20" id="1-config-rke2-basic-parameters-2"&gt;&lt;/span&gt;
&lt;a href="#1-config-rke2-basic-parameters-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;1-1. 下載 RKE2 的安裝腳本，並賦予執行權限&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;以下命令請在 agent node 上執行&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; curl -sfL https://get.rke2.io --output install.sh &amp;amp;&amp;amp; chmod &amp;#43;x install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;RKE2 提供了一個安裝腳本，在 systemd 的系統上將其作為一個服務來安裝。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;1-2. 編輯 RKE2 Additional Server Node 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 K8s 要跑在哪張網卡上
$ NIC=&amp;#39;eth1&amp;#39;
$ IP=$(ip -4 -o addr show ${NIC} | awk &amp;#39;{print $4}&amp;#39; | cut -d/ -f1)
# 定義 API Server 的 IP 位址
$ ServerIP=&amp;#39;192.168.11.35&amp;#39;
# 定義節點名稱
$ NODE_NAME=&amp;#39;w1&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; sudo mkdir -p /etc/rancher/rke2/ &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/rancher/rke2/config.yaml
server: https://${ServerIP}:9345
write-kubeconfig-mode: &amp;#34;0644&amp;#34;
debug: False
node-ip: &amp;#34;${IP}&amp;#34;
node-name:
- &amp;#34;${NODE_NAME}&amp;#34;
token: &amp;#34;hehe&amp;#34;
etcd-extra-env: TZ=Asia/Taipei
kube-apiserver-extra-env: TZ=Asia/Taipei
kube-controller-manager-extra-env: TZ=Asia/Taipei
kube-proxy-extra-env: TZ=Asia/Taipei
kube-scheduler-extra-env: TZ=Asia/Taipei
cloud-controller-manager-extra-env: TZ=Asia/Taipei
kubelet-arg:
- container-log-max-files=5
- container-log-max-size=10Mi
- &amp;#34;--config=/etc/kubernetes/kubeletconfig.yml&amp;#34;
- &amp;#34;--eviction-hard=memory.available&amp;lt;1000Mi,imagefs.available&amp;lt;5%,nodefs.available&amp;lt;5%&amp;#34;
#selinux: false
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note: 要指定第一台 RKE2 Server node 的 IP&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;1-3. 編輯 kubelet 設定檔&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; sudo mkdir -p /etc/kubernetes &amp;amp;&amp;amp; \
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/kubernetes/kubeletconfig.yml
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2. Install RKE2 with 1.31.2 veersion&lt;span class="hx:absolute hx:-mt-20" id="2-install-rke2-with-1312-veersion"&gt;&lt;/span&gt;
&lt;a href="#2-install-rke2-with-1312-veersion" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;2-1. 執行以下安裝命令&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; sudo INSTALL_RKE2_TYPE=&amp;#34;agent&amp;#34; INSTALL_RKE2_CHANNEL=v1.31.2&amp;#43;rke2r1 ./install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INSTALL_RKE2_CHANNEL&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;指定要下載 RKE2 URL 的 Channel，預設是 &lt;code&gt;latest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[INFO] finding release for channel v1.34.4&amp;#43;rke2r1
[INFO] using v1.34.4&amp;#43;rke2r1 as release
[INFO] downloading checksums at https://github.com/rancher/rke2/releases/download/v1.34.4%2Brke2r1/sha256sum-amd64.txt
[INFO] downloading tarball at https://github.com/rancher/rke2/releases/download/v1.34.4%2Brke2r1/rke2.linux-amd64.tar.gz
[INFO] verifying tarball
[INFO] unpacking tarball file to /usr/local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3. enable rke2&lt;span class="hx:absolute hx:-mt-20" id="3-enable-rke2"&gt;&lt;/span&gt;
&lt;a href="#3-enable-rke2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;3-1. 將 rke2-agent 的服務設為開機自動啟動，並立即啟動服務&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; sudo systemctl enable rke2-agent --now&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;以上命令執行後的螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Created symlink /etc/systemd/system/multi-user.target.wants/rke2-server.service → /etc/systemd/system/rke2-server.service.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;4. check pod status&lt;span class="hx:absolute hx:-mt-20" id="4-check-pod-status-2"&gt;&lt;/span&gt;
&lt;a href="#4-check-pod-status-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;以下命令在第一台 RKE2 Server 執行&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; kubectl get nodes,po -A&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
node/m1 Ready control-plane,etcd,master 4h32m v1.31.1&amp;#43;rke2r1
node/m2 Ready control-plane,etcd,master 18m v1.31.1&amp;#43;rke2r1
node/m3 Ready control-plane,etcd,master 12m v1.31.1&amp;#43;rke2r1
node/w1 Ready &amp;lt;none&amp;gt; 84s v1.31.1&amp;#43;rke2r1
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/cilium-2w97z 1/1 Running 0 84s
kube-system pod/cilium-b744m 1/1 Running 0 12m
kube-system pod/cilium-operator-84b8ff5b6c-stfdw 1/1 Running 4 (162m ago) 4h25m
kube-system pod/cilium-p45b4 1/1 Running 1 (162m ago) 4h
kube-system pod/cilium-qvqps 1/1 Running 0 18m
kube-system pod/etcd-m1 1/1 Running 1 4h32m
kube-system pod/etcd-m2 1/1 Running 0 18m
kube-system pod/etcd-m3 1/1 Running 0 11m
kube-system pod/helm-install-rke2-cilium-z7qsz 0/1 Completed 0 4h25m
kube-system pod/helm-install-rke2-coredns-9cg6t 0/1 Completed 0 4h32m
kube-system pod/helm-install-rke2-ingress-nginx-fscw4 0/1 Completed 0 4h32m
kube-system pod/helm-install-rke2-metrics-server-gw8qc 0/1 Completed 0 4h32m
kube-system pod/helm-install-rke2-multus-j8h9d 0/1 Completed 0 4h32m
kube-system pod/helm-install-rke2-snapshot-controller-crd-h58vl 0/1 Completed 0 4h32m
kube-system pod/helm-install-rke2-snapshot-controller-v6lwh 0/1 Completed 1 4h32m
kube-system pod/helm-install-rke2-snapshot-validation-webhook-gz77q 0/1 Completed 0 4h32m
kube-system pod/kube-apiserver-m1 1/1 Running 2 3h41m
kube-system pod/kube-apiserver-m2 1/1 Running 0 18m
kube-system pod/kube-apiserver-m3 1/1 Running 0 12m
kube-system pod/kube-controller-manager-m1 1/1 Running 10 (162m ago) 4h32m
kube-system pod/kube-controller-manager-m2 1/1 Running 0 18m
kube-system pod/kube-controller-manager-m3 1/1 Running 0 12m
kube-system pod/kube-scheduler-m1 1/1 Running 2 (162m ago) 4h32m
kube-system pod/kube-scheduler-m2 1/1 Running 0 18m
kube-system pod/kube-scheduler-m3 1/1 Running 0 12m
kube-system pod/rke2-coredns-rke2-coredns-79f8cbfcf7-9rh2l 1/1 Running 0 18m
kube-system pod/rke2-coredns-rke2-coredns-79f8cbfcf7-bwvtc 1/1 Running 0 161m
kube-system pod/rke2-coredns-rke2-coredns-autoscaler-7cf7db4bdc-t8ff7 1/1 Running 1 (162m ago) 4h
kube-system pod/rke2-ingress-nginx-controller-4hns2 1/1 Running 0 48s
kube-system pod/rke2-ingress-nginx-controller-7c5bp 1/1 Running 0 11m
kube-system pod/rke2-ingress-nginx-controller-8qrjf 1/1 Running 0 18m
kube-system pod/rke2-ingress-nginx-controller-rwpdf 1/1 Running 1 (162m ago) 3h40m
kube-system pod/rke2-metrics-server-6d887864c-vdkgn 0/1 Completed 0 4h25m
kube-system pod/rke2-metrics-server-6d887864c-vdt5s 1/1 Running 1 (162m ago) 4h
kube-system pod/rke2-multus-6vcp7 1/1 Running 3 (50s ago) 84s
kube-system pod/rke2-multus-bxdkm 1/1 Running 2 (11m ago) 12m
kube-system pod/rke2-multus-hfqc6 1/1 Running 1 (162m ago) 4h
kube-system pod/rke2-multus-t7vln 1/1 Running 2 (18m ago) 18m
kube-system pod/rke2-snapshot-controller-658d97fccc-7gkrv 1/1 Running 7 (162m ago) 4h25m
kube-system pod/rke2-snapshot-validation-webhook-784bcc6c8-xfq68 1/1 Running 1 (162m ago) 4h25m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h1&gt;Install K3S v1.26.9&lt;/h1&gt;&lt;ol&gt;
&lt;li&gt;安裝命令&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ curl -sfL https://get.k3s.io/ | INSTALL_K3S_VERSION=v1.26.9&amp;#43;k3s1 K3S_KUBECONFIG_MODE=&amp;#34;644&amp;#34; sh -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;設定 kubeconfig&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ mkdir -p $HOME/.kube &amp;amp;&amp;amp; sudo cp /etc/rancher/k3s/k3s.yaml $HOME/.kube/config &amp;amp;&amp;amp; sudo chown $(id -u):$(id -g) $HOME/.kube/config &amp;amp;&amp;amp; sudo chmod 600 $HOME/.kube/config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h1&gt;Helm Install Rancher Prime v2.13.2&lt;/h1&gt;&lt;h2&gt;1. Add the Helm Chart Repository&lt;span class="hx:absolute hx:-mt-20" id="1-add-the-helm-chart-repository"&gt;&lt;/span&gt;
&lt;a href="#1-add-the-helm-chart-repository" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1.1 Install helm3&lt;span class="hx:absolute hx:-mt-20" id="11-install-helm3"&gt;&lt;/span&gt;
&lt;a href="#11-install-helm3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在第一台 Master Node 上執行以下命令&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;下載 helm 壓縮檔&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget https://get.helm.sh/helm-v3.8.2-linux-amd64.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;--2022-09-21 09:06:57-- https://get.helm.sh/helm-v3.8.2-linux-amd64.tar.gz
Resolving get.helm.sh (get.helm.sh)... 152.199.39.108, 2606:2800:247:1cb7:261b:1f9c:2074:3c
Connecting to get.helm.sh (get.helm.sh)|152.199.39.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13633605 (13M) [application/x-tar]
Saving to: ‘helm-v3.8.2-linux-amd64.tar.gz’
helm-v3.8.2-linux-amd64.tar.gz 100%[=============================================================&amp;gt;] 13.00M 5.95MB/s in 2.2s
2022-09-21 09:07:00 (5.95 MB/s) - ‘helm-v3.8.2-linux-amd64.tar.gz’ saved [13633605/13633605]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;解壓縮 helm 壓縮檔&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar zxvf helm-v3.8.2-linux-amd64.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;linux-amd64/
linux-amd64/helm
linux-amd64/LICENSE
linux-amd64/README.md&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;將 helm 執行檔拷貝至 PATH 環境變數中的 &lt;code&gt;/usr/local/bin/&lt;/code&gt; 目錄下&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp linux-amd64/helm /usr/local/bin/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;1.2 Add the Helm Chart Repository&lt;span class="hx:absolute hx:-mt-20" id="12-add-the-helm-chart-repository"&gt;&lt;/span&gt;
&lt;a href="#12-add-the-helm-chart-repository" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;Prime: Recommended for production environments&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm repo add rancher-prime https://charts.rancher.com/server-charts/prime&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm repo add rancher-latest https://releases.rancher.com/server-charts/latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm repo add rancher-stable https://releases.rancher.com/server-charts/stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;2. Create a Namespace for Rancher&lt;span class="hx:absolute hx:-mt-20" id="2-create-a-namespace-for-rancher"&gt;&lt;/span&gt;
&lt;a href="#2-create-a-namespace-for-rancher" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;This should always be &lt;code&gt;cattle-system&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create ns cattle-system&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;3. Choose your SSL Configuration&lt;span class="hx:absolute hx:-mt-20" id="3-choose-your-ssl-configuration"&gt;&lt;/span&gt;
&lt;a href="#3-choose-your-ssl-configuration" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;建立和切換至工作目錄&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir ssl;cd ssl&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;下載 產生自簽憑證 腳本，並賦予執行權限&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget https://raw.githubusercontent.com/cooloo9871/openssl/master/mk &amp;amp;&amp;amp; \
chmod &amp;#43;x mk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;執行腳本產生自簽憑證&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;./mk create rancher.example.com 192.168.11.60&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;第一個參數放 rancher 的 Domain Name
第二個參數放 LB 的 IP (HA Rancher)，或是 rancher 本身的 IP&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Generating RSA private key, 4096 bit long modulus (2 primes)
.........................................................................................................................................................................................................................&amp;#43;&amp;#43;&amp;#43;&amp;#43;
....................................................................................................................................................................................................................................................&amp;#43;&amp;#43;&amp;#43;&amp;#43;
e is 65537 (0x010001)
Generating RSA private key, 4096 bit long modulus (2 primes)
..........................................................&amp;#43;&amp;#43;&amp;#43;&amp;#43;
..&amp;#43;&amp;#43;&amp;#43;&amp;#43;
e is 65537 (0x010001)
Signature ok
subject=CN = example
Getting CA Private Key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢查是否符合預期&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ls -l
total 32
-rw------- 1 rancher users 3326 Feb 13 13:58 ca-key.pem
-rw-r--r-- 1 rancher users 2009 Feb 13 13:58 ca.pem
-rw-r--r-- 1 rancher users 41 Feb 13 13:58 ca.srl
-rw-r--r-- 1 rancher users 1582 Feb 13 13:58 cert.csr
-rw------- 1 rancher users 3243 Feb 13 13:58 cert-key.pem
-rw-r--r-- 1 rancher users 1874 Feb 13 13:58 cert.pem
-rw-r--r-- 1 rancher users 86 Feb 13 13:58 extfile.cnf
-rwxr-xr-x 1 rancher users 1166 Feb 13 13:57 mk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Create the certificate secret resource&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;將伺服器憑證和任何中間證書串聯到一個名為 tls.crt 的檔案中，並在一個名為 tls.key 的檔案中提供相應的證書密鑰。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cattle-system create secret tls tls-rancher-ingress \
--cert=cert.pem \
--key=cert-key.pem
kubectl -n cattle-system create secret generic tls-ca --from-file=cacerts.pem=./cert.pem
kubectl -n cattle-system get secret
NAME TYPE DATA AGE
default-token-h9lwm kubernetes.io/service-account-token 3 2m15s
tls-ca Opaque 1 13s
tls-rancher-ingress kubernetes.io/tls 2 52s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;把 ca.pem 複製到 rancher 託管的每座 Downstream cluster 中的每台 Node 上&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;之後使用 Rancher 註冊就不需要再勾選 insecure 了&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;scp ca.pem rancher@&amp;lt;client&amp;gt;:~
# ssh 到 client 上
sudo cp ca.pem /etc/pki/trust/anchors/
sudo cp ca.pem /usr/share/pki/trust/anchors/
sudo update-ca-certificates&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Install from the cert-manager release manifest&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.20.0/cert-manager.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Check cert-manager pod status&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cert-manager get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cert-manager-7b8b89f89d-9tsmq 1/1 Running 0 43s
cert-manager-cainjector-7f9fdd5dd5-mqspq 1/1 Running 0 43s
cert-manager-webhook-769f6b94cb-vmwm2 1/1 Running 0 43s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;h2&gt;4. Install Rancher Prime with Helm and Your Chosen Certificate Option&lt;span class="hx:absolute hx:-mt-20" id="4-install-rancher-prime-with-helm-and-your-chosen-certificate-option"&gt;&lt;/span&gt;
&lt;a href="#4-install-rancher-prime-with-helm-and-your-chosen-certificate-option" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;建立 Rancher Prime 並且使用自簽憑證&lt;span class="hx:absolute hx:-mt-20" id="建立-rancher-prime-並且使用自簽憑證"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-rancher-prime-%e4%b8%a6%e4%b8%94%e4%bd%bf%e7%94%a8%e8%87%aa%e7%b0%bd%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm install rancher rancher-prime/rancher \
--namespace cattle-system \
--version=2.13.2 \
--set bootstrapPassword=rancheradmin \
--set hostname=rancher.example.com \
--set replicas=3 \
--set ingress.tls.source=secret \
--set privateCA=true
--set global.cattle.psp.enabled=false&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;建立 Rancher Prime 並且使用 Cert-manager 產生憑證&lt;span class="hx:absolute hx:-mt-20" id="建立-rancher-prime-並且使用-cert-manager-產生憑證"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-rancher-prime-%e4%b8%a6%e4%b8%94%e4%bd%bf%e7%94%a8-cert-manager-%e7%94%a2%e7%94%9f%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm install rancher rancher-prime/rancher \
--namespace cattle-system \
--set hostname=ha-rancher.kubeantony.com \
--set bootstrapPassword=rancheradmin \
--set global.cattle.psp.enabled=false \
--set replicas=3 \
--version 2.13.2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;5. Verify that the Rancher Server is Successfully Deployed&lt;span class="hx:absolute hx:-mt-20" id="5-verify-that-the-rancher-server-is-successfully-deployed"&gt;&lt;/span&gt;
&lt;a href="#5-verify-that-the-rancher-server-is-successfully-deployed" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cattle-system get po&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
helm-operation-cnlsx 0/2 Completed 0 14m
helm-operation-hfpdh 0/2 Completed 0 15m
helm-operation-llz2m 0/2 Completed 0 15m
helm-operation-pcq4s 0/2 Completed 0 16m
helm-operation-tw5hw 0/2 Completed 0 15m
rancher-647cdd469b-7ctmw 1/1 Running 0 20m
rancher-647cdd469b-l5q7w 1/1 Running 1 (17m ago) 20m
rancher-647cdd469b-mb4rc 1/1 Running 1 (17m ago) 20m
rancher-webhook-fb6768c79-fk9jl 1/1 Running 0 15m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;檢查名稱解析&lt;span class="hx:absolute hx:-mt-20" id="檢查名稱解析"&gt;&lt;/span&gt;
&lt;a href="#%e6%aa%a2%e6%9f%a5%e5%90%8d%e7%a8%b1%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; curl -k -H &amp;#34;host: rancher.example.com&amp;#34; https://192.168.11.50/dashboard/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;匯出 cert-manager 簽的憑證&lt;span class="hx:absolute hx:-mt-20" id="匯出-cert-manager-簽的憑證"&gt;&lt;/span&gt;
&lt;a href="#%e5%8c%af%e5%87%ba-cert-manager-%e7%b0%bd%e7%9a%84%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; curl -k -s -fL rancher.example.com/v3/settings/cacerts | jq -r .value&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;將憑證匯入瀏覽器&lt;span class="hx:absolute hx:-mt-20" id="將憑證匯入瀏覽器"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%87%e6%86%91%e8%ad%89%e5%8c%af%e5%85%a5%e7%80%8f%e8%a6%bd%e5%99%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;在 client 的瀏覽器把 ca.pem import 進去 (此方法為自簽憑證時使用)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://i.imgur.com/JMoScUp.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;就可以使用 https 登入 rancher&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://i.imgur.com/DYmsfUN.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;Rancher 生成 RKE2 之前的必要設定&lt;span class="hx:absolute hx:-mt-20" id="rancher-生成-rke2-之前的必要設定"&gt;&lt;/span&gt;
&lt;a href="#rancher-%e7%94%9f%e6%88%90-rke2-%e4%b9%8b%e5%89%8d%e7%9a%84%e5%bf%85%e8%a6%81%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;節點必須能夠透過 DNS 解析 Rancher 的 FQDN，不要透過 &lt;code&gt;/etc/hosts&lt;/code&gt; 解析，否則 Rancher 的 Agent ( cattle-cluster-agent ) 會在建立的時候無法存取到 Rancher。&lt;/li&gt;
&lt;li&gt;如果想透過 &lt;code&gt;/etc/hosts&lt;/code&gt; 去解析 Rancher FQDN 對應的 IP Address 的話，請依照以下步驟設定&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;ol&gt;
&lt;li&gt;編輯 Patch file Yaml 檔&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cat &amp;lt;&amp;lt;EOF &amp;gt; patch-file-hostalias.yaml
spec:
template:
spec:
hostAliases:
- ip: &amp;#34;192.168.0.11&amp;#34;
hostnames:
- &amp;#34;antony-rancher.example.com&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;hostAliases&lt;/code&gt; 輸入 Rancher 所在的主機 IP Address
&lt;code&gt;hostnames&lt;/code&gt; 輸入 Racher 的 FDQN&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Patch &lt;code&gt;cattle-cluster-agent&lt;/code&gt; 這個 Deployment&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n cattle-system patch deployment cattle-cluster-agent --patch-file patch-file-hostalias.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;檢視 Pods 運作狀態&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n cattle-system get pods -l app=cattle-cluster-agent&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cattle-cluster-agent-6c54877576-hmtgq 1/1 Running 0 22m
cattle-cluster-agent-6c54877576-zt6mb 1/1 Running 0 22m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;請注意，這個方法永遠不要在 Production 環境使用，只能在測試環境使用，因為如果 DownStream Cluster 有被更新，Patch 的設定有可能會被覆蓋&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;Rancher 生成 RKE2 之後的必要設定&lt;span class="hx:absolute hx:-mt-20" id="rancher-生成-rke2-之後的必要設定"&gt;&lt;/span&gt;
&lt;a href="#rancher-%e7%94%9f%e6%88%90-rke2-%e4%b9%8b%e5%be%8c%e7%9a%84%e5%bf%85%e8%a6%81%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在每一台 Control Plane Node 的設定&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{
# 1. 建立目錄並設定 Kubeconfig
mkdir -p $HOME/.kube &amp;amp;&amp;amp; \
sudo cp /etc/rancher/rke2/rke2.yaml $HOME/.kube/config &amp;amp;&amp;amp; \
sudo chown $(id -u):$(id -g) $HOME/.kube/config &amp;amp;&amp;amp; \
# 2. 搬移執行檔
sudo cp /var/lib/rancher/rke2/bin/* /usr/local/bin/ &amp;amp;&amp;amp; \
sudo cp /opt/rke2/bin/* /usr/local/bin/ ; \
# 3. 寫入 crictl 設定 (使用 printf 保持單行邏輯)
printf &amp;#34;runtime-endpoint: unix:///run/k3s/containerd/containerd.sock\nimage-endpoint: unix:///run/k3s/containerd/containerd.sock\ntimeout: 10\n&amp;#34; | sudo tee /etc/crictl.yaml &amp;gt; /dev/null &amp;amp;&amp;amp; \
# 4. 設定 Bash Alias 與補全
printf &amp;#34;\nsource &amp;lt;(kubectl completion bash)\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n&amp;#34; &amp;gt;&amp;gt; ~/.bashrc &amp;amp;&amp;amp; \
# 5. 立即生效
source ~/.bashrc
} &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在每一台 Worker Node 要做的設定&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;~&amp;gt; sudo cp /opt/rke2/bin/* /usr/local/bin/ &amp;amp;&amp;amp; \
sudo cp /var/lib/rancher/rke2/bin/* /usr/local/bin/
# Setup crictl config
~&amp;gt; cat &amp;lt;&amp;lt;EOF | sudo tee /etc/crictl.yaml
runtime-endpoint: unix:///run/k3s/containerd/containerd.sock
image-endpoint: unix:///run/k3s/containerd/containerd.sock
timeout: 10
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;Helm upgrade Rancher&lt;/h1&gt;&lt;ol&gt;
&lt;li&gt;Update your local helm repo cache&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm repo update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Export the current values to a file:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm get values rancher -n cattle-system -o yaml &amp;gt; values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Helm 查詢 Rancher 的版本，命令如下 :&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm -n cattle-system repo ls
- name: rancher-prime
url: https://charts.rancher.com/server-charts/prime
$ helm search repo rancher-prime --versions
NAME CHART VERSION APP VERSION DESCRIPTION
rancher-prime/rancher 2.8.2 v2.8.2 Install Rancher Server to manage Kubernetes clu...
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Upgrade Rancher Version&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm upgrade rancher rancher-&amp;lt;CHART_REPO&amp;gt;/rancher \
--namespace cattle-system \
-f values.yaml \
--version=2.8.2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;RKE2 設定私有 Image Registry&lt;/h1&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;可以透過 Rancher 設定或是手動更改 Containerd 的設定檔，Rancher 做的設定會直接套用到整個叢集的每一台 Node 上，手動設定會需要一台一台 Node 去做設定。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;Rancher 設定&lt;span class="hx:absolute hx:-mt-20" id="rancher-設定"&gt;&lt;/span&gt;
&lt;a href="#rancher-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;更改叢集設定檔&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByuSVSjET.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;輸入 Image Registry 資訊&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJd9NBj4a.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Registry Hostname: &lt;code&gt;10.43.0.11:5000&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Mirror Endpoints: &lt;code&gt;http://10.43.0.11:5000&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SyV-IHjET.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Registry Hostname: &lt;code&gt;10.43.0.11:5000&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;TLS Secret: &lt;code&gt;None&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Authentication: &lt;code&gt;Create a HTTP Basic Auth Secret&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Username: &lt;code&gt;docker&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Password: &lt;code&gt;xxx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; Skip TLS Verifications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1mhBHsVp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;儲存並套用設定至整個叢集&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByHHIBjNa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;手動設定&lt;span class="hx:absolute hx:-mt-20" id="手動設定"&gt;&lt;/span&gt;
&lt;a href="#%e6%89%8b%e5%8b%95%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;注意資訊 :&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;ul&gt;
&lt;li&gt;如果只改一台 Node，那麼就只有該節點能夠到設定的 Image Registry 下載或上傳 Images。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;config.toml.tmpl&lt;/code&gt; 這個檔案如果被刪掉，那麼假設 RKE2 是被 Rancher 管理的，設定的內容，會被 Rancher 同步回來。反之，如果沒被刪掉，那麼在 Rancher 設定的值將永遠無法被套用，直到 &lt;code&gt;config.toml.tmpl&lt;/code&gt; 這個檔案被刪除。&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;複製一份 Cotainerd 的設定檔&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo cp /var/lib/rancher/rke2/agent/etc/containerd/config.toml /var/lib/rancher/rke2/agent/etc/containerd/config.toml.tmpl&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;重要: 檔名一定要是 &lt;code&gt;config.toml.tmpl&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;修改 &lt;code&gt;config.toml.tmpl&lt;/code&gt; 檔案內容&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo nano /var/lib/rancher/rke2/agent/etc/containerd/config.toml.tmpl&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;新增以下內容 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[plugins.&amp;#34;io.containerd.grpc.v1.cri&amp;#34;.registry.configs.&amp;#34;HARBOR_FQDN&amp;#34;.auth]
username = &amp;#34;xxx&amp;#34;
password = &amp;#34;xxx&amp;#34;
[plugins.&amp;#34;io.containerd.grpc.v1.cri&amp;#34;.registry.configs.&amp;#34;HARBOR_FQDN&amp;#34;.tls]
insecure_skip_verify = true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果 Image Registry 是 HTTP，那麼必須再額外新增以下內容&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[plugins.&amp;#34;io.containerd.grpc.v1.cri&amp;#34;.registry.mirrors]
[plugins.&amp;#34;io.containerd.grpc.v1.cri&amp;#34;.registry.mirrors.&amp;#34;{FQDN or IP Address}:Port&amp;#34;]
endpoint = [&amp;#34;http://{FQDN or IP Address}:Port&amp;#34;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;重啟 RKE2 服務&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo systemctl restart rke2-server.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果是 RKE2 worker 節點要重啟的服務是 &lt;code&gt;rke2-agent.service&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;刪除 &lt;code&gt;config.toml.tmpl&lt;/code&gt; 檔案 (不一定要做)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo rm /var/lib/rancher/rke2/agent/etc/containerd/config.toml.tmpl&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重要 ! 如果 RKE2 由 Rancher 管理，那麼只要這個檔案存在，在 Rancher 設定的 Image Registry 資訊，都會被這個檔案覆蓋，所以要自行決定是否刪除。&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h1&gt;Enable Rrancher Audit log&lt;/h1&gt;&lt;h2&gt;PreRequest&lt;span class="hx:absolute hx:-mt-20" id="prerequest"&gt;&lt;/span&gt;
&lt;a href="#prerequest" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;Note: Rancher 要可以收到 Audit log ，它所在的 K8S 也要先啟動 Audit log&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;1. RKE2 啟動 Audit log&lt;span class="hx:absolute hx:-mt-20" id="1-rke2-啟動-audit-log"&gt;&lt;/span&gt;
&lt;a href="#1-rke2-%e5%95%9f%e5%8b%95-audit-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Step 1: Update the RKE2 Configuration File&lt;span class="hx:absolute hx:-mt-20" id="step-1-update-the-rke2-configuration-file"&gt;&lt;/span&gt;
&lt;a href="#step-1-update-the-rke2-configuration-file" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ echo &amp;#34;audit-policy-file: /etc/rancher/rke2/audit-policy.yaml&amp;#34; | sudo tee -a /etc/rancher/rke2/config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 2: Create an Audit Policy File&lt;span class="hx:absolute hx:-mt-20" id="step-2-create-an-audit-policy-file"&gt;&lt;/span&gt;
&lt;a href="#step-2-create-an-audit-policy-file" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cat &amp;lt;&amp;lt;EOF | sudo tee /etc/rancher/rke2/audit-policy.yaml
apiVersion: audit.k8s.io/v1
kind: Policy
metadata:
creationTimestamp: null
rules:
- level: Metadata
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 3: Restart RKE2 Server&lt;span class="hx:absolute hx:-mt-20" id="step-3-restart-rke2-server"&gt;&lt;/span&gt;
&lt;a href="#step-3-restart-rke2-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo systemctl restart rke2-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 4: Monitor Audit Log&lt;span class="hx:absolute hx:-mt-20" id="step-4-monitor-audit-log"&gt;&lt;/span&gt;
&lt;a href="#step-4-monitor-audit-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo tail -f /var/lib/rancher/rke2/server/logs/audit.log&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;2. Enable Rrancher Audit log&lt;span class="hx:absolute hx:-mt-20" id="2-enable-rrancher-audit-log"&gt;&lt;/span&gt;
&lt;a href="#2-enable-rrancher-audit-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Step 1: Export the current values to a file:&lt;span class="hx:absolute hx:-mt-20" id="step-1--export-the-current-values-to-a-file"&gt;&lt;/span&gt;
&lt;a href="#step-1--export-the-current-values-to-a-file" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm get values rancher -n cattle-system -o yaml &amp;gt; values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 2: 新增 Audit log 設定&lt;span class="hx:absolute hx:-mt-20" id="step-2-新增-audit-log-設定"&gt;&lt;/span&gt;
&lt;a href="#step-2-%e6%96%b0%e5%a2%9e-audit-log-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cat &amp;lt;&amp;lt;EOF | sudo tee -a values.yaml
auditLog:
destination: sidecar
hostPath: /var/log/rancher/audit/
level: 3
maxAge: 3
maxBackup: 1
maxSize: 100
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Step 3: 更新 Rancher 啟動 Audit log&lt;span class="hx:absolute hx:-mt-20" id="step-3-更新-rancher-啟動-audit-log"&gt;&lt;/span&gt;
&lt;a href="#step-3-%e6%9b%b4%e6%96%b0-rancher-%e5%95%9f%e5%8b%95-audit-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ helm upgrade rancher rancher-prime/rancher \
--namespace cattle-system \
-f values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;設定 RKE2 Cluster Pod 總量限制&lt;/h1&gt;&lt;ol&gt;
&lt;li&gt;點選 &amp;ldquo;Cluster Management&amp;rdquo; -&amp;gt; 在要設定的叢集旁邊點選 &amp;ldquo;Edit Config&amp;rdquo;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkaMzWxPp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;在 Cluster Configuration 的左側選單中點選 &amp;ldquo;Advanced&amp;rdquo;，並在 Additional Kubelet Args 區塊下點選 &amp;ldquo;Add Argument&amp;rdquo;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJ5LXbePa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;輸入以下設定值，並點選右下角 &amp;ldquo;Save&amp;rdquo; 套用設定&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;max-pods=250&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;max-pods&lt;/code&gt; means Number of Pods that can run on this kubelet.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;從 Rancher 設定的話，會把以上新增的設定套用到 K8S Cluster 的每個節點上。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyO67bev6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;回到 &amp;ldquo;Home&amp;rdquo;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1U-4ZlwT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;我的 Cluster 有 3 台 Node，所以 250 x 3 = 750&lt;br&gt;
可以參考我做的測試 &lt;a
href="https://hackmd.io/@QI-AN/What-happens-when-the-number-of-K8S-Pods-exceeds-110"target="_blank" rel="noopener"&gt;測試 K8S Pod 數量超過 110 會發生甚麼事?&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h1&gt;Trouble shooting&lt;/h1&gt;&lt;h2&gt;在 Join Master Node 的時候，不小心設定到同一個 node name ，然後 etcd 咬住原來 node 的名稱怎麼辦&lt;span class="hx:absolute hx:-mt-20" id="在-join-master-node-的時候不小心設定到同一個-node-name-然後-etcd-咬住原來-node-的名稱怎麼辦"&gt;&lt;/span&gt;
&lt;a href="#%e5%9c%a8-join-master-node-%e7%9a%84%e6%99%82%e5%80%99%e4%b8%8d%e5%b0%8f%e5%bf%83%e8%a8%ad%e5%ae%9a%e5%88%b0%e5%90%8c%e4%b8%80%e5%80%8b-node-name-%e7%84%b6%e5%be%8c-etcd-%e5%92%ac%e4%bd%8f%e5%8e%9f%e4%be%86-node-%e7%9a%84%e5%90%8d%e7%a8%b1%e6%80%8e%e9%ba%bc%e8%be%a6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;錯誤訊息&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ETCD join failed: duplicate node name found, please use a unique name for this node&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;解決辦法&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;先進去 etcd 的 pod 中&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system exec -it etcd-staging-kube-master-1.fqdn.com -- bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;列出 etcd 的成員&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;etcdctl --cert /var/lib/rancher/rke2/server/tls/etcd/server-client.crt --key /var/lib/rancher/rke2/server/tls/etcd/server-client.key --endpoints https://127.0.0.1:2379 --cacert /var/lib/rancher/rke2/server/tls/etcd/server-ca.crt member list&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;121f9e856446fcc4, started, rsm2-f826f76c, https://192.168.11.62:2380, https://192.168.11.62:2379, false
67f4840cc79f9560, started, rsm1-168e267e, https://192.168.11.61:2380, https://192.168.11.61:2379, false
6b20c6a3411cab14, started, rsm3-2126c18e, https://192.168.11.63:2380, https://192.168.11.63:2379, false&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;刪除重複的 etcd 成員&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;etcdctl --cert /var/lib/rancher/rke2/server/tls/etcd/server-client.crt --key /var/lib/rancher/rke2/server/tls/etcd/server-client.key --endpoints https://127.0.0.1:2379 --cacert /var/lib/rancher/rke2/server/tls/etcd/server-ca.crt member remove 6b20c6a3411cab14&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Member 6b20c6a3411cab14 removed from cluster 9ea915bf6adaa894&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;手動更新 Cert-manager 做給 Rancher 用的憑證&lt;/h1&gt;&lt;p&gt;Rancher 透過 Cert-manager 做出來的憑證，有效期限預設為 90 天，在第 60 天的時候會嘗試自動更換憑證。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;SSH 連線至可以執行 &lt;code&gt;kubectl&lt;/code&gt; 管理 UpStream Cluster ( Rancher 所在的 Kubernetes Cluster ) 的機器&lt;/li&gt;
&lt;li&gt;下載 Cert-manager 管理工具&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ curl -fsSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/latest/download/cmctl-linux-amd64.tar.gz &amp;amp;&amp;amp; tar xzf cmctl.tar.gz &amp;amp;&amp;amp; sudo mv cmctl /usr/local/bin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;檢查 Rancher 當前使用憑證的有效日期&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ echo | openssl s_client -connect `kubectl -n cattle-system get ing --no-headers -o custom-columns=HOSTS:.spec.rules[*].host`:443 2&amp;gt;/dev/null | openssl x509 -noout -dates&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;notBefore=Feb 19 05:31:37 2024 GMT
notAfter=May 19 05:31:37 2024 GMT&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;手動 Renew Rancher 憑證&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;4.1. 檢查 Rancher 在 Kubernetes 中使用的憑證名稱&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n cattle-system get certificate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY SECRET AGE
tls-rancher-ingress True tls-rancher-ingress 2d21h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;4.2. 手動 Renew 憑證&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cmctl -n cattle-system renew tls-rancher-ingress&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Manually triggered issuance of Certificate cattle-system/tls-rancher-ingress&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;4.3. 檢查建立憑證的 Request 是否發出&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n cattle-system get certificaterequest --sort-by=.metadata.creationTimestamp&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME APPROVED DENIED READY ISSUER REQUESTOR AGE
tls-rancher-ingress-9jb67 True True rancher system:serviceaccount:cert-manager:cert-manager 2d21h
tls-rancher-ingress-m59sk True True rancher system:serviceaccount:cert-manager:cert-manager 3s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;確認憑證當前狀態的詳細資訊&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cmctl -n cattle-system status certificate tls-rancher-ingress&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Name: tls-rancher-ingress
Namespace: cattle-system
Created at: 2024-02-16T17:08:39&amp;#43;08:00
Conditions:
Ready: True, Reason: Ready, Message: Certificate is up to date and has not expired
DNS Names:
- 172.20.0.37.nip.io
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Requested 13m cert-manager-certificates-request-manager Created new CertificateRequest resource &amp;#34;tls-rancher-ingress-7hdcg&amp;#34;
Normal Requested 6m49s cert-manager-certificates-request-manager Created new CertificateRequest resource &amp;#34;tls-rancher-ingress-8hhjl&amp;#34;
Normal Reused 2m56s (x6 over 156m) cert-manager-certificates-key-manager Reusing private key stored in existing Secret resource &amp;#34;tls-rancher-ingress&amp;#34;
Normal Issuing 2m56s (x6 over 156m) cert-manager-certificates-issuing The certificate has been successfully issued
Normal Requested 2m56s cert-manager-certificates-request-manager Created new CertificateRequest resource &amp;#34;tls-rancher-ingress-m59sk&amp;#34;
Issuer:
Name: rancher
Kind: Issuer
Conditions:
Ready: True, Reason: KeyPairVerified, Message: Signing CA verified
Events: &amp;lt;none&amp;gt;
Secret:
Name: tls-rancher-ingress
Issuer Country:
Issuer Organisation: dynamiclistener-org
Issuer Common Name: dynamiclistener-ca@1708074590
Key Usage: Digital Signature, Key Encipherment
Extended Key Usages:
Public Key Algorithm: RSA
Signature Algorithm: ECDSA-SHA256
Subject Key ID:
Authority Key ID: bc3674dd7762dca834cb5586c463a2c858d11528
Serial Number: c9246b491d331f8d197eed83d4de06d5
Events: &amp;lt;none&amp;gt;
Not Before: 2024-02-19T14:47:46&amp;#43;08:00
Not After: 2024-05-19T14:47:46&amp;#43;08:00
Renewal Time: 2024-04-19T14:47:46&amp;#43;08:00
No CertificateRequest found for this Certificate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Not Before&lt;/code&gt;，憑證有效期限的開始日期&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Not After&lt;/code&gt;，憑證有效期限的結束日期&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Renewal Time&lt;/code&gt;，cert-manager 將把憑證的 &lt;code&gt;status.RenewalTime&lt;/code&gt; 設定為嘗試更新的時間。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h1&gt;參考網站&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://docs.rke2.io/install/quickstart"target="_blank" rel="noopener"&gt;RKE2 Quick Start - RKE2 Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://docs.rke2.io/install/ha"target="_blank" rel="noopener"&gt;RKE2 High Availability - RKE2 Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-v2-7-6/"target="_blank" rel="noopener"&gt;Rancher Support Matrix - SUSE Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://ranchermanager.docs.rancher.com/pages-for-subheaders/install-upgrade-on-a-kubernetes-cluster"target="_blank" rel="noopener"&gt;Install/Upgrade Rancher on a Kubernetes Cluster - Rancher Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://docs.rke2.io/install/containerd_registry_configuration"target="_blank" rel="noopener"&gt;Containerd Registry Configuration - RKE2 Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://cert-manager.io/docs/reference/cmctl/#renew"target="_blank" rel="noopener"&gt;Renew Certificate - Cert-manager Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://cert-manager.io/docs/usage/certificate/#reissuance-triggered-by-expiry-renewal"target="_blank" rel="noopener"&gt;Reissuance triggered by expiry (renewal) - Cert-manager Docs &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Logging Operator</title><link>https://blog.kubeantony.com/archive/kubernetes/logging-operator/</link><pubDate>Tue, 24 Mar 2026 10:12:54 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/logging-operator/</guid><description>
&lt;h2&gt;Preface&lt;span class="hx:absolute hx:-mt-20" id="preface"&gt;&lt;/span&gt;
&lt;a href="#preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章會先介紹什麼是 Logging Operator，並透過 Rancher Logging 實作將 Pod Log 導入 OpenSearch&lt;/p&gt;
&lt;h2&gt;簡介&lt;span class="hx:absolute hx:-mt-20" id="簡介"&gt;&lt;/span&gt;
&lt;a href="#%e7%b0%a1%e4%bb%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Logging Operator 是一套專為 Kubernetes 環境設計的日誌管理工具。它能夠自動部署與設定完整的日誌收集流程（logging pipeline），讓你不必手動處理繁瑣的日誌基礎設施配置。&lt;/p&gt;
&lt;h2&gt;運作流程&lt;span class="hx:absolute hx:-mt-20" id="運作流程"&gt;&lt;/span&gt;
&lt;a href="#%e9%81%8b%e4%bd%9c%e6%b5%81%e7%a8%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Logging Operator 的日誌處理分為三個階段：&lt;/p&gt;
&lt;h3&gt;1. 日誌收集（Log Collector）&lt;span class="hx:absolute hx:-mt-20" id="1-日誌收集log-collector"&gt;&lt;/span&gt;
&lt;a href="#1-%e6%97%a5%e8%aa%8c%e6%94%b6%e9%9b%86log-collector" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Operator 會在 Kubernetes 叢集中的&lt;strong&gt;每個節點&lt;/strong&gt;上部署一個 &lt;strong&gt;Fluent Bit DaemonSet&lt;/strong&gt;，負責從節點的檔案系統中收集 App Containers 和應用程式的日誌。&lt;/p&gt;
&lt;h3&gt;2. 中繼資料 enrichment（Metadata Enrichment）&lt;span class="hx:absolute hx:-mt-20" id="2-中繼資料-enrichmentmetadata-enrichment"&gt;&lt;/span&gt;
&lt;a href="#2-%e4%b8%ad%e7%b9%bc%e8%b3%87%e6%96%99-enrichmentmetadata-enrichment" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Fluent Bit 會查詢 &lt;strong&gt;Kubernetes API&lt;/strong&gt;，為日誌附加 Pod 的相關中繼資料（metadata），例如 Pod 名稱、namespace、標籤等。接著，將日誌連同這些中繼資料一併傳送給日誌轉發器（Log Forwarder）。&lt;/p&gt;
&lt;h3&gt;3. 日誌轉發（Log Forwarding）&lt;span class="hx:absolute hx:-mt-20" id="3-日誌轉發log-forwarding"&gt;&lt;/span&gt;
&lt;a href="#3-%e6%97%a5%e8%aa%8c%e8%bd%89%e7%99%bclog-forwarding" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;日誌轉發器負責&lt;strong&gt;接收、過濾與轉換&lt;/strong&gt;傳入的日誌，並將處理完的結果傳送到一個或多個目的地輸出（destination outputs）。&lt;/p&gt;
&lt;p&gt;目前支援的日誌轉發器有兩種：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;轉發器&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fluentd&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;廣泛使用的開源日誌轉發工具&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;syslog-ng&lt;/strong&gt;（透過 AxoSyslog 發行版）&lt;/td&gt;
&lt;td&gt;高效能的系統日誌處理引擎&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJDT5xH5Zg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;安全性&lt;span class="hx:absolute hx:-mt-20" id="安全性"&gt;&lt;/span&gt;
&lt;a href="#%e5%ae%89%e5%85%a8%e6%80%a7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;所有日誌的傳輸皆透過&lt;strong&gt;經過驗證（authenticated）且加密（encrypted）的通道&lt;/strong&gt;進行，確保資料在傳輸過程中的安全性。&lt;/p&gt;
&lt;h2&gt;核心優勢&lt;span class="hx:absolute hx:-mt-20" id="核心優勢"&gt;&lt;/span&gt;
&lt;a href="#%e6%a0%b8%e5%bf%83%e5%84%aa%e5%8b%a2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Logging Operator 最大的特色在於：你可以將日誌的行為描述直接定義在應用程式的 Helm Chart 中，Operator 會自動完成其餘的部署與配置工作。&lt;/p&gt;
&lt;p&gt;換句話說，&lt;strong&gt;日誌設定可以隨著應用程式一起版本控制與部署&lt;/strong&gt;，實現基礎設施即程式碼（Infrastructure as Code）的理念。&lt;/p&gt;
&lt;h2&gt;功能特色&lt;span class="hx:absolute hx:-mt-20" id="功能特色"&gt;&lt;/span&gt;
&lt;a href="#%e5%8a%9f%e8%83%bd%e7%89%b9%e8%89%b2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Logging Operator 提供以下核心功能：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Namespace 隔離&lt;/strong&gt;：日誌流（flow）與輸出（output）可以限定在特定的 namespace 中運作，實現多租戶隔離。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;原生 Kubernetes Label Selector&lt;/strong&gt;：直接使用 Kubernetes 原生的標籤選擇器來篩選要收集的日誌來源。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;安全通訊（TLS）&lt;/strong&gt;：所有日誌傳輸皆支援 TLS 加密，確保資料安全。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;設定檔驗證&lt;/strong&gt;：自動驗證設定是否正確，降低配置錯誤的風險。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;多重 Flow 支援&lt;/strong&gt;：同一份日誌可以經由多條 flow 進行不同的過濾與轉換處理。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;多重 Output 支援&lt;/strong&gt;：同一份日誌可以同時傳送到多個儲存目的地，例如 S3、GCS、Elasticsearch、Loki 等。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;多重 Logging 系統支援&lt;/strong&gt;：在同一個叢集中可以部署多套 Fluentd 與 Fluent Bit 實例，滿足不同的日誌需求。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;雙轉發器引擎&lt;/strong&gt;：同時支援 syslog-ng 與 Fluentd 作為核心日誌路由元件。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;架構概覽&lt;span class="hx:absolute hx:-mt-20" id="架構概覽"&gt;&lt;/span&gt;
&lt;a href="#%e6%9e%b6%e6%a7%8b%e6%a6%82%e8%a6%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Logging Operator 管理日誌基礎設施中的三個核心角色：&lt;strong&gt;日誌收集器（Log Collector）&lt;/strong&gt;、&lt;strong&gt;日誌轉發器（Log Forwarder）&lt;/strong&gt;，以及定義日誌該送往何處的&lt;strong&gt;路由規則&lt;/strong&gt;。&lt;/p&gt;
&lt;h3&gt;日誌收集器（Log Collector）&lt;span class="hx:absolute hx:-mt-20" id="日誌收集器log-collector"&gt;&lt;/span&gt;
&lt;a href="#%e6%97%a5%e8%aa%8c%e6%94%b6%e9%9b%86%e5%99%a8log-collector" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;部署在每個 Kubernetes 節點上的端點代理程式（endpoint agent）。&lt;/li&gt;
&lt;li&gt;負責收集該節點上所有 App Container 的日誌，並傳送給日誌轉發器。&lt;/li&gt;
&lt;li&gt;目前使用 &lt;strong&gt;Fluent Bit&lt;/strong&gt; 作為日誌收集器。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;日誌轉發器（Log Forwarder / Log Aggregator）&lt;span class="hx:absolute hx:-mt-20" id="日誌轉發器log-forwarder--log-aggregator"&gt;&lt;/span&gt;
&lt;a href="#%e6%97%a5%e8%aa%8c%e8%bd%89%e7%99%bc%e5%99%a8log-forwarder--log-aggregator" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;接收來自收集器的日誌後，進行&lt;strong&gt;過濾（filter）&lt;strong&gt;與&lt;/strong&gt;轉換（transform）&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;將處理後的日誌傳送到一個或多個目的地輸出。&lt;/li&gt;
&lt;li&gt;支援兩種轉發器引擎：&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;轉發器&lt;/th&gt;
&lt;th&gt;適用場景&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fluentd&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;生態系成熟、外掛豐富，適合大多數使用情境&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;syslog-ng&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;高效能、低資源消耗，適合需要進階日誌處理邏輯的場景&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;如何選擇適合的轉發器，可參考官方文件 &lt;a
href="https://kube-logging.dev/docs/configuration/fluentd-vs-syslog-ng/"target="_blank" rel="noopener"&gt;Which log forwarder to use&lt;/a&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;路由規則（Flow &amp;amp; Output）&lt;span class="hx:absolute hx:-mt-20" id="路由規則flow--output"&gt;&lt;/span&gt;
&lt;a href="#%e8%b7%af%e7%94%b1%e8%a6%8f%e5%89%87flow--output" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;你可以透過 &lt;strong&gt;Flow&lt;/strong&gt; 自訂資源來過濾、處理日誌訊息，並將它們路由到適當的 &lt;strong&gt;Output&lt;/strong&gt;（目的地），例如 Elasticsearch 或 Amazon S3。&lt;/p&gt;
&lt;p&gt;除了 namespace 層級的 flow 與 output，你也可以定義&lt;strong&gt;叢集層級&lt;/strong&gt;的 ClusterFlow 與 ClusterOutput，讓所有 namespace 的使用者都能引用同一組集中式輸出，但無法修改其設定。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意：&lt;/strong&gt; Flow 與 Output 資源是依據你選用的轉發器類型（Fluentd 或 syslog-ng）而不同的，兩者的 CRD 不能混用。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Custom Resource Definitions（CRD）一覽&lt;span class="hx:absolute hx:-mt-20" id="custom-resource-definitionscrd一覽"&gt;&lt;/span&gt;
&lt;a href="#custom-resource-definitionscrd%e4%b8%80%e8%a6%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;共用資源&lt;span class="hx:absolute hx:-mt-20" id="共用資源"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b1%e7%94%a8%e8%b3%87%e6%ba%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CRD&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;th&gt;作用範圍&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;logging&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義叢集的日誌基礎設施，包含日誌收集器與轉發器的設定。也可包含 Fluent Bit、Fluentd、syslog-ng 的配置。自 4.5 版起，這些元件也可作為獨立資源分開設定。&lt;/td&gt;
&lt;td&gt;叢集層級&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;Fluentd 專用 CRD&lt;span class="hx:absolute hx:-mt-20" id="fluentd-專用-crd"&gt;&lt;/span&gt;
&lt;a href="#fluentd-%e5%b0%88%e7%94%a8-crd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CRD&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;th&gt;作用範圍&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義 Fluentd 的日誌輸出目的地。&lt;/td&gt;
&lt;td&gt;Namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;flow&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義 Fluentd 的日誌路由規則，使用 filter 與 output 將選定的日誌導向指定目的地。&lt;/td&gt;
&lt;td&gt;Namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;clusteroutput&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義可供所有 flow 與 clusterflow 使用的 Fluentd 輸出。預設僅在 &lt;code&gt;controlNamespace&lt;/code&gt; 中生效，除非設定 &lt;code&gt;allowClusterResourcesFromAllNamespaces: true&lt;/code&gt;。&lt;/td&gt;
&lt;td&gt;叢集層級&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;clusterflow&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義可從所有 namespace 收集日誌的 Fluentd 路由規則。預設僅在 &lt;code&gt;controlNamespace&lt;/code&gt; 中生效，除非設定 &lt;code&gt;allowClusterResourcesFromAllNamespaces: true&lt;/code&gt;。&lt;/td&gt;
&lt;td&gt;叢集層級&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;syslog-ng 專用 CRD&lt;span class="hx:absolute hx:-mt-20" id="syslog-ng-專用-crd"&gt;&lt;/span&gt;
&lt;a href="#syslog-ng-%e5%b0%88%e7%94%a8-crd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CRD&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;th&gt;作用範圍&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SyslogNGOutput&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義 syslog-ng 的日誌輸出目的地。&lt;/td&gt;
&lt;td&gt;Namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SyslogNGFlow&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義 syslog-ng 的日誌路由規則，使用 filter 與 output 將選定的日誌導向指定目的地。&lt;/td&gt;
&lt;td&gt;Namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SyslogNGClusterOutput&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義可供所有 flow 與 clusterflow 使用的 syslog-ng 輸出。預設僅在 &lt;code&gt;controlNamespace&lt;/code&gt; 中生效，除非設定 &lt;code&gt;allowClusterResourcesFromAllNamespaces: true&lt;/code&gt;。&lt;/td&gt;
&lt;td&gt;叢集層級&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SyslogNGClusterFlow&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;定義可從所有 namespace 收集日誌的 syslog-ng 路由規則。預設僅在 &lt;code&gt;controlNamespace&lt;/code&gt; 中生效，除非設定 &lt;code&gt;allowClusterResourcesFromAllNamespaces: true&lt;/code&gt;。&lt;/td&gt;
&lt;td&gt;叢集層級&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Fluentd 與 syslog-ng 的 CRD 結構相似&lt;/strong&gt;，但各自針對自身引擎的特性進行了調整。選用哪一組 CRD 取決於你在 &lt;code&gt;logging&lt;/code&gt; 資源中選擇的轉發器類型。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h1&gt;Rancher Logging — 將 Pod Log 導入 OpenSearch 實作指南&lt;/h1&gt;&lt;h2&gt;環境概述&lt;span class="hx:absolute hx:-mt-20" id="環境概述"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e6%a6%82%e8%bf%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Rancher 的日誌管理由 Logging operator 提供支持。
以下實作將透過 Rancher logging，將指定 Kubernetes Pod 的 stdout log 經由 Fluentd 轉送至外部 OpenSearch。&lt;/p&gt;
&lt;h2&gt;環境準備&lt;span class="hx:absolute hx:-mt-20" id="環境準備"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; Rancher 安裝 DownStream RKE2 Cluster&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; DownStream RKE2 Cluster 已安裝 Rancher Logging&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 在 DownStream RKE2 Cluster 外部已安裝好 opensearch&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;步驟一：建立 Namespace&lt;span class="hx:absolute hx:-mt-20" id="步驟一建立-namespace"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%80%e5%bb%ba%e7%ab%8b-namespace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl create ns app&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;步驟二：部署測試用 Pod&lt;span class="hx:absolute hx:-mt-20" id="步驟二部署測試用-pod"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%8c%e9%83%a8%e7%bd%b2%e6%b8%ac%e8%a9%a6%e7%94%a8-pod" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;建立一個每秒輸出一行遞增計數 log 的 Pod，用以驗證 log pipeline 是否正常運作。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;apiVersion: v1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;kind: Pod
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: test-logging-pod
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; namespace: app
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; labels:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; logging-test: &amp;#34;true&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; automountServiceAccountToken: false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; securityContext:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; runAsNonRoot: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; runAsUser: 1000
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; runAsGroup: 1000
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; seccompProfile:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; type: RuntimeDefault
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; containers:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - name: sak
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; image: rancherlabs/swiss-army-knife:latest
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; command: [&amp;#34;/bin/sh&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; args:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - -c
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - |
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; i=0; while true; do echo &amp;#34;$(date) INFO $i&amp;#34;; i=$((i+1)); sleep 1; done
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; securityContext:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; allowPrivilegeEscalation: false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; readOnlyRootFilesystem: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; capabilities:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; drop:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - ALL
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 Pod 已正常啟動：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n app get pods -l logging-test&lt;span class="o"&gt;=&lt;/span&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
test-logging-pod 1/1 Running 0 5s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 log 輸出正常：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n app logs test-logging-pod&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出（每秒遞增一行）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Mon Mar 16 07:43:57 UTC 2026 INFO 0
Mon Mar 16 07:43:58 UTC 2026 INFO 1
Mon Mar 16 07:43:59 UTC 2026 INFO 2
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;步驟三：建立 OpenSearch 認證 Secret&lt;span class="hx:absolute hx:-mt-20" id="步驟三建立-opensearch-認證-secret"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%89%e5%bb%ba%e7%ab%8b-opensearch-%e8%aa%8d%e8%ad%89-secret" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;將 OpenSearch 的帳號密碼以 &lt;code&gt;kubernetes.io/basic-auth&lt;/code&gt; 類型的 Secret 儲存於叢集中，供後續 Output CR 引用。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;PW&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Test12345@&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl create secret generic opensearch-user-auth &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --namespace&lt;span class="o"&gt;=&lt;/span&gt;app &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --type&lt;span class="o"&gt;=&lt;/span&gt;kubernetes.io/basic-auth &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --from-literal&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;admin &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --from-literal&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$PW&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;步驟四：建立 Logging Output CR&lt;span class="hx:absolute hx:-mt-20" id="步驟四建立-logging-output-cr"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e5%9b%9b%e5%bb%ba%e7%ab%8b-logging-output-cr" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;定義 Fluentd 將 log 發送至 OpenSearch 的目標端點與 buffer 策略。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;apiVersion: logging.banzaicloud.io/v1beta1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;kind: Output
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: opensearch-admin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; namespace: app
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; opensearch:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; host: opensearch-node.kubeantony.com
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; port: 9200
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; scheme: https
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_verify: false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_version: TLSv1_2
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; suppress_type_name: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; user: admin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; password:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; valueFrom:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; secretKeyRef:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; key: password
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: opensearch-user-auth
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; buffer:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; flush_interval: 10s
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; flush_mode: interval
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; retry_type: exponential_backoff
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; retry_forever: true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; chunk_limit_size: 8MB
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; total_limit_size: 512MB
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Buffer 參數說明&lt;span class="hx:absolute hx:-mt-20" id="buffer-參數說明"&gt;&lt;/span&gt;
&lt;a href="#buffer-%e5%8f%83%e6%95%b8%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;參數&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;flush_mode&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;interval&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;以固定時間間隔觸發 flush，在即時性與效能間取得平衡&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;flush_interval&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10s&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;每 10 秒將累積的 log 批次送出&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;chunk_limit_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;8MB&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;單一 chunk 上限；達到後即使未到 flush 時間也會送出，防止記憶體暴漲&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;total_limit_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;512MB&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;所有 buffer 佔用的磁碟空間上限；超過後新 log 將依 &lt;code&gt;overflow_action&lt;/code&gt; 處理&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;retry_type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;exponential_backoff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;發送失敗時以指數退避策略重試（1s → 2s → 4s → &amp;hellip;），避免對 OpenSearch 造成衝擊&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;retry_forever&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;無限重試直到成功，確保 log 不遺失（代價是 buffer 可能在長時間故障時被填滿）&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;確認 Output 資源已建立（此時 &lt;code&gt;ACTIVE&lt;/code&gt; 為 &lt;code&gt;false&lt;/code&gt; 是正常的，表示尚未被任何 Flow 引用）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n app get outputs.logging.banzaicloud.io&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME ACTIVE PROBLEMS
opensearch-admin false&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;步驟五：建立 Logging Flow CR&lt;span class="hx:absolute hx:-mt-20" id="步驟五建立-logging-flow-cr"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%94%e5%bb%ba%e7%ab%8b-logging-flow-cr" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;建立 Flow 將帶有 &lt;code&gt;logging-test: &amp;quot;true&amp;quot;&lt;/code&gt; label 的 Pod log 路由至上一步定義的 Output。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat &lt;span class="s"&gt;&amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;apiVersion: logging.banzaicloud.io/v1beta1
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;kind: Flow
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;metadata:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; name: app-to-opensearch
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; namespace: app
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; match:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - select:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; labels:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; logging-test: &amp;#34;true&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; localOutputRefs:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; - opensearch-admin
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 Flow 已啟用：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl -n app get flows.logging.banzaicloud.io&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME ACTIVE PROBLEMS
app-to-opensearch true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;步驟六：於 OpenSearch 驗證 Log 寫入&lt;span class="hx:absolute hx:-mt-20" id="步驟六於-opensearch-驗證-log-寫入"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e5%85%ad%e6%96%bc-opensearch-%e9%a9%97%e8%ad%89-log-%e5%af%ab%e5%85%a5" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;確認索引已建立&lt;span class="hx:absolute hx:-mt-20" id="確認索引已建立"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d%e7%b4%a2%e5%bc%95%e5%b7%b2%e5%bb%ba%e7%ab%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;於 OpenSearch Dashboards 左上角選單進入 &lt;strong&gt;Index Management → Indexes&lt;/strong&gt;，搜尋 &lt;code&gt;fluentd&lt;/code&gt;，應可看到對應索引已自動建立。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkaAYuB9Wl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;查詢最新 Log&lt;span class="hx:absolute hx:-mt-20" id="查詢最新-log"&gt;&lt;/span&gt;
&lt;a href="#%e6%9f%a5%e8%a9%a2%e6%9c%80%e6%96%b0-log" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;於 &lt;strong&gt;Dev Tools&lt;/strong&gt; 執行以下查詢，取得最近 3 筆 log：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;GET&lt;/span&gt; &lt;span class="err"&gt;fluentd/_search&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;size&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;sort&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="nt"&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nt"&gt;&amp;#34;order&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;desc&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;}}],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;query&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;match_all&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;回傳結果中，每筆文件的 &lt;code&gt;_source&lt;/code&gt; 應包含 &lt;code&gt;message&lt;/code&gt;（原始 log 訊息）、&lt;code&gt;kubernetes&lt;/code&gt;（Pod metadata）、以及 &lt;code&gt;time&lt;/code&gt;（時間戳記）等欄位，代表 log pipeline 已完整串通。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ2kidrqZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;以下為其中一筆 log&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;took&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;timed_out&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_shards&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;total&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;successful&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;skipped&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;failed&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;hits&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;total&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;relation&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;gte&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;max_score&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;hits&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_index&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;fluentd&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;q0239pwBR50SWBx4toac&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_score&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_source&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;time&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2026-03-16T20:55:59.312256038+08:00&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;stream&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;stdout&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;logtag&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;F&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Mon Mar 16 12:55:59 UTC 2026 INFO 9961&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;pod_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;test-logging-pod&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;namespace_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;app&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;pod_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;50148584-185c-475c-b203-4120526c755d&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;labels&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;logging-test&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;annotations&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubectl.kubernetes.io/last-applied-configuration&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;apiVersion&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;v&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kind&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;Pod&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;metadata&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;annotations&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:{},&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;labels&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;logging-test&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;},&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;test-logging-pod&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;namespace&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;app&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;},&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;spec&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;automountServiceAccountToken&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:false,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;containers&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:[{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;args&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:[&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;-c&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;i=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="err"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt; &lt;span class="err"&gt;do&lt;/span&gt; &lt;span class="err"&gt;echo&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;$(date) INFO $i\&amp;#34;; i=$((i+1)); sleep 1; done\n&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;command&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/bin/sh&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;image&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;rancherlabs/swiss-army-knife:latest&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sak&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;securityContext&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;allowPrivilegeEscalation&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;capabilities&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;drop&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ALL&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]},&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;readOnlyRootFilesystem&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="err"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;securityContext&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;runAsGroup&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;runAsNonRoot&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;runAsUser&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;seccompProfile&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;type&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;RuntimeDefault&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}}}}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;host&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;rke&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="err"&gt;-w&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;container_name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;sak&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;docker_id&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;d&lt;/span&gt;&lt;span class="mi"&gt;820&lt;/span&gt;&lt;span class="err"&gt;db&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="err"&gt;b&lt;/span&gt;&lt;span class="mi"&gt;9416&lt;/span&gt;&lt;span class="err"&gt;cde&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="err"&gt;b&lt;/span&gt;&lt;span class="mi"&gt;968&lt;/span&gt;&lt;span class="err"&gt;f&lt;/span&gt;&lt;span class="mf"&gt;2e2&lt;/span&gt;&lt;span class="err"&gt;fa&lt;/span&gt;&lt;span class="mf"&gt;314e74&lt;/span&gt;&lt;span class="err"&gt;d&lt;/span&gt;&lt;span class="mi"&gt;656&lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="mi"&gt;064&lt;/span&gt;&lt;span class="err"&gt;def&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="err"&gt;ecc&lt;/span&gt;&lt;span class="mi"&gt;183&lt;/span&gt;&lt;span class="err"&gt;b&lt;/span&gt;&lt;span class="mi"&gt;7768&lt;/span&gt;&lt;span class="err"&gt;bef&lt;/span&gt;&lt;span class="mi"&gt;65102&lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;container_hash&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;docker.io/rancherlabs/swiss-army-knife@sha&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="err"&gt;af&lt;/span&gt;&lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="err"&gt;a&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="err"&gt;ace&lt;/span&gt;&lt;span class="mi"&gt;6269&lt;/span&gt;&lt;span class="err"&gt;adb&lt;/span&gt;&lt;span class="mf"&gt;9e494&lt;/span&gt;&lt;span class="err"&gt;b&lt;/span&gt;&lt;span class="mi"&gt;693644&lt;/span&gt;&lt;span class="err"&gt;bc&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="err"&gt;f&lt;/span&gt;&lt;span class="mi"&gt;897&lt;/span&gt;&lt;span class="err"&gt;ec&lt;/span&gt;&lt;span class="mi"&gt;872076&lt;/span&gt;&lt;span class="err"&gt;d&lt;/span&gt;&lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="err"&gt;f&lt;/span&gt;&lt;span class="mi"&gt;78&lt;/span&gt;&lt;span class="err"&gt;bc&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="err"&gt;ded&lt;/span&gt;&lt;span class="mi"&gt;69&lt;/span&gt;&lt;span class="err"&gt;f&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="err"&gt;ee&lt;/span&gt;&lt;span class="mi"&gt;222&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;container_image&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;docker.io/rancherlabs/swiss-army-knife&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="err"&gt;latest&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kubernetes_namespace&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;app&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;labels&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;field.cattle.io/projectId&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;p-pzhk&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kubernetes.io/metadata.name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;app&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;sort&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="mi"&gt;1773665759312&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;log 架構說明&lt;span class="hx:absolute hx:-mt-20" id="log-架構說明"&gt;&lt;/span&gt;
&lt;a href="#log-%e6%9e%b6%e6%a7%8b%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;以下逐層說明這個 OpenSearch 查詢回應的結構：&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hkh81FSqWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第一層：查詢執行資訊&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;took&lt;/code&gt; 表示 OpenSearch 花了 1000 毫秒完成這次查詢。&lt;code&gt;timed_out: false&lt;/code&gt; 代表查詢在設定的超時限制內完成。&lt;code&gt;_shards&lt;/code&gt; 記錄了參與查詢的分片狀態，這裡只有 1 個分片且執行成功、無失敗。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第二層：結果集合 &lt;code&gt;hits&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;hits.total.value&lt;/code&gt; 為 10000，搭配 &lt;code&gt;relation: &amp;quot;gte&amp;quot;&lt;/code&gt; 表示實際命中數量「大於或等於」10,000 筆，這是 OpenSearch 預設的計數上限（&lt;code&gt;track_total_hits&lt;/code&gt; 未啟用精確計數時的行為）。&lt;code&gt;max_score&lt;/code&gt; 為 &lt;code&gt;null&lt;/code&gt; 是因為查詢使用了 &lt;code&gt;sort&lt;/code&gt; 排序，此時相關性分數不會被計算。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第三層：單筆文件 &lt;code&gt;hits.hits[]&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;每筆文件包含 &lt;code&gt;_index&lt;/code&gt;（寫入的索引名稱，這裡是 &lt;code&gt;fluentd&lt;/code&gt;）、&lt;code&gt;_id&lt;/code&gt;（OpenSearch 自動產生的文件 ID）、以及 &lt;code&gt;sort&lt;/code&gt;（排序欄位的原始值，此處為 &lt;code&gt;time&lt;/code&gt; 的毫秒級 epoch）。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第四層：&lt;code&gt;_source&lt;/code&gt; — Fluentd 寫入的原始資料&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;這是最核心的部分，由 Fluentd 的 Kubernetes metadata filter 自動附加：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;time&lt;/code&gt;：log 產生的時間戳記（ISO 8601 格式，含時區）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;message&lt;/code&gt;：容器的原始 stdout 輸出內容&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stream&lt;/code&gt;：輸出流類型，&lt;code&gt;stdout&lt;/code&gt; 或 &lt;code&gt;stderr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;logtag&lt;/code&gt;：CRI log 的完整性標記，&lt;code&gt;F&lt;/code&gt; 代表完整行（Full），&lt;code&gt;P&lt;/code&gt; 代表部分行（Partial，尚有後續）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubernetes&lt;/code&gt;：Pod 層級的元資料，包含 pod 名稱、namespace、pod ID、labels、annotations、所在節點（host）、容器名稱與 image 資訊&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubernetes_namespace&lt;/code&gt;：Namespace 層級的元資料，包含名稱及其 labels（如 Rancher 的 projectId）&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h1&gt;Rancher Logging — 將 Pod Log 導入 OpenSearch 實作指南 2&lt;/h1&gt;&lt;h2&gt;環境概述&lt;span class="hx:absolute hx:-mt-20" id="環境概述-1"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e6%a6%82%e8%bf%b0-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;以下實作將透過 Rancher logging，將指定 Kubernetes namespace 底下所有 Pods 的 log 經由 Fluentd 轉送至外部 logstash 再轉送到 opensearch。&lt;/p&gt;
&lt;h2&gt;環境準備&lt;span class="hx:absolute hx:-mt-20" id="環境準備-1"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; Rancher 安裝 DownStream RKE2 Cluster&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; DownStream RKE2 Cluster 已安裝 Rancher Logging&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 在 DownStream RKE2 Cluster 外部已安裝好 logstash&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 在 DownStream RKE2 Cluster 外部已安裝好 opensearch&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;開始實作&lt;span class="hx:absolute hx:-mt-20" id="開始實作"&gt;&lt;/span&gt;
&lt;a href="#%e9%96%8b%e5%a7%8b%e5%af%a6%e4%bd%9c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# Secret: CA 憑證
kubectl -n kube-system create secret generic logstash-ca \
--from-file=ca.crt=/etc/logstash/certs/ca.crt
# Secret: basic auth 帳密
kubectl -n kube-system create secret generic logstash-auth \
--from-literal=username=logstash \
--from-literal=password=logstash
cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: logstash-http
namespace: kube-system
spec:
apiVersion: logging.banzaicloud.io/v1beta1
kind: Output
metadata:
name: logstash-http
namespace: kube-system
spec:
http:
endpoint: &amp;#34;https://logstash.kubeantony.com:8080&amp;#34;
content_type: &amp;#34;application/json&amp;#34;
json_array: true
auth:
username:
valueFrom:
secretKeyRef:
name: logstash-auth
key: username
password:
valueFrom:
secretKeyRef:
name: logstash-auth
key: password
tls_ca_cert_path:
mountFrom:
secretKeyRef:
name: logstash-ca
key: ca.crt
buffer:
type: file
flush_interval: 5s
flush_mode: interval
timekey: 1m
timekey_wait: 10s
total_limit_size: 1GB
EOF
cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
apiVersion: logging.banzaicloud.io/v1beta1
kind: Flow
metadata:
name: kube-logs
namespace: kube-system
spec:
match:
- select: {}
localOutputRefs:
- logstash-http
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;確認索引已建立&lt;span class="hx:absolute hx:-mt-20" id="確認索引已建立-1"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d%e7%b4%a2%e5%bc%95%e5%b7%b2%e5%bb%ba%e7%ab%8b-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;於 OpenSearch Dashboards 左上角選單進入 &lt;strong&gt;Index Management → Indexes&lt;/strong&gt;，搜尋 &lt;code&gt;fluentd&lt;/code&gt;，應可看到對應索引已自動建立。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkyUJyeiWl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;查詢最新 Log&lt;span class="hx:absolute hx:-mt-20" id="查詢最新-log-1"&gt;&lt;/span&gt;
&lt;a href="#%e6%9f%a5%e8%a9%a2%e6%9c%80%e6%96%b0-log-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;於 &lt;strong&gt;Dev Tools&lt;/strong&gt; 執行以下查詢，對日誌索引執行無條件檢索，並依時間戳（@timestamp）降序排列以提取最新的一筆數據紀錄：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;GET&lt;/span&gt; &lt;span class="err"&gt;opensearch-logstash-docker&lt;/span&gt;&lt;span class="mf"&gt;-2026.03&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="err"&gt;/_search&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;size&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;query&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;match_all&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;sort&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;@timestamp&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;desc&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;回傳結果中，每筆文件的 &lt;code&gt;_source&lt;/code&gt; 應包含 &lt;code&gt;message&lt;/code&gt;（原始 log 訊息）、&lt;code&gt;kubernetes&lt;/code&gt;（Pod metadata）、以及 &lt;code&gt;time&lt;/code&gt;（時間戳記）等欄位，代表 log pipeline 已完整串通。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkrR-1eiZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;以下為其中一筆 log&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;took&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;563&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;timed_out&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_shards&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;total&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;successful&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;skipped&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;failed&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;hits&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;total&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;relation&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;gte&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;max_score&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;hits&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_index&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;opensearch-logstash-docker-2026.03.24&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ielEH50BXMB4tDz9Y0CX&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_score&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;_source&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;logtag&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;F&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;W0324 09:54:23.735867 1 logging.go:55] [core] [Channel #4240 SubChannel #4241]grpc: addrConn.createTransport failed to connect to {Addr: \&amp;#34;127.0.0.1:2379\&amp;#34;, ServerName: \&amp;#34;127.0.0.1:2379\&amp;#34;, BalancerAttributes: {\&amp;#34;&amp;lt;%!p(pickfirstleaf.managedByPickfirstKeyType={})&amp;gt;\&amp;#34;: \&amp;#34;&amp;lt;%!p(bool=true)&amp;gt;\&amp;#34; }}. Err: connection error: desc = \&amp;#34;transport: Error while dialing: dial tcp 127.0.0.1:2379: operation was canceled\&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;url&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;domain&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;logstash.kubeantony.com&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;path&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;port&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;container_hash&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;registry.rancher.com/rancher/hardened-kubernetes@sha256:4fab2ebc142aa1bb04a9641daebd6197404040806758cb3f3e78a6acfde47853&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;annotations&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.mirror&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;88a0909b75e7783678932b6535c63316&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.hash&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;88a0909b75e7783678932b6535c63316&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.source&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;file&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.seen&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2026-03-04T13:33:01.249775809+08:00&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;pod_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;kube-apiserver-rke2-c2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;container_image&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;registry.rancher.com/rancher/hardened-kubernetes:v1.34.4-rke2r1-build20260210&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;labels&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;tier&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;control-plane&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;component&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;kube-apiserver&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;host&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;rke2-c2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;container_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;kube-apiserver&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;pod_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;80dc734a-bbbc-48bc-a95f-ba88100ec24b&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;docker_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;61c3121ba35fa4fa01f25037d1f27181d0b455cb350d196de37b55f13edb2444&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;namespace_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;kube-system&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;@timestamp&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2026-03-24T09:54:28.785431836Z&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;user_agent&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;original&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Ruby&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;http&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;version&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;HTTP/1.1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;request&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;body&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;bytes&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;1448&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;mime_type&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;application/json&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;method&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;POST&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;event&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;original&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;[{&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;time&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="mi"&gt;2026-03-24&lt;/span&gt;&lt;span class="err"&gt;T&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;23.73604561&lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;stream&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;stderr&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;logtag&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;F&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;message&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;:&amp;#34;&lt;/span&gt;&lt;span class="err"&gt;W&lt;/span&gt;&lt;span class="mi"&gt;0324&lt;/span&gt; &lt;span class="mi"&gt;09&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;23.735867&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="err"&gt;logging.go&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="err"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;core&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;Channel&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="mi"&gt;4240&lt;/span&gt; &lt;span class="err"&gt;SubChannel&lt;/span&gt; &lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="mi"&gt;4241&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;grpc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="err"&gt;addrConn.createTransport&lt;/span&gt; &lt;span class="err"&gt;failed&lt;/span&gt; &lt;span class="err"&gt;to&lt;/span&gt; &lt;span class="err"&gt;connect&lt;/span&gt; &lt;span class="err"&gt;to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;Addr:&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;127.0.0.1:2379\&amp;#34;, ServerName: \&amp;#34;127.0.0.1:2379\&amp;#34;, BalancerAttributes: {\&amp;#34;&amp;lt;%!p(pickfirstleaf.managedByPickfirstKeyType={})&amp;gt;\&amp;#34;: \&amp;#34;&amp;lt;%!p(bool=true)&amp;gt;\&amp;#34; }}. Err: connection error: desc = \&amp;#34;transport: Error while dialing: dial tcp 127.0.0.1:2379: operation was canceled\&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;pod_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-apiserver-rke2-c2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;namespace_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-system&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;pod_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;80dc734a-bbbc-48bc-a95f-ba88100ec24b&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;labels&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;component&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-apiserver&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;tier&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;control-plane&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;annotations&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.hash&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;88a0909b75e7783678932b6535c63316&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.mirror&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;88a0909b75e7783678932b6535c63316&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.seen&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;2026-03-04T13:33:01.249775809+08:00&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes.io/config.source&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;file&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;host&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;rke2-c2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;container_name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-apiserver&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;docker_id&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;61c3121ba35fa4fa01f25037d1f27181d0b455cb350d196de37b55f13edb2444&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;container_hash&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;registry.rancher.com/rancher/hardened-kubernetes@sha256:4fab2ebc142aa1bb04a9641daebd6197404040806758cb3f3e78a6acfde47853&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;container_image&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;registry.rancher.com/rancher/hardened-kubernetes:v1.34.4-rke2r1-build20260210&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes_namespace&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-system&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;labels&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;field.cattle.io/projectId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;p-xnskv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;&amp;#34;kubernetes.io/metadata.name&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kube-system&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;}}}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="err"&gt;]&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;stream&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;stderr&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;time&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="mi"&gt;2026-03-24&lt;/span&gt;&lt;span class="err"&gt;T&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mf"&gt;23.73604561&lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;08&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;@version&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;host&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;ip&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="err"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;11.156&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kubernetes_namespace&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kube-system&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;labels&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;field.cattle.io/projectId&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;p-xnskv&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kubernetes.io/metadata.name&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;: &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;kube-system&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; &amp;#34;&lt;/span&gt;&lt;span class="err"&gt;sort&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="mi"&gt;1774346068785&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="err"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;沒問題！我將根據您提供的架構，結合這份日誌的實際內容進行邏輯拆解與解釋。這份日誌記錄了 &lt;strong&gt;2026-03-24&lt;/strong&gt; 某個 Kubernetes 核心組件發生連線異常的瞬間。&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Log 架構邏輯說明&lt;span class="hx:absolute hx:-mt-20" id="log-架構邏輯說明"&gt;&lt;/span&gt;
&lt;a href="#log-%e6%9e%b6%e6%a7%8b%e9%82%8f%e8%bc%af%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;以下逐層說明這個 OpenSearch 查詢回應的結構：&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第一層：查詢執行資訊 (Query Execution Info)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;took&lt;/code&gt;&lt;/strong&gt;: 表示 OpenSearch 花了 &lt;strong&gt;563 毫秒&lt;/strong&gt; 完成這次查詢。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;timed_out: false&lt;/code&gt;&lt;/strong&gt;: 代表查詢在設定的超時限制內順利完成。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;_shards&lt;/code&gt;&lt;/strong&gt;: 記錄了參與查詢的分片狀態，這裡只有 &lt;strong&gt;1 個分片&lt;/strong&gt; 且執行成功、無失敗，顯示索引結構較為簡單或資料量尚在單一分片承載範圍內。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;第二層：結果集合 &lt;code&gt;hits&lt;/code&gt; (Result Metadata)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;hits.total.value&lt;/code&gt;: 10000&lt;/strong&gt; 搭配 &lt;strong&gt;&lt;code&gt;relation: &amp;quot;gte&amp;quot;&lt;/code&gt;&lt;/strong&gt;:
表示實際命中數量「大於或等於」10,000 筆。這是 OpenSearch 為了查詢效能所做的預設優化（未開啟 &lt;code&gt;track_total_hits&lt;/code&gt;），告訴運維人員：符合條件的日誌非常多，這只是冰山一角。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_score&lt;/code&gt;: null&lt;/strong&gt;:
因為我們在命令中使用了 &lt;code&gt;sort&lt;/code&gt;（依照時間排序），OpenSearch 會跳過相關性分數（Relevance Score）的計算，這在日誌分析中是標準做法。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;第三層：單筆文件 &lt;code&gt;hits.hits[]&lt;/code&gt; (Document Identity)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;_index&lt;/code&gt;&lt;/strong&gt;: 寫入的索引名稱為 &lt;code&gt;opensearch-logstash-docker-2026.03.24&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;_id&lt;/code&gt;&lt;/strong&gt;: 該筆日誌的唯一標記符 &lt;code&gt;ielEH50BXMB4tDz9Y0CX&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;sort&lt;/code&gt;&lt;/strong&gt;: 排序欄位的原始值 &lt;code&gt;1774346068785&lt;/code&gt;（這是一個毫秒級的 Epoch 時間戳記，對應到 &lt;code&gt;@timestamp&lt;/code&gt;）。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;第四層：&lt;code&gt;_source&lt;/code&gt; — 採集器寫入的原始資料 (Enriched Data)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;這是運維診斷的核心，由日誌採集器（如 Logstash/Fluentd）自動附加的元資料：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;時間戳記與時區邏輯&lt;/strong&gt;：
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;message&lt;/code&gt; 內&lt;/strong&gt;: &lt;code&gt;09:54:23&lt;/code&gt;（容器原始輸出的 UTC 時間）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;time&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;17:54:23...+08:00&lt;/code&gt;（採集器轉換後的&lt;strong&gt;本地時間&lt;/strong&gt;，兩者相差 8 小時）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;@timestamp&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;09:54:28Z&lt;/code&gt;（OpenSearch 儲存用的標準 UTC 格式，比 log 產出晚 5 秒，代表處理延遲）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;message&lt;/code&gt;&lt;/strong&gt;: 核心錯誤內容，顯示 &lt;code&gt;kube-apiserver&lt;/code&gt; 無法連線至本地的 &lt;code&gt;etcd&lt;/code&gt; (127.0.0.1:2379)。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;stream&lt;/code&gt;: stderr&lt;/strong&gt;: 標記這是一條錯誤流日誌，並非正常的標準輸出。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;logtag&lt;/code&gt;: F&lt;/strong&gt;: 代表這是一行完整的（Full）Log，沒有因為長度限制而被截斷。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;kubernetes&lt;/code&gt; (Pod 元資料)&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;定位&lt;/strong&gt;：發生在命名空間 &lt;code&gt;kube-system&lt;/code&gt; 中的 Pod &lt;code&gt;kube-apiserver-rke2-c2&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;環境&lt;/strong&gt;：運行於節點 &lt;code&gt;rke2-c2&lt;/code&gt;，映像檔版本為 &lt;code&gt;v1.34.4&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;身份識別&lt;/strong&gt;：包含 &lt;code&gt;pod_id&lt;/code&gt; 與 &lt;code&gt;docker_id&lt;/code&gt;，方便進一步去主機端（Node）下 &lt;code&gt;docker/crictl inspect&lt;/code&gt; 指令查核。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;kubernetes_namespace&lt;/code&gt;&lt;/strong&gt;: 顯示該 Namespace 屬於 Rancher 專案 &lt;code&gt;p-xnskv&lt;/code&gt;，這有助於在多租戶環境下快速判斷受影響的專案範圍。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Quick Start OpenSearch</title><link>https://blog.kubeantony.com/archive/data-platform/quick-start-opensearch/</link><pubDate>Tue, 24 Mar 2026 06:43:24 +0800</pubDate><guid>https://blog.kubeantony.com/archive/data-platform/quick-start-opensearch/</guid><description>
&lt;h2&gt;環境準備&lt;span class="hx:absolute hx:-mt-20" id="環境準備"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;os: Ubuntu 24.04.4 LTS&lt;/li&gt;
&lt;li&gt;podman version: 4.9.3&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;OpenSearch&lt;span class="hx:absolute hx:-mt-20" id="opensearch"&gt;&lt;/span&gt;
&lt;a href="#opensearch" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 podman volume&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman volume create opensearch-data&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a Docker network&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman network create log-system&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 OpenSearch，並掛載 volume&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d \
-p 9200:9200 \
-p 9600:9600 \
--name opensearch \
--net log-system \
-e &amp;#34;discovery.type=single-node&amp;#34; \
-e &amp;#39;OPENSEARCH_INITIAL_ADMIN_PASSWORD=&amp;lt;password&amp;gt;&amp;#39; \
-v opensearch-data:/usr/share/opensearch/data \
docker.io/opensearchproject/opensearch:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;password 要自己定義，必須使用至少 8 個字元，包含至少一個大寫字母、一個小寫字母、一個數字，以及一個特殊字元。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;OpenSearch dashboard&lt;span class="hx:absolute hx:-mt-20" id="opensearch-dashboard"&gt;&lt;/span&gt;
&lt;a href="#opensearch-dashboard" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯 OpenSearch Dashboards 設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir ~/opensearch; nano opensearch_dashboards.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;opensearch.hosts&lt;/code&gt; 的值要根據環境做設定，並在環境的 DNS Server 新增一筆 A Record&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;server.name: opensearch_dashboards
server.host: &amp;#34;0.0.0.0&amp;#34;
server.customResponseHeaders: { &amp;#34;Access-Control-Allow-Credentials&amp;#34;: &amp;#34;true&amp;#34; }
server.ssl.enabled: false
opensearch.hosts: [&amp;#34;https://opensearch-node.kubeantony.com:9200&amp;#34;]
opensearch.ssl.verificationMode: none
opensearch.username: kibanaserver
opensearch.password: kibanaserver
opensearch.requestHeadersWhitelist: [&amp;#34;securitytenant&amp;#34;,&amp;#34;Authorization&amp;#34;]
opensearch_security.multitenancy.enabled: true
opensearch_security.multitenancy.tenants.preferred: [&amp;#34;Private&amp;#34;, &amp;#34;Global&amp;#34;]
opensearch_security.readonly_mode.roles: [&amp;#34;kibana_read_only&amp;#34;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 OpenSearch Dashboards&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d --name osd \
--network host \
-v ./opensearch_dashboards.yml:/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml \
docker.io/opensearchproject/opensearch-dashboards:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;連線至 Web 管理網站&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;http://&amp;lt;opensearch.hosts&amp;gt;:5601/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Sy6JBmrqZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;With Logstash&lt;span class="hx:absolute hx:-mt-20" id="with-logstash"&gt;&lt;/span&gt;
&lt;a href="#with-logstash" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman volume create logstash-data&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ~/logstash/pipeline
cat &amp;gt; ~/logstash/pipeline/logstash.conf &amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
input {
http {
host =&amp;gt; &amp;#34;0.0.0.0&amp;#34;
port =&amp;gt; 8080
}
}
filter {
}
output {
opensearch {
hosts =&amp;gt; [&amp;#34;https://opensearch-node.kubeantony.com:9200&amp;#34;]
index =&amp;gt; &amp;#34;opensearch-logstash-docker-%{&amp;#43;YYYY.MM.dd}&amp;#34;
user =&amp;gt; &amp;#34;admin&amp;#34;
password =&amp;gt; &amp;#34;!QAZ2wsx@WSX!!&amp;#34;
ssl =&amp;gt; false
ssl_certificate_verification =&amp;gt; false
}
}
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d -it --name logstash \
--net log-system \
-v logstash-data:/usr/share/logstash/data \
-p 8080:8080 \
-v ~/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:Z \
docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin:8.9.0 \&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec -it logstash /usr/share/logstash/bin/logstash-plugin update logstash-output-opensearch
sudo podman restart logstash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -XPOST http://logstash.kubeantony.com:8080 \
-H &amp;#34;Content-Type: application/json&amp;#34; \
-d &amp;#39;{&amp;#34;message&amp;#34;: &amp;#34;test from outside&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h1&gt;Logstash Podman Quadlet 部署指南（Rootful / Podman 4.9.3）&lt;/h1&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;操作方式&lt;/strong&gt;：以一般使用者登入，必要時透過 &lt;code&gt;sudo&lt;/code&gt; 提權。
Quadlet 檔案放在 &lt;code&gt;/etc/containers/systemd/&lt;/code&gt;，容器以 rootful 模式執行。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;版本限制&lt;/strong&gt;：Podman 4.9.3 不支援 &lt;code&gt;.build&lt;/code&gt; Quadlet（需 5.2.0+），
因此自訂映像需先手動 build，再由 &lt;code&gt;.container&lt;/code&gt; 直接引用。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;前置準備：安裝 podlet&lt;span class="hx:absolute hx:-mt-20" id="前置準備安裝-podlet"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e6%ba%96%e5%82%99%e5%ae%89%e8%a3%9d-podlet" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -fsSL https://raw.githubusercontent.com/braveantony/bash-script/refs/heads/main/install-podlet.sh &lt;span class="p"&gt;|&lt;/span&gt; sudo bash&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;1. 建立目錄結構&lt;span class="hx:absolute hx:-mt-20" id="1-建立目錄結構"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%bb%ba%e7%ab%8b%e7%9b%ae%e9%8c%84%e7%b5%90%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /opt/logstash/build
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/logstash/pipeline
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/logstash/certs
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/containers/systemd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;2. 建立 Containerfile（自訂映像，含更新 plugin）&lt;span class="hx:absolute hx:-mt-20" id="2-建立-containerfile自訂映像含更新-plugin"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%bb%ba%e7%ab%8b-containerfile%e8%87%aa%e8%a8%82%e6%98%a0%e5%83%8f%e5%90%ab%e6%9b%b4%e6%96%b0-plugin" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /opt/logstash/build/Containerfile &amp;gt; /dev/null &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;FROM docker.io/opensearchproject/logstash-oss-with-opensearch-output-plugin:8.9.0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;RUN /usr/share/logstash/bin/logstash-plugin update logstash-output-opensearch
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;3. 手動 Build 自訂映像&lt;span class="hx:absolute hx:-mt-20" id="3-手動-build-自訂映像"&gt;&lt;/span&gt;
&lt;a href="#3-%e6%89%8b%e5%8b%95-build-%e8%87%aa%e8%a8%82%e6%98%a0%e5%83%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;由於 Podman 4.9.3 不支援 &lt;code&gt;.build&lt;/code&gt; Quadlet，需先手動 build 映像：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman build -t localhost/logstash-custom:latest &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -f /opt/logstash/build/Containerfile&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：此步驟需要網路連線，且首次 build 會花一些時間下載基底映像和更新 plugin。
後續如需更新 plugin，重新執行此 build 指令即可。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;4. 產生 SSL 憑證&lt;span class="hx:absolute hx:-mt-20" id="4-產生-ssl-憑證"&gt;&lt;/span&gt;
&lt;a href="#4-%e7%94%a2%e7%94%9f-ssl-%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;使用 &lt;a
href="https://github.com/braveantony/mkcert"target="_blank" rel="noopener"&gt;mkcert&lt;/a&gt; 產出自簽憑證，再將 key 轉為 PKCS8 格式並以固定檔名放入 &lt;code&gt;/etc/logstash/certs/&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 產出憑證（依照 mkcert 的使用方式，請先編輯 config 中的 DOMAIN_NAME）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/braveantony/mkcert.git
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nano ./mkcert/config
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./mkcert/certctl
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定你的 domain name（與 mkcert config 中一致）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;your-domain.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/mkcert
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 將 key 轉為 PKCS8 格式&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl pkcs8 -in &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.key&amp;#34;&lt;/span&gt; -topk8 -nocrypt -out &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/server.key&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 複製憑證到固定路徑（使用固定檔名）&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.crt&amp;#34;&lt;/span&gt; /etc/logstash/certs/server.crt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/server.key&amp;#34;&lt;/span&gt; /etc/logstash/certs/server.key
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo cp &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/ca.crt&amp;#34;&lt;/span&gt; /etc/logstash/certs/ca.crt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 設定權限&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;0600&lt;/span&gt; /etc/logstash/certs/server.key
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;0644&lt;/span&gt; /etc/logstash/certs/server.crt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;0644&lt;/span&gt; /etc/logstash/certs/ca.crt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chown -R root:root /etc/logstash/certs/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;5. 建立 Pipeline 設定檔&lt;span class="hx:absolute hx:-mt-20" id="5-建立-pipeline-設定檔"&gt;&lt;/span&gt;
&lt;a href="#5-%e5%bb%ba%e7%ab%8b-pipeline-%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;HTTP input 啟用 HTTPS + basic auth，OpenSearch output 透過環境變數帶入：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /etc/logstash/pipeline/logstash.conf &amp;gt; /dev/null &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;input {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; http {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; host =&amp;gt; &amp;#34;0.0.0.0&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; port =&amp;gt; 8080
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; user =&amp;gt; &amp;#34;${HTTP_AUTH_USER}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; password =&amp;gt; &amp;#34;${HTTP_AUTH_PASSWORD}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl =&amp;gt; true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_certificate =&amp;gt; &amp;#34;/etc/logstash/certs/server.crt&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_key =&amp;gt; &amp;#34;/etc/logstash/certs/server.key&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;filter {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;output {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; opensearch {
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; hosts =&amp;gt; [&amp;#34;${OPENSEARCH_HOSTS}&amp;#34;]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; index =&amp;gt; &amp;#34;${OPENSEARCH_INDEX}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; user =&amp;gt; &amp;#34;admin&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; password =&amp;gt; &amp;#34;${OPENSEARCH_PASSWORD}&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl =&amp;gt; false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; ssl_certificate_verification =&amp;gt; false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;6. 建立環境變數檔&lt;span class="hx:absolute hx:-mt-20" id="6-建立環境變數檔"&gt;&lt;/span&gt;
&lt;a href="#6-%e5%bb%ba%e7%ab%8b%e7%92%b0%e5%a2%83%e8%ae%8a%e6%95%b8%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;將所有敏感資訊和可變設定集中管理：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo tee /etc/logstash/logstash.env &amp;gt; /dev/null &lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# HTTP input basic auth
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;HTTP_AUTH_USER=logstash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;HTTP_AUTH_PASSWORD=logstash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;# OpenSearch output
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;OPENSEARCH_HOSTS=https://opensearch-node.kubeantony.com:9200
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;OPENSEARCH_INDEX=opensearch-logstash-docker-%{+YYYY.MM.dd}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;OPENSEARCH_PASSWORD=!QAZ2wsx@WSX!!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;0600&lt;/span&gt; /etc/logstash/logstash.env
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chown root:root /etc/logstash/logstash.env&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;請務必修改上方的預設值&lt;/strong&gt;，尤其是 &lt;code&gt;HTTP_AUTH_USER&lt;/code&gt;、&lt;code&gt;HTTP_AUTH_PASSWORD&lt;/code&gt; 和 &lt;code&gt;OPENSEARCH_PASSWORD&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;7. 使用 podlet 產生 Quadlet 檔案（Rootful）&lt;span class="hx:absolute hx:-mt-20" id="7-使用-podlet-產生-quadlet-檔案rootful"&gt;&lt;/span&gt;
&lt;a href="#7-%e4%bd%bf%e7%94%a8-podlet-%e7%94%a2%e7%94%9f-quadlet-%e6%aa%94%e6%a1%88rootful" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;7-1. 產生 logstash-data.volume&lt;span class="hx:absolute hx:-mt-20" id="7-1-產生-logstash-datavolume"&gt;&lt;/span&gt;
&lt;a href="#7-1-%e7%94%a2%e7%94%9f-logstash-datavolume" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podlet --file /etc/containers/systemd/ --install &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; podman volume create logstash-data&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修正 &lt;code&gt;WantedBy&lt;/code&gt; 為 rootful 慣例：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sed -i &lt;span class="s1"&gt;&amp;#39;s/WantedBy=default.target/WantedBy=multi-user.target/&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /etc/containers/systemd/logstash-data.volume&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7-2. 產生 log-system.network&lt;span class="hx:absolute hx:-mt-20" id="7-2-產生-log-systemnetwork"&gt;&lt;/span&gt;
&lt;a href="#7-2-%e7%94%a2%e7%94%9f-log-systemnetwork" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podlet --file /etc/containers/systemd/ --install &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; podman network create log-system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修正 &lt;code&gt;WantedBy&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sed -i &lt;span class="s1"&gt;&amp;#39;s/WantedBy=default.target/WantedBy=multi-user.target/&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /etc/containers/systemd/log-system.network&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7-3. 產生 logstash.container&lt;span class="hx:absolute hx:-mt-20" id="7-3-產生-logstashcontainer"&gt;&lt;/span&gt;
&lt;a href="#7-3-%e7%94%a2%e7%94%9f-logstashcontainer" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podlet --file /etc/containers/systemd/ --name logstash --install &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --description &lt;span class="s2"&gt;&amp;#34;Logstash with OpenSearch Output Plugin&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; podman run -d --name logstash &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --net log-system.network &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v logstash-data.volume:/usr/share/logstash/data &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /etc/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:Z &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -v /etc/logstash/certs:/etc/logstash/certs:Z,ro &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -p 8080:8080 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; localhost/logstash-custom:latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7-4. 手動補上 EnvironmentFile 和 Service 設定，並修正 WantedBy&lt;span class="hx:absolute hx:-mt-20" id="7-4-手動補上-environmentfile-和-service-設定並修正-wantedby"&gt;&lt;/span&gt;
&lt;a href="#7-4-%e6%89%8b%e5%8b%95%e8%a3%9c%e4%b8%8a-environmentfile-%e5%92%8c-service-%e8%a8%ad%e5%ae%9a%e4%b8%a6%e4%bf%ae%e6%ad%a3-wantedby" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;podlet 產生的檔案沒有 &lt;code&gt;[Service]&lt;/code&gt; 區段，需在 &lt;code&gt;[Install]&lt;/code&gt; 之前插入：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 在 [Install] 前插入 EnvironmentFile 和 [Service] 區段&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sed -i &lt;span class="s1"&gt;&amp;#39;/^\[Install\]/i EnvironmentFile=/etc/logstash/logstash.env\n\n[Service]\nRestart=always\nTimeoutStartSec=120\n&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /etc/containers/systemd/logstash.container
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 修正 WantedBy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo sed -i &lt;span class="s1"&gt;&amp;#39;s/WantedBy=default.target/WantedBy=multi-user.target/&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; /etc/containers/systemd/logstash.container&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;7-5. 驗證最終檔案內容&lt;span class="hx:absolute hx:-mt-20" id="7-5-驗證最終檔案內容"&gt;&lt;/span&gt;
&lt;a href="#7-5-%e9%a9%97%e8%ad%89%e6%9c%80%e7%b5%82%e6%aa%94%e6%a1%88%e5%85%a7%e5%ae%b9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;執行 &lt;code&gt;sudo cat /etc/containers/systemd/logstash.container&lt;/code&gt;，確認內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-ini" data-lang="ini"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Logstash with OpenSearch Output Plugin&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;[Container]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;ContainerName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;logstash&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;localhost/logstash-custom:latest&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Network&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;log-system.network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;PublishPort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;8080:8080&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Volume&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;logstash-data.volume:/usr/share/logstash/data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Volume&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/etc/logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:Z&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Volume&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/etc/logstash/certs:/etc/logstash/certs:Z,ro&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;EnvironmentFile&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/etc/logstash/logstash.env&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;always&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;TimeoutStartSec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;120&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果 &lt;code&gt;sed&lt;/code&gt; 結果不如預期，可直接用 &lt;code&gt;sudo vi /etc/containers/systemd/logstash.container&lt;/code&gt; 手動編輯。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;8. 使用 Quadlet dry-run 驗證&lt;span class="hx:absolute hx:-mt-20" id="8-使用-quadlet-dry-run-驗證"&gt;&lt;/span&gt;
&lt;a href="#8-%e4%bd%bf%e7%94%a8-quadlet-dry-run-%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認輸出無錯誤後再繼續。&lt;/p&gt;
&lt;h2&gt;9. 重新載入 systemd 並啟動&lt;span class="hx:absolute hx:-mt-20" id="9-重新載入-systemd-並啟動"&gt;&lt;/span&gt;
&lt;a href="#9-%e9%87%8d%e6%96%b0%e8%bc%89%e5%85%a5-systemd-%e4%b8%a6%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl start logstash.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;10. 確認狀態&lt;span class="hx:absolute hx:-mt-20" id="10-確認狀態"&gt;&lt;/span&gt;
&lt;a href="#10-%e7%a2%ba%e8%aa%8d%e7%8b%80%e6%85%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl status logstash.service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman logs logstash&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;11. 測試 HTTPS + Basic Auth&lt;span class="hx:absolute hx:-mt-20" id="11-測試-https--basic-auth"&gt;&lt;/span&gt;
&lt;a href="#11-%e6%b8%ac%e8%a9%a6-https--basic-auth" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;帶認證 + 信任自簽 CA（應回傳 &lt;code&gt;ok&lt;/code&gt;）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Example: DOMAIN_NAME=&amp;#34;logstash.kubeantony.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;your-domain.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl --cacert /etc/logstash/certs/ca.crt &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -u logstash:logstash &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -X POST https://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:8080 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -H &lt;span class="s2"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;message&amp;#34;: &amp;#34;test with https&amp;#34;}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;或跳過憑證驗證（測試用）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -k -u logstash:logstash &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -X POST https://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:8080 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -H &lt;span class="s2"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;message&amp;#34;: &amp;#34;test with https&amp;#34;}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;不帶認證應回傳 &lt;code&gt;401&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -k -s -o /dev/null -w &lt;span class="s2"&gt;&amp;#34;%{http_code}&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -X POST https://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:8080 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -H &lt;span class="s2"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;message&amp;#34;: &amp;#34;should fail&amp;#34;}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;用 HTTP（非 HTTPS）應連線失敗：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -s -o /dev/null -w &lt;span class="s2"&gt;&amp;#34;%{http_code}&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -X POST http://&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;DOMAIN_NAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;:8080 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -H &lt;span class="s2"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;{&amp;#34;message&amp;#34;: &amp;#34;should fail&amp;#34;}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;應該會得到 &lt;code&gt;000&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;路徑總覽&lt;span class="hx:absolute hx:-mt-20" id="路徑總覽"&gt;&lt;/span&gt;
&lt;a href="#%e8%b7%af%e5%be%91%e7%b8%bd%e8%a6%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;檔案&lt;/th&gt;
&lt;th&gt;路徑&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Containerfile&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/opt/logstash/build/Containerfile&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;自訂映像 build 檔&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logstash.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/logstash/pipeline/logstash.conf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pipeline 設定檔&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logstash.env&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/logstash/logstash.env&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;環境變數檔（權限 0600）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;server.crt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/logstash/certs/server.crt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SSL 憑證&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;server.key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/logstash/certs/server.key&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;SSL 私鑰（PKCS8，權限 0600）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ca.crt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/logstash/certs/ca.crt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CA 憑證（供客戶端驗證）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logstash-data.volume&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/containers/systemd/logstash-data.volume&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Quadlet Volume&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;log-system.network&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/containers/systemd/log-system.network&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Quadlet Network&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;logstash.container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/containers/systemd/logstash.container&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Quadlet Container&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;環境變數一覽&lt;span class="hx:absolute hx:-mt-20" id="環境變數一覽"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83%e8%ae%8a%e6%95%b8%e4%b8%80%e8%a6%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;變數名&lt;/th&gt;
&lt;th&gt;用途&lt;/th&gt;
&lt;th&gt;範例值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HTTP_AUTH_USER&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTP input basic auth 帳號&lt;/td&gt;
&lt;td&gt;&lt;code&gt;logstash&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;HTTP_AUTH_PASSWORD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTP input basic auth 密碼&lt;/td&gt;
&lt;td&gt;&lt;code&gt;changeme&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OPENSEARCH_HOSTS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OpenSearch 連線 URL&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://opensearch-node.kubeantony.com:9200&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OPENSEARCH_INDEX&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OpenSearch index 名稱（含日期格式）&lt;/td&gt;
&lt;td&gt;&lt;code&gt;opensearch-logstash-docker-%{+YYYY.MM.dd}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OPENSEARCH_PASSWORD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OpenSearch admin 密碼&lt;/td&gt;
&lt;td&gt;&lt;code&gt;!QAZ2wsx@WSX!!&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;注意事項&lt;span class="hx:absolute hx:-mt-20" id="注意事項"&gt;&lt;/span&gt;
&lt;a href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;以一般使用者操作，透過 &lt;code&gt;sudo&lt;/code&gt; 提權，容器以 &lt;strong&gt;rootful&lt;/strong&gt; 模式執行。&lt;/li&gt;
&lt;li&gt;使用 &lt;code&gt;sudo systemctl&lt;/code&gt;（不帶 &lt;code&gt;--user&lt;/code&gt;）管理服務。&lt;/li&gt;
&lt;li&gt;Podman 4.9.3 不支援 &lt;code&gt;.build&lt;/code&gt; Quadlet，映像需先手動 &lt;code&gt;sudo podman build&lt;/code&gt; 建構。&lt;/li&gt;
&lt;li&gt;podlet 產生的 &lt;code&gt;WantedBy=default.target&lt;/code&gt; 是 rootless 慣例，rootful 需手動改為 &lt;code&gt;multi-user.target&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;podlet 產生的檔案不包含 &lt;code&gt;[Service]&lt;/code&gt; 區段，需手動補上。&lt;/li&gt;
&lt;li&gt;寫入受保護路徑一律使用 &lt;code&gt;sudo tee&lt;/code&gt;，避免重導向權限問題。&lt;/li&gt;
&lt;li&gt;SSL 私鑰必須為 &lt;strong&gt;PKCS8 格式&lt;/strong&gt;，Logstash HTTP input plugin 不接受一般 PEM 格式的 key。&lt;/li&gt;
&lt;li&gt;憑證目錄 &lt;code&gt;/etc/logstash/certs/&lt;/code&gt; 以 &lt;code&gt;ro&lt;/code&gt;（唯讀）掛載進容器。&lt;/li&gt;
&lt;li&gt;環境變數檔 &lt;code&gt;/etc/logstash/logstash.env&lt;/code&gt; 權限務必為 &lt;code&gt;0600&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;如需修改任何環境變數，編輯 env 檔後執行 &lt;code&gt;sudo systemctl restart logstash.service&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;如需更新 plugin，重新執行步驟 3 的 build 指令後重啟服務。&lt;/li&gt;
&lt;li&gt;如需更換憑證，替換 &lt;code&gt;/etc/logstash/certs/&lt;/code&gt; 下的檔案後重啟服務。&lt;/li&gt;
&lt;li&gt;部署前建議用 &lt;code&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/code&gt; 驗證設定。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Rancher RBAC 實務範例</title><link>https://blog.kubeantony.com/archive/rancher/rancher-rbac-%E5%AF%A6%E5%8B%99%E7%AF%84%E4%BE%8B/</link><pubDate>Mon, 23 Mar 2026 08:55:34 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/rancher-rbac-%E5%AF%A6%E5%8B%99%E7%AF%84%E4%BE%8B/</guid><description>
&lt;p&gt;依據職責與最小權限原則，可將使用者劃分為以下幾個層級&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: center"&gt;層級&lt;/th&gt;
&lt;th&gt;角色&lt;/th&gt;
&lt;th&gt;Rancher 角色&lt;/th&gt;
&lt;th&gt;權限範圍&lt;/th&gt;
&lt;th&gt;核心職責&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;1&lt;/td&gt;
&lt;td&gt;平台管理員&lt;/td&gt;
&lt;td&gt;Global Administrator（內建）&lt;/td&gt;
&lt;td&gt;全域 — 所有叢集、所有資源完整 CRUD&lt;/td&gt;
&lt;td&gt;叢集生命週期管理、全域認證與安全策略 (LDAP/AD/SAML)、使用者帳號與角色分配&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;2&lt;/td&gt;
&lt;td&gt;叢集管理／維運人員&lt;/td&gt;
&lt;td&gt;Cluster Owner（內建）&lt;/td&gt;
&lt;td&gt;特定叢集 — 完整管理權限，不含平台層級操作&lt;/td&gt;
&lt;td&gt;節點健康監控 (cordon/drain)、Namespace 與 Project 規劃、叢集內 RBAC、資源配額調整、ETCD 快照&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;3a&lt;/td&gt;
&lt;td&gt;資安稽核員（長官）&lt;/td&gt;
&lt;td&gt;Read Only Administrator（客製）&lt;/td&gt;
&lt;td&gt;全域 — 所有叢集僅 get/list/watch&lt;/td&gt;
&lt;td&gt;跨叢集合規性稽核，查看所有資源但無法修改或刪除&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;3b&lt;/td&gt;
&lt;td&gt;資安稽核員（一般）&lt;/td&gt;
&lt;td&gt;Cluster Reader（客製）&lt;/td&gt;
&lt;td&gt;特定叢集 — 僅 get/list/watch&lt;/td&gt;
&lt;td&gt;特定叢集合規性稽核，查看該叢集所有資源&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;4&lt;/td&gt;
&lt;td&gt;應用系統／專案管理員&lt;/td&gt;
&lt;td&gt;Project Owner（內建）&lt;/td&gt;
&lt;td&gt;特定 Project — 所屬 Project 內完整 CRUD&lt;/td&gt;
&lt;td&gt;Project 成員管理、Namespace 建立、Workload 部署、ResourceQuota/LimitRange、PVC 管理、監控告警&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: center"&gt;5&lt;/td&gt;
&lt;td&gt;應用程式開發人員&lt;/td&gt;
&lt;td&gt;Project Member / Read Only（內建）&lt;/td&gt;
&lt;td&gt;特定 Namespace — 授權 Namespace 內操作；正式環境通常僅唯讀&lt;/td&gt;
&lt;td&gt;Workload 部署與更新、Service/Ingress 設定、ConfigMap/Secret 使用、日誌查看與 Pod 除錯、HPA 設定&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;1. 平台管理員&lt;span class="hx:absolute hx:-mt-20" id="1-平台管理員"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%b9%b3%e5%8f%b0%e7%ae%a1%e7%90%86%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;角色概述&lt;span class="hx:absolute hx:-mt-20" id="角色概述"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%92%e8%89%b2%e6%a6%82%e8%bf%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;平台管理員負責維護 Rancher 平台本身的運作，擁有最高權限（Global Administrator）。&lt;/p&gt;
&lt;h3&gt;職責範圍&lt;span class="hx:absolute hx:-mt-20" id="職責範圍"&gt;&lt;/span&gt;
&lt;a href="#%e8%81%b7%e8%b2%ac%e7%af%84%e5%9c%8d" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 Rancher 中，平台管理員可處理跨叢集、平台層級的事務，包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;叢集生命週期管理 — 建立、匯入、刪除 Rancher 本身及其所管理的所有叢集&lt;/li&gt;
&lt;li&gt;全域認證與安全策略設定 — LDAP、AD、SAML 等&lt;/li&gt;
&lt;li&gt;使用者帳號與角色分配 — 管理平台上所有使用者的權限&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;具體權限 (內建)&lt;span class="hx:absolute hx:-mt-20" id="具體權限-內建"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%85%a7%e5%bb%ba" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJoOP5Lc-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;實作範例 : 設定 Windows AD 的 admin 群組為平台管理員&lt;span class="hx:absolute hx:-mt-20" id="實作範例--設定-windows-ad-的-admin-群組為平台管理員"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84-admin-%e7%be%a4%e7%b5%84%e7%82%ba%e5%b9%b3%e5%8f%b0%e7%ae%a1%e7%90%86%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;點選左側清單的 &lt;strong&gt;Users &amp;amp; Authentication&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Groups&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Assign Global Roles&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1bz9qLqWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇群組 -&amp;gt; 僅勾選 &lt;strong&gt;Administrator&lt;/strong&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r135icI5Zx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;滑鼠滾到頁面最下方，點選 &lt;strong&gt;Save&lt;/strong&gt; 按鈕儲存&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByyxnqLqWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;2. 叢集管理、維運人員&lt;span class="hx:absolute hx:-mt-20" id="2-叢集管理維運人員"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%8f%a2%e9%9b%86%e7%ae%a1%e7%90%86%e7%b6%ad%e9%81%8b%e4%ba%ba%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;角色概述&lt;span class="hx:absolute hx:-mt-20" id="角色概述-1"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%92%e8%89%b2%e6%a6%82%e8%bf%b0-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;負責管理特定 DownStream Kubernetes 叢集狀態的 SRE 或維運工程師，此角色是特定叢集的維運、管理者，但非平台管理者。&lt;/p&gt;
&lt;h3&gt;職責範圍&lt;span class="hx:absolute hx:-mt-20" id="職責範圍-1"&gt;&lt;/span&gt;
&lt;a href="#%e8%81%b7%e8%b2%ac%e7%af%84%e5%9c%8d-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Cluster Admin 專注在自己管理的叢集內。日常工作包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;node&lt;/code&gt; 的健康監控與管理（cordon、drain、新增和刪除節點）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;namespace&lt;/code&gt; 與 &lt;code&gt;project&lt;/code&gt; 的規劃&lt;/li&gt;
&lt;li&gt;叢集內的 RBAC 設定（指派 Project owner 等角色）&lt;/li&gt;
&lt;li&gt;硬體資源配額的調整&lt;/li&gt;
&lt;li&gt;Netwrok policy 的管理&lt;/li&gt;
&lt;li&gt;對 ETCD Take Snapshot&lt;/li&gt;
&lt;li&gt;叢集層級的日誌和監控設定&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;具體權限 (內建)&lt;span class="hx:absolute hx:-mt-20" id="具體權限-內建-1"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%85%a7%e5%bb%ba-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJkeEjI5bl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;實作範例 : 設定 Windows AD 的 infra 群組為基礎架構維運人員&lt;span class="hx:absolute hx:-mt-20" id="實作範例--設定-windows-ad-的-infra-群組為基礎架構維運人員"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84-infra-%e7%be%a4%e7%b5%84%e7%82%ba%e5%9f%ba%e7%a4%8e%e6%9e%b6%e6%a7%8b%e7%b6%ad%e9%81%8b%e4%ba%ba%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;點選左側選單 &lt;strong&gt;Cluster Management&lt;/strong&gt; -&amp;gt; 找到要管理的 K8s 叢集 -&amp;gt; 點選最右側的&lt;strong&gt;三點選單&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Edit Config&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJp2PoL5be.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇 &lt;strong&gt;Member Roles&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1EVDjIcZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇群組 -&amp;gt; 勾選 &lt;strong&gt;Owner&lt;/strong&gt; 權限 -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Syl8uiI9-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;點選右下角 &lt;strong&gt;Save&lt;/strong&gt; 按鈕儲存
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1ST_jIcZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;在 NeuVector 通常賦予 CI/CD 操作權限，允許在維運過程中觸發掃描或排除誤判，確保服務穩定。&lt;/p&gt;
&lt;h2&gt;3. 資訊安全稽核員&lt;span class="hx:absolute hx:-mt-20" id="3-資訊安全稽核員"&gt;&lt;/span&gt;
&lt;a href="#3-%e8%b3%87%e8%a8%8a%e5%ae%89%e5%85%a8%e7%a8%bd%e6%a0%b8%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;角色概述&lt;span class="hx:absolute hx:-mt-20" id="角色概述-2"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%92%e8%89%b2%e6%a6%82%e8%bf%b0-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;資安部門長官或一般人員進行合規性的稽核作業。&lt;/p&gt;
&lt;h3&gt;職責範圍&lt;span class="hx:absolute hx:-mt-20" id="職責範圍-2"&gt;&lt;/span&gt;
&lt;a href="#%e8%81%b7%e8%b2%ac%e7%af%84%e5%9c%8d-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;長官可以讀取所有叢集(包含 &lt;code&gt;local&lt;/code&gt; Cluster)的所有資源，但不具備編輯或刪除的其他權限。&lt;/li&gt;
&lt;li&gt;一般人員只能讀取特定叢集的所有資源。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;具體權限 (客製化) - Read Only Administrator&lt;span class="hx:absolute hx:-mt-20" id="具體權限-客製化---read-only-administrator"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%ae%a2%e8%a3%bd%e5%8c%96---read-only-administrator" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1OFKN0cZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;具體權限 (客製化) - Cluster Reader&lt;span class="hx:absolute hx:-mt-20" id="具體權限-客製化---cluster-reader"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%ae%a2%e8%a3%bd%e5%8c%96---cluster-reader" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkOIlJd9be.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 Global Read-only Administrator Roletemplate&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
apiVersion: management.cattle.io/v3
builtin: false
context: cluster
description: &amp;#39;&amp;#39;
displayName: View Cluster Resources for Readonly Admin
external: false
hidden: true
kind: RoleTemplate
metadata:
name: cluster-readonly-view
rules:
- apiGroups:
- &amp;#39;&amp;#39;
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- catalog.cattle.io
resources:
- clusterrepos
- apps
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resourceNames:
- local
resources:
- clusters
verbs:
- get
---
apiVersion: management.cattle.io/v3
builtin: false
displayName: Read Only Administrator
description: &amp;#39;全域唯讀管理員角色，不具備任何建立、修改或刪除操作的權限。&amp;#39;
inheritedClusterRoles:
- projects-view
- nodes-view
- cluster-readonly-view
kind: GlobalRole
metadata:
name: global-read-only
rules:
- apiGroups:
- management.cattle.io
resources:
- projectroletemplatebindings
- clusterroletemplatebindings
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- globalroles
- globalrolebindings
verbs:
- get
- list
- watch
- apiGroups:
- project.cattle.io
resources:
- apps
verbs:
- get
- list
- watch
- apiGroups:
- project.cattle.io
resources:
- apprevisions
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- nodes
- nodepools
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- roletemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clusterevents
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- notifiers
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- notificationtemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- projectalertgroups
- projectalertrules
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- projectloggings
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clusteralertgroups
- clusteralertrules
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clustercatalogs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- projectcatalogs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- projectmonitorgraphs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- catalogtemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- catalogtemplateversions
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- projects
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clusters
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- principals
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- users
- userattribute
- groups
- groupmembers
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clusterloggings
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- clustermonitorgraphs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- preferences
verbs:
- &amp;#39;*&amp;#39;
- apiGroups:
- management.cattle.io
resources:
- settings
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- features
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- templates
- templateversions
- catalogs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- nodedrivers
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- kontainerdrivers
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- operatorsettings
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- podsecuritypolicytemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- nodetemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- multiclusterapps
- globaldnses
- globaldnsproviders
- clustertemplaterevisions
- clustertemplates
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- rkek8ssystemimages
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- rkek8sserviceoptions
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- rkeaddons
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- cisconfigs
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- cisbenchmarkversions
- clusterscans
verbs:
- get
- list
- watch
- apiGroups:
- management.cattle.io
resources:
- etcdbackups
verbs:
- get
- list
- watch
- apiGroups:
- catalog.cattle.io
resources:
- clusterrepos
verbs:
- get
- list
- watch
- apiGroups:
- provisioning.cattle.io
resources:
- clusters
verbs:
- get
- list
- watch
- apiGroups:
- &amp;#39;&amp;#39;
resources:
- nodes
verbs:
- get
- list
- watch
- apiGroups:
- &amp;#39;*&amp;#39;
resources:
- secrets
verbs:
- get
- list
- watch
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 &lt;code&gt;local&lt;/code&gt; Cluster 建立 &lt;code&gt;cluster-reader&lt;/code&gt; Roletemplate 執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39; | kubectl apply -f -
apiVersion: management.cattle.io/v3
kind: RoleTemplate
metadata:
name: cluster-reader
displayName: Cluster Reader
description: &amp;#34;提供叢集層級的唯讀權限，可查看所有資源但無法修改。&amp;#34;
# context 設定為 cluster 表示此角色應用於集群層級
context: cluster
# builtin 設定為 false 表示這是自定義角色
builtin: false
clusterCreatorDefault: true
rules:
- apiGroups:
- &amp;#39;*&amp;#39;
resources:
- &amp;#39;*&amp;#39;
verbs:
- get
- list
- watch
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;實作範例 1 : 設定 Windows AD 的特定 User 為 Read Only Administrator&lt;span class="hx:absolute hx:-mt-20" id="實作範例-1--設定-windows-ad-的特定-user-為-read-only-administrator"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b-1--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84%e7%89%b9%e5%ae%9a-user-%e7%82%ba-read-only-administrator" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Users &amp;amp; Authentication&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Users&lt;/strong&gt; -&amp;gt; 選擇使用者 -&amp;gt; &lt;strong&gt;三點選單&lt;/strong&gt; -&amp;gt; Edit Config&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJcQyHA9-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;找到 &lt;strong&gt;Custom&lt;/strong&gt; 區塊 -&amp;gt; 勾選 &lt;strong&gt;Read Only Administrator&lt;/strong&gt; -&amp;gt; 右下角 &lt;strong&gt;Save&lt;/strong&gt; 按鈕&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1bUhrCqWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;實作範例 2 : 設定 Windows AD 的特定 User 為 Cluster Reader&lt;span class="hx:absolute hx:-mt-20" id="實作範例-2--設定-windows-ad-的特定-user-為-cluster-reader"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b-2--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84%e7%89%b9%e5%ae%9a-user-%e7%82%ba-cluster-reader" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;左側選單點進要管理的叢集&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Cluster&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Cluster and Project Members&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1neu8Ccbe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Select Member 選擇特定 User&lt;/strong&gt; -&amp;gt; &lt;strong&gt;選擇 Cluster Reader&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Create&lt;/strong&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1B1FLRqWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 應用系統/專案管理員&lt;span class="hx:absolute hx:-mt-20" id="4-應用系統專案管理員"&gt;&lt;/span&gt;
&lt;a href="#4-%e6%87%89%e7%94%a8%e7%b3%bb%e7%b5%b1%e5%b0%88%e6%a1%88%e7%ae%a1%e7%90%86%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;角色概述&lt;span class="hx:absolute hx:-mt-20" id="角色概述-3"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%92%e8%89%b2%e6%a6%82%e8%bf%b0-3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;負責管理特定 Downstream Kubernetes 叢集中，特定 Project 底下的所有資源與權限。對應 Rancher 的 Project Owner 角色，通常由各應用系統的 Tech Lead、專案負責人或 AP 維運組長擔任。&lt;/p&gt;
&lt;h3&gt;職責範圍&lt;span class="hx:absolute hx:-mt-20" id="職責範圍-3"&gt;&lt;/span&gt;
&lt;a href="#%e8%81%b7%e8%b2%ac%e7%af%84%e5%9c%8d-3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 Rancher 中，應用系統/專案管理員可在其所屬 Project 範圍內處理以下事務：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Project 成員管理 — 負責新增、移除及調整 Project 內成員的角色與權限，為該 Project 的最高管理者&lt;/li&gt;
&lt;li&gt;Namespace 規劃與建立 — 依據應用模組或環境需求，在 Project 下建立與管理 Namespace&lt;/li&gt;
&lt;li&gt;應用部署與生命週期管理 — 管理 Project 內所有 Workload、Service、Cronjob 等應用資源的部署與更新&lt;/li&gt;
&lt;li&gt;資源配額管控 — 設定 Project 層級與 Namespace 層級的 ResourceQuota / LimitRange，確保資源使用不超出分配額度&lt;/li&gt;
&lt;li&gt;儲存資源管理 — 為應用申請與管理持久化儲存空間(PVC)，並可查看叢集可用的 StorageClass&lt;/li&gt;
&lt;li&gt;監控與告警設定 — 設定 Project 層級的監控規則與告警通知，確保應用異常時能即時回應&lt;/li&gt;
&lt;li&gt;基礎設施資訊查看 — 可查看叢集節點狀態與叢集事件，了解底層運行狀況&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;具體權限 (內建)&lt;span class="hx:absolute hx:-mt-20" id="具體權限-內建-2"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%85%a7%e5%bb%ba-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJvQmP0cWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;實作範例 : 設定 Windows AD 的特定 User 為 Project Owner&lt;span class="hx:absolute hx:-mt-20" id="實作範例--設定-windows-ad-的特定-user-為-project-owner"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84%e7%89%b9%e5%ae%9a-user-%e7%82%ba-project-owner" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;左側選單選擇目標 K8s 叢集&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Cluster and Project Members&lt;/strong&gt; -&amp;gt;
&lt;strong&gt;Project Membership&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkkmOdC9Wg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇 &lt;strong&gt;User&lt;/strong&gt; -&amp;gt; 選擇 &lt;strong&gt;Owner&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Create&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hyc-tOCq-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. 應用程式開發人員&lt;span class="hx:absolute hx:-mt-20" id="5-應用程式開發人員"&gt;&lt;/span&gt;
&lt;a href="#5-%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e9%96%8b%e7%99%bc%e4%ba%ba%e5%93%a1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;角色概述&lt;span class="hx:absolute hx:-mt-20" id="角色概述-4"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%92%e8%89%b2%e6%a6%82%e8%bf%b0-4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;負責在被授權的 Project 內進行應用程式的部署、除錯與日常維運操作。對應 Rancher 的 Project Member 或 Read-Only 角色，通常由應用開發工程師或 DevOps 工程師擔任。透過 Rancher 的專案 (Project) 機制，限制他們只能在配發的 Namespace 內部署應用程式與查看 Log。他們無法看見亦無法影響其他團隊的資源或底層基礎建設。&lt;/p&gt;
&lt;h3&gt;職責範圍&lt;span class="hx:absolute hx:-mt-20" id="職責範圍-4"&gt;&lt;/span&gt;
&lt;a href="#%e8%81%b7%e8%b2%ac%e7%af%84%e5%9c%8d-4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;在 Rancher 中，應用程式開發人員可在其所屬 Project 的已授權 Namespace 內執行以下操作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Workload 部署與管理 — 建立、更新、刪除 Deployment、StatefulSet、Job、CronJob 等Workloads&lt;/li&gt;
&lt;li&gt;服務與路由設定 — 建立及修改 Service、Ingress，設定應用的對內與對外存取路徑&lt;/li&gt;
&lt;li&gt;組態與密鑰使用 — 建立及編輯自身應用所需的 ConfigMap 與 Secret（依權限範圍）&lt;/li&gt;
&lt;li&gt;應用日誌查看 — 透過 Rancher 介面查看 Pod 即時日誌，進行問題排查&lt;/li&gt;
&lt;li&gt;Pod 除錯操作 — 使用 kubectl exec / Rancher Shell 進入 App Container 進行偵錯，查看 Pod 事件與狀態&lt;/li&gt;
&lt;li&gt;彈性伸縮設定 — 設定 HPA (Horizontal Pod Autoscaler)，調整副本數因應流量變化&lt;/li&gt;
&lt;li&gt;CI/CD 管線觸發 — 配合 Pipeline 執行應用的建置與部署流程&lt;/li&gt;
&lt;li&gt;正式環境（Production）唯讀除錯 — 在正式環境中，開發人員通常僅具備唯讀（Read-Only）權限，只能查看日誌與監控儀表板以協助排查線上問題，無權直接修改系統配置或重啟服務。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;具體權限 (內建) - Project Member&lt;span class="hx:absolute hx:-mt-20" id="具體權限-內建---project-member"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%85%a7%e5%bb%ba---project-member" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1a-su0qbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;具體權限 (內建) - Project Read only&lt;span class="hx:absolute hx:-mt-20" id="具體權限-內建---project-read-only"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%b7%e9%ab%94%e6%ac%8a%e9%99%90-%e5%85%a7%e5%bb%ba---project-read-only" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByaFidCqZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;實作範例 : 設定 Windows AD 的特定 User 為 Project Member&lt;span class="hx:absolute hx:-mt-20" id="實作範例--設定-windows-ad-的特定-user-為-project-member"&gt;&lt;/span&gt;
&lt;a href="#%e5%af%a6%e4%bd%9c%e7%af%84%e4%be%8b--%e8%a8%ad%e5%ae%9a-windows-ad-%e7%9a%84%e7%89%b9%e5%ae%9a-user-%e7%82%ba-project-member" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;左側選單選擇目標 K8s 叢集&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Cluster and Project Members&lt;/strong&gt; -&amp;gt;
&lt;strong&gt;Project Membership&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Add&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkkmOdC9Wg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇 &lt;strong&gt;User&lt;/strong&gt; -&amp;gt; 選擇 &lt;strong&gt;Owner&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Create&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJaCTO0qbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>[Rancher] Downstream cluster 因 cattle-controllers leader lease 過期未釋放而顯示「Waiting for cluster agent to connect」</title><link>https://blog.kubeantony.com/archive/rancher/rancher-downstream-cluster-%E5%9B%A0-cattle-controllers-leader-lease-%E9%81%8E%E6%9C%9F%E6%9C%AA%E9%87%8B%E6%94%BE%E8%80%8C%E9%A1%AF%E7%A4%BAwaiting-for-cluster-agent-to-connect/</link><pubDate>Mon, 23 Mar 2026 03:48:34 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/rancher-downstream-cluster-%E5%9B%A0-cattle-controllers-leader-lease-%E9%81%8E%E6%9C%9F%E6%9C%AA%E9%87%8B%E6%94%BE%E8%80%8C%E9%A1%AF%E7%A4%BAwaiting-for-cluster-agent-to-connect/</guid><description>
&lt;h2&gt;環境&lt;span class="hx:absolute hx:-mt-20" id="環境"&gt;&lt;/span&gt;
&lt;a href="#%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;SUSE Rancher Manager &lt;code&gt;v2.13.2&lt;/code&gt;（HA 部署，3 個 replicas）&lt;/li&gt;
&lt;li&gt;RKE2 &lt;code&gt;v1.34.4+rke2r1&lt;/code&gt; downstream cluster（3 台 control plane + 3 台 worker 節點）&lt;/li&gt;
&lt;li&gt;SUSE Linux Enterprise Server 15 SP7&lt;/li&gt;
&lt;li&gt;管理叢集與 downstream cluster 皆使用 Kubernetes &lt;code&gt;v1.34.x&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;狀況&lt;span class="hx:absolute hx:-mt-20" id="狀況"&gt;&lt;/span&gt;
&lt;a href="#%e7%8b%80%e6%b3%81" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在 Rancher deployment 更新（例如 &lt;code&gt;rollout restart&lt;/code&gt;、Helm upgrade 或 pod 重新排程）之後，一個或多個 downstream cluster 在 Rancher UI 上進入 &lt;strong&gt;Reconciling&lt;/strong&gt; 或 &lt;strong&gt;Updating&lt;/strong&gt; 狀態。受影響的 machine 顯示以下訊息：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Waiting for cluster agent to connect&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;叢集本身功能完全正常 — 所有節點為 &lt;code&gt;Ready&lt;/code&gt;，所有 pod 皆在運行，對 downstream cluster 執行 &lt;code&gt;kubectl&lt;/code&gt; 指令也能正常回應。然而 Rancher UI 持續顯示叢集處於已斷線狀態。&lt;/p&gt;
&lt;h3&gt;症狀&lt;span class="hx:absolute hx:-mt-20" id="症狀"&gt;&lt;/span&gt;
&lt;a href="#%e7%97%87%e7%8b%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Rancher UI 顯示叢集狀態為 &lt;strong&gt;Updating&lt;/strong&gt;，且一台或多台 machine 處於 &lt;strong&gt;Reconciling&lt;/strong&gt; 狀態，並附帶訊息「Waiting for cluster agent to connect」。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/Hk90PNCqZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Downstream cluster 的 &lt;code&gt;cattle-cluster-agent&lt;/code&gt; 日誌顯示已成功建立 WebSocket 連線至 Rancher server：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Connected to proxy url=&amp;#34;wss://rancher.example.com/v3/connect/register&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;儘管看似已連線，但 Rancher server 的日誌顯示 tunnel 認證失敗：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Failed to handle tunnel request from remote address 10.42.x.x:xxxxx
(X-Forwarded-For: x.x.x.x): response 401: failed authentication&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;管理叢集的 &lt;code&gt;clusters.management.cattle.io&lt;/code&gt; 物件顯示 &lt;code&gt;Connected: False&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;type: Connected
status: &amp;#34;False&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Provisioning cluster 的 conditions 顯示：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;type: Updated
status: Unknown
message: &amp;#34;configuring bootstrap node(s) custom-xxxxxxxx: waiting for cluster agent to connect&amp;#34;
type: Ready
status: &amp;#34;False&amp;#34;
message: &amp;#34;Cluster agent is not connected&amp;#34;
reason: Disconnected&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;kube-system&lt;/code&gt; namespace 中的 &lt;code&gt;cattle-controllers&lt;/code&gt; leader lease 指向一個已不存在的 pod：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ kubectl get lease cattle-controllers -n kube-system -o yaml
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;spec:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; holderIdentity: rancher-&amp;lt;old-replicaset&amp;gt;-&amp;lt;old-pod&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; leaseDurationSeconds: &lt;span class="m"&gt;162000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;原因&lt;span class="hx:absolute hx:-mt-20" id="原因"&gt;&lt;/span&gt;
&lt;a href="#%e5%8e%9f%e5%9b%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Rancher 的 management controllers（負責叢集狀態調解、tunnel 認證、agent 部署與 machine 狀態更新）使用 &lt;code&gt;kube-system&lt;/code&gt; namespace 中名為 &lt;code&gt;cattle-controllers&lt;/code&gt; 的 Kubernetes &lt;code&gt;Lease&lt;/code&gt; 物件進行 leader election。只有 leader pod 才會處理叢集管理操作。&lt;/p&gt;
&lt;p&gt;當 Rancher deployment 更新（rolling restart、Helm upgrade 等）時，舊的 pod 會被終止並由新 ReplicaSet 的新 pod 取代。然而，Rancher 將 &lt;code&gt;cattle-controllers&lt;/code&gt; lease 的 &lt;strong&gt;&lt;code&gt;leaseDurationSeconds&lt;/code&gt; 設定為 162,000 秒（45 小時）&lt;/strong&gt;。這是刻意設定的長時間值，目的是避免短暫網路中斷時發生不必要的 leader 切換。&lt;/p&gt;
&lt;p&gt;問題發生的流程如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;當前的 leader pod 在 deployment 更新過程中被終止。&lt;/li&gt;
&lt;li&gt;過期的 lease 仍然指向已終止 pod 的身份識別。&lt;/li&gt;
&lt;li&gt;新的 Rancher pod 檢查 lease 後發現 &lt;code&gt;renewTime + leaseDurationSeconds&lt;/code&gt; 尚未到期。&lt;/li&gt;
&lt;li&gt;所有新 pod 等待 lease 自然過期 — 最長需要等待 &lt;strong&gt;45 小時&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;在這段等待期間，&lt;strong&gt;沒有任何 management controller 在運作&lt;/strong&gt;，導致所有 downstream cluster 的管理操作停擺。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;這會引發一連串連鎖故障：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cluster agent 的 tunnel 認證請求無人處理（401 錯誤）。&lt;/li&gt;
&lt;li&gt;Cluster 物件上的 &lt;code&gt;Connected&lt;/code&gt; 狀態永遠不會被更新。&lt;/li&gt;
&lt;li&gt;Machine reconciliation 不會被執行。&lt;/li&gt;
&lt;li&gt;Rancher UI 持續反映過期的「Waiting for cluster agent to connect」狀態。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;解決方案&lt;span class="hx:absolute hx:-mt-20" id="解決方案"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;立即修復&lt;span class="hx:absolute hx:-mt-20" id="立即修復"&gt;&lt;/span&gt;
&lt;a href="#%e7%ab%8b%e5%8d%b3%e4%bf%ae%e5%be%a9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;刪除過期的 leader lease，讓當前的 Rancher pod 立即取得 leadership：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl delete lease cattle-controllers -n kube-system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在 30 秒內，一個新的 Rancher pod 將取得 lease，management controllers 將恢復正常運作。驗證新的 leader：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get lease cattle-controllers -n kube-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.spec.holderIdentity}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認 holder identity 與當前運行中的 Rancher pod 相符：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n cattle-system -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rancher -o name&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在 lease 被取得之後，downstream cluster 的狀態應在 1–3 分鐘內從 &lt;strong&gt;Updating/Reconciling&lt;/strong&gt; 轉為 &lt;strong&gt;Active&lt;/strong&gt;。&lt;/p&gt;
&lt;h3&gt;驗證&lt;span class="hx:absolute hx:-mt-20" id="驗證"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;確認叢集已恢復連線：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get clusters.management.cattle.io &amp;lt;cluster-id&amp;gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.status.conditions[?(@.type==&amp;#34;Connected&amp;#34;)]}&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; python3 -m json.tool&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期輸出：&lt;code&gt;&amp;quot;status&amp;quot;: &amp;quot;True&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 Rancher UI 確認所有 machine 都顯示 &lt;strong&gt;Running&lt;/strong&gt; 狀態。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證對所有節點上的 pod 執行 &lt;code&gt;kubectl logs&lt;/code&gt; 時不再出現 502 錯誤。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;預防措施&lt;span class="hx:absolute hx:-mt-20" id="預防措施"&gt;&lt;/span&gt;
&lt;a href="#%e9%a0%90%e9%98%b2%e6%8e%aa%e6%96%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;為降低未來 Rancher 更新時再次遇到此問題的影響：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;在更新後監控 lease。&lt;/strong&gt; 每次 Rancher deployment 重啟或升級後，驗證 &lt;code&gt;cattle-controllers&lt;/code&gt; lease 是否指向正在運行的 pod：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;LEADER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;kubectl get lease cattle-controllers -n kube-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.spec.holderIdentity}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pod -n cattle-system &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$LEADER&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;警告：Leader pod &lt;/span&gt;&lt;span class="nv"&gt;$LEADER&lt;/span&gt;&lt;span class="s2"&gt; 不存在 — lease 已過期&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;將 lease 檢查納入升級手冊。&lt;/strong&gt; 在您的標準 Rancher 升級流程中，於 rollout 完成後立即加入 lease 驗證步驟。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;考慮提交 feature request。&lt;/strong&gt; 162,000 秒（45 小時）的 lease 過期時間設定過於保守。較短的過期時間（例如 300–600 秒）可以縮短 failover 視窗，同時仍能提供對短暫網路中斷的韌性。&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;診斷步驟摘要&lt;span class="hx:absolute hx:-mt-20" id="診斷步驟摘要"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ba%e6%96%b7%e6%ad%a5%e9%a9%9f%e6%91%98%e8%a6%81" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;以下指令用於診斷此問題，可在類似的故障排查中重複使用：&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;步驟&lt;/th&gt;
&lt;th&gt;指令&lt;/th&gt;
&lt;th&gt;用途&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get nodes -o wide&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;驗證 downstream cluster 節點健康狀態&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get pods -n cattle-system -o wide&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;檢查 cluster agent 狀態&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl logs -n cattle-system -l app=rancher | grep &amp;quot;401|tunnel|failed auth&amp;quot;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;在 Rancher server 上尋找 tunnel 認證失敗訊息&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get clusters.management.cattle.io &amp;lt;id&amp;gt; -o jsonpath='{.status.conditions}'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;檢查 Connected 狀態&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get clusters.provisioning.cattle.io -n fleet-default &amp;lt;n&amp;gt; -o jsonpath='{.status.conditions}'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;檢查 provisioning conditions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get lease cattle-controllers -n kube-system -o yaml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;識別過期的 leader lease&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get pods -n cattle-system -l app=rancher -o name&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;比對 lease holder 與運行中的 pod&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;補充資訊&lt;span class="hx:absolute hx:-mt-20" id="補充資訊"&gt;&lt;/span&gt;
&lt;a href="#%e8%a3%9c%e5%85%85%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;此問題可能同時影響任意數量的 downstream cluster，因為所有叢集管理操作皆依賴單一的 &lt;code&gt;cattle-controllers&lt;/code&gt; leader。&lt;/li&gt;
&lt;li&gt;此問題不限於 Rancher v2.13.x，任何使用長 &lt;code&gt;leaseDurationSeconds&lt;/code&gt; 設定的 &lt;code&gt;cattle-controllers&lt;/code&gt; lease 版本都可能發生。&lt;/li&gt;
&lt;li&gt;在此期間，downstream cluster 本身保持完全正常運作。僅 Rancher 的 management plane 操作受到影響。&lt;/li&gt;
&lt;li&gt;刪除 lease 是非破壞性操作。新的 leader 將根據系統的當前狀態從頭開始重新調解所有叢集狀態。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Install ArgoCD on Rancher RKE2</title><link>https://blog.kubeantony.com/archive/rancher/install-argocd-on-rancher-rke2/</link><pubDate>Fri, 20 Mar 2026 07:58:28 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/install-argocd-on-rancher-rke2/</guid><description>
&lt;h2&gt;1. Install ArgoCD&lt;span class="hx:absolute hx:-mt-20" id="1-install-argocd"&gt;&lt;/span&gt;
&lt;a href="#1-install-argocd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wait for all pods to be ready&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl wait --for=condition=Ready pods --all -n argocd --timeout=300s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;pod/argocd-application-controller-0 condition met
pod/argocd-applicationset-controller-7dc85c9598-m4rrd condition met
pod/argocd-dex-server-7d88b5b798-jq58x condition met
pod/argocd-notifications-controller-5f95df7f8c-x94js condition met
pod/argocd-redis-65b5bbd8cb-jw27t condition met
pod/argocd-repo-server-69fb9fb66f-hgvrg condition met
pod/argocd-server-58dbdffdcd-4qz8l condition met&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;expose ArgoCD with ingress&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server
namespace: argocd
annotations:
nginx.ingress.kubernetes.io/ssl-passthrough: &amp;#34;true&amp;#34;
nginx.ingress.kubernetes.io/backend-protocol: &amp;#34;HTTPS&amp;#34;
spec:
ingressClassName: nginx
rules:
- host: argocd.kubeantony.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
number: 443
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Grafana Reporter 部署指南（Harvester / Rancher 環境）</title><link>https://blog.kubeantony.com/archive/rancher/grafana-reporter-%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97harvester-rancher-%E7%92%B0%E5%A2%83/</link><pubDate>Wed, 11 Mar 2026 02:27:26 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/grafana-reporter-%E9%83%A8%E7%BD%B2%E6%8C%87%E5%8D%97harvester-rancher-%E7%92%B0%E5%A2%83/</guid><description>
&lt;h2&gt;概述&lt;span class="hx:absolute hx:-mt-20" id="概述"&gt;&lt;/span&gt;
&lt;a href="#%e6%a6%82%e8%bf%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本文件說明如何在 Harvester（Rancher 管理）環境中部署 &lt;a
href="https://github.com/IzakMarais/reporter"target="_blank" rel="noopener"&gt;IzakMarais/reporter&lt;/a&gt;，讓 Grafana Dashboard 能一鍵產生 PDF 報表，並透過 Rancher Proxy 對外存取。&lt;/p&gt;
&lt;h3&gt;架構說明&lt;span class="hx:absolute hx:-mt-20" id="架構說明"&gt;&lt;/span&gt;
&lt;a href="#%e6%9e%b6%e6%a7%8b%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;瀏覽器
│
▼
Rancher API Proxy（https://hvx.kubeantony.com/api/v1/namespaces/...）
│
├──► grafana-reporter（:8686）──► Grafana（:80）──► Prometheus
│
└──► grafana-image-renderer（:8081）◄── Grafana（render 請求）&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Grafana Reporter&lt;/strong&gt;：接收使用者請求，透過 Grafana API 取得 Dashboard 資料與面板圖片，產生 PDF。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grafana Image Renderer&lt;/strong&gt;：Grafana 的圖片渲染服務，將面板渲染為 PNG 圖片供 Reporter 使用。&lt;/li&gt;
&lt;li&gt;所有元件都部署在 &lt;code&gt;cattle-monitoring-system&lt;/code&gt; namespace 內，透過 K8s 內部 Service 互連。&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;前置確認&lt;span class="hx:absolute hx:-mt-20" id="前置確認"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%8d%e7%bd%ae%e7%a2%ba%e8%aa%8d" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認 Grafana Service 名稱&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get svc -n cattle-monitoring-system &lt;span class="p"&gt;|&lt;/span&gt; grep grafana&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;記下 Grafana 的 Service 名稱（通常為 &lt;code&gt;rancher-monitoring-grafana&lt;/code&gt;），後續設定會用到。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;步驟一：部署 Grafana Reporter&lt;span class="hx:absolute hx:-mt-20" id="步驟一部署-grafana-reporter"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%80%e9%83%a8%e7%bd%b2-grafana-reporter" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;建立 &lt;code&gt;grafana-reporter.yaml&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;apps/v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Deployment&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;cattle-monitoring-system&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;replicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;izakmarais/grafana-reporter:latest&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/usr/local/bin/grafana-reporter&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="s2"&gt;&amp;#34;-ip&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="s2"&gt;&amp;#34;rancher-monitoring-grafana.cattle-monitoring-system.svc:80&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;containerPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8686&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Service&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;cattle-monitoring-system&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-reporter&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;http&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8686&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;targetPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8686&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;protocol&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;TCP&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ClusterIP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;部署：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl apply -f grafana-reporter.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認 Pod 狀態為 Running&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n cattle-monitoring-system &lt;span class="p"&gt;|&lt;/span&gt; grep reporter
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認 log 顯示正確連線 Grafana&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl logs -n cattle-monitoring-system -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;grafana-reporter&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期 log 輸出：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;serving at &amp;#39;:8686&amp;#39; and using grafana at &amp;#39;http://rancher-monitoring-grafana.cattle-monitoring-system.svc:80&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟二：部署 Grafana Image Renderer&lt;span class="hx:absolute hx:-mt-20" id="步驟二部署-grafana-image-renderer"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%8c%e9%83%a8%e7%bd%b2-grafana-image-renderer" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Rancher Monitoring Chart 的 &lt;code&gt;imageRenderer.enabled&lt;/code&gt; 有已知 template bug，因此採用&lt;strong&gt;手動獨立部署&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;建立 &lt;code&gt;image-renderer.yaml&lt;/code&gt;：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;apps/v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Deployment&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;cattle-monitoring-system&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;replicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana/grafana-image-renderer:latest&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;containerPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8081&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ENABLE_METRICS&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;v1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Service&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;cattle-monitoring-system&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;grafana-image-renderer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8081&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;targetPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8081&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ClusterIP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;部署：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl apply -f image-renderer.yaml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;驗證：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get pods -n cattle-monitoring-system &lt;span class="p"&gt;|&lt;/span&gt; grep image-renderer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;步驟三：設定 Grafana 連線 Image Renderer&lt;span class="hx:absolute hx:-mt-20" id="步驟三設定-grafana-連線-image-renderer"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%b8%89%e8%a8%ad%e5%ae%9a-grafana-%e9%80%a3%e7%b7%9a-image-renderer" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;重點：&lt;/strong&gt; 僅設定環境變數不夠，必須修改 &lt;code&gt;grafana.ini&lt;/code&gt; 設定檔，Grafana 才會識別 renderer。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;3-1. 編輯 Grafana ConfigMap&lt;span class="hx:absolute hx:-mt-20" id="3-1-編輯-grafana-configmap"&gt;&lt;/span&gt;
&lt;a href="#3-1-%e7%b7%a8%e8%bc%af-grafana-configmap" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl edit configmap rancher-monitoring-grafana -n cattle-monitoring-system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在 &lt;code&gt;grafana.ini&lt;/code&gt; 最末尾加入 &lt;code&gt;[rendering]&lt;/code&gt; 區塊：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-ini" data-lang="ini"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;[rendering]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;server_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;http://grafana-image-renderer.cattle-monitoring-system.svc:8081/render
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; callback_url = http://rancher-monitoring-grafana.cattle-monitoring-system.svc:80/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;完整的 &lt;code&gt;grafana.ini&lt;/code&gt; 範例：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-ini" data-lang="ini"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;[analytics]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;check_for_updates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [auth]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; disable_login_form = false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [auth.anonymous]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; enabled = true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; org_role = Viewer
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [auth.basic]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; enabled = false
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [dashboards]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; default_home_dashboard_path = /tmp/dashboards/rancher-default-home.json
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [grafana_net]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; url = https://grafana.net
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [log]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; mode = console
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [paths]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; data = /var/lib/grafana/
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; logs = /var/log/grafana
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; plugins = /var/lib/grafana/plugins
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; provisioning = /etc/grafana/provisioning
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [security]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; allow_embedding = true
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [server]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; domain = &amp;#39;&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [users]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; auto_assign_org_role = Viewer
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; [rendering]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; server_url = http://grafana-image-renderer.cattle-monitoring-system.svc:8081/render
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s"&gt; callback_url = http://rancher-monitoring-grafana.cattle-monitoring-system.svc:80/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3-2. 重啟 Grafana&lt;span class="hx:absolute hx:-mt-20" id="3-2-重啟-grafana"&gt;&lt;/span&gt;
&lt;a href="#3-2-%e9%87%8d%e5%95%9f-grafana" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl rollout restart deployment rancher-monitoring-grafana -n cattle-monitoring-system&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3-3. 驗證 Renderer 連線&lt;span class="hx:absolute hx:-mt-20" id="3-3-驗證-renderer-連線"&gt;&lt;/span&gt;
&lt;a href="#3-3-%e9%a9%97%e8%ad%89-renderer-%e9%80%a3%e7%b7%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 從 Grafana Pod 測試連線 renderer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; -n cattle-monitoring-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pods -n cattle-monitoring-system -l app.kubernetes.io/name&lt;span class="o"&gt;=&lt;/span&gt;grafana &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -- curl -s http://grafana-image-renderer.cattle-monitoring-system.svc:8081/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;預期回應：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Grafana Image Renderer (Go)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;也可以在 Grafana UI 中驗證：&lt;strong&gt;Administration → Plugins → 搜尋 &amp;ldquo;Image Renderer&amp;rdquo;&lt;/strong&gt;，應顯示為 remote rendering service。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;步驟四：測試 Rancher Proxy 存取 Reporter&lt;span class="hx:absolute hx:-mt-20" id="步驟四測試-rancher-proxy-存取-reporter"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e5%9b%9b%e6%b8%ac%e8%a9%a6-rancher-proxy-%e5%ad%98%e5%8f%96-reporter" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在瀏覽器中打開以下 URL（將 &lt;code&gt;&amp;lt;DASHBOARD_UID&amp;gt;&lt;/code&gt; 替換為實際的 Dashboard UID）：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://hvx.kubeantony.com/api/v1/namespaces/cattle-monitoring-system/services/http:grafana-reporter:8686/proxy/api/v5/report/&amp;lt;DASHBOARD_UID&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果能下載 PDF 且包含圖表，代表全部設定正確。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;步驟五：設定 Grafana Dashboard Link&lt;span class="hx:absolute hx:-mt-20" id="步驟五設定-grafana-dashboard-link"&gt;&lt;/span&gt;
&lt;a href="#%e6%ad%a5%e9%a9%9f%e4%ba%94%e8%a8%ad%e5%ae%9a-grafana-dashboard-link" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;進入目標 Dashboard&lt;/li&gt;
&lt;li&gt;點右上角 &lt;strong&gt;齒輪圖示&lt;/strong&gt;（Dashboard Settings）&lt;/li&gt;
&lt;li&gt;點左側 &lt;strong&gt;Links&lt;/strong&gt; 頁籤&lt;/li&gt;
&lt;li&gt;點 &lt;strong&gt;+ New link&lt;/strong&gt;，填入以下設定：&lt;/li&gt;
&lt;/ol&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;欄位&lt;/th&gt;
&lt;th&gt;值&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Type&lt;/td&gt;
&lt;td&gt;link&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title&lt;/td&gt;
&lt;td&gt;reports&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;URL&lt;/td&gt;
&lt;td&gt;見下方&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Icon&lt;/td&gt;
&lt;td&gt;doc&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open in new tab&lt;/td&gt;
&lt;td&gt;✅ 打勾&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;URL 設定：&lt;/strong&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://hvx.kubeantony.com/api/v1/namespaces/cattle-monitoring-system/services/http:grafana-reporter:8686/proxy/api/v5/report/${__dashboard.uid}?from=${__from}&amp;amp;to=${__to}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果 Dashboard 有使用變數（如 datasource、instance），可以加上：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://hvx.kubeantony.com/api/v1/namespaces/cattle-monitoring-system/services/http:grafana-reporter:8686/proxy/api/v5/report/${__dashboard.uid}?from=${__from}&amp;amp;to=${__to}&amp;amp;var-datasource=${datasource}&amp;amp;var-instance=${instance}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;點 &lt;strong&gt;Save dashboard&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;設定完成後，Dashboard 右上方會出現 &lt;strong&gt;reports&lt;/strong&gt; 連結，點擊即可在新分頁下載 PDF 報表。&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;疑難排解&lt;span class="hx:absolute hx:-mt-20" id="疑難排解"&gt;&lt;/span&gt;
&lt;a href="#%e7%96%91%e9%9b%a3%e6%8e%92%e8%a7%a3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;PDF 產生但沒有圖表&lt;span class="hx:absolute hx:-mt-20" id="pdf-產生但沒有圖表"&gt;&lt;/span&gt;
&lt;a href="#pdf-%e7%94%a2%e7%94%9f%e4%bd%86%e6%b2%92%e6%9c%89%e5%9c%96%e8%a1%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 檢查 Grafana log 是否有 renderer 錯誤&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl logs -n cattle-monitoring-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pods -n cattle-monitoring-system -l app.kubernetes.io/name&lt;span class="o"&gt;=&lt;/span&gt;grafana &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -c grafana --tail&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;50&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; grep rendering&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;如果看到 &lt;code&gt;no image renderer found/installed&lt;/code&gt;，代表 &lt;code&gt;grafana.ini&lt;/code&gt; 的 &lt;code&gt;[rendering]&lt;/code&gt; 設定未生效，請重新確認 ConfigMap 並重啟 Grafana。&lt;/p&gt;
&lt;h3&gt;Reporter 無法連線 Grafana&lt;span class="hx:absolute hx:-mt-20" id="reporter-無法連線-grafana"&gt;&lt;/span&gt;
&lt;a href="#reporter-%e7%84%a1%e6%b3%95%e9%80%a3%e7%b7%9a-grafana" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 確認 Grafana Service 存在且可連線&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; -n cattle-monitoring-system &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;$(&lt;/span&gt;kubectl get pods -n cattle-monitoring-system -l &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;grafana-reporter &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -o &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;{.items[0].metadata.name}&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -- wget -qO- http://rancher-monitoring-grafana.cattle-monitoring-system.svc:80/api/health&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;Rancher Proxy 回傳 404&lt;span class="hx:absolute hx:-mt-20" id="rancher-proxy-回傳-404"&gt;&lt;/span&gt;
&lt;a href="#rancher-proxy-%e5%9b%9e%e5%82%b3-404" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;確認 Service 已正確建立：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;kubectl get svc -n cattle-monitoring-system grafana-reporter&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Rancher Proxy URL 格式必須完全正確：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://&amp;lt;rancher域名&amp;gt;/api/v1/namespaces/&amp;lt;namespace&amp;gt;/services/http:&amp;lt;service名稱&amp;gt;:&amp;lt;port&amp;gt;/proxy/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;注意事項&lt;span class="hx:absolute hx:-mt-20" id="注意事項"&gt;&lt;/span&gt;
&lt;a href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;透過 &lt;code&gt;kubectl edit&lt;/code&gt; 修改的 ConfigMap 和 Deployment，在下次 Rancher Monitoring Helm Chart 升級時&lt;strong&gt;可能被覆蓋&lt;/strong&gt;。升級後需重新確認 &lt;code&gt;[rendering]&lt;/code&gt; 設定是否仍存在。&lt;/li&gt;
&lt;li&gt;Image Renderer 和 Reporter 是獨立部署的，不受 Helm Chart 升級影響。&lt;/li&gt;
&lt;li&gt;如果未來 Rancher 修復了 &lt;code&gt;image-renderer-deployment.yaml&lt;/code&gt; 的 template bug，可以改回透過 Helm values 啟用 &lt;code&gt;grafana.imageRenderer.enabled: true&lt;/code&gt;，屆時可移除手動部署的 image-renderer。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Install Minio with Rancher Application Collection</title><link>https://blog.kubeantony.com/archive/rancher/install-minio-with-rancher-application-collection/</link><pubDate>Mon, 09 Mar 2026 07:40:36 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/install-minio-with-rancher-application-collection/</guid><description>
&lt;h2&gt;Prepare&lt;span class="hx:absolute hx:-mt-20" id="prepare"&gt;&lt;/span&gt;
&lt;a href="#prepare" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;helm login Rancher Application Collection&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm registry login dp.apps.rancher.io \
-u &amp;lt;user&amp;gt; \
-p &amp;lt;password&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;download helm chart&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm pull oci://dp.apps.rancher.io/charts/minio --version 5.4.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create Namespace&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create ns minio&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Image Pull Secret&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n minio create secret docker-registry application-collection \
--docker-server=dp.apps.rancher.io \
--docker-username=&amp;lt;user&amp;gt; \
--docker-password=&amp;lt;password&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認已安裝 Ingress Controller 和 StorageClass (本篇文章用的是 Nginx 和 local-path)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;確認當前 K8s 叢集的 Ingress Controller&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get ingressclasses.networking.k8s.io&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CONTROLLER PARAMETERS AGE
nginx k8s.io/ingress-nginx &amp;lt;none&amp;gt; 7d&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認當前 K8s 叢集的 StorageClass&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get sc local-path&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 6d3h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認已安裝 Cert-manager&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cert-manager get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cert-manager-578bff8c75-ms6hw 1/1 Running 0 41m
cert-manager-cainjector-566b8f9766-pxnlb 1/1 Running 0 41m
cert-manager-webhook-c9997c6b5-94fsj 1/1 Running 0 41m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Deploy&lt;span class="hx:absolute hx:-mt-20" id="deploy"&gt;&lt;/span&gt;
&lt;a href="#deploy" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;解壓縮 minio chart&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf minio-5.4.0.tgz; cd minio&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;定義 MinIO 自簽憑證的簽發架構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir cert-manager/; vim minio-pki-bootstrap.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned-issuer
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: selfsigned-ca
namespace: minio
spec:
isCA: true
commonName: selfsigned-ca
secretName: root-secret
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: selfsigned-issuer
kind: ClusterIssuer
group: cert-manager.io
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: ca-issuer
namespace: minio
spec:
ca:
secretName: root-secret&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;檔案包含三個資源：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ClusterIssuer&lt;/code&gt;（自簽發行者）&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Certificate&lt;/code&gt;（作為 Root CA 的自簽憑證，使用 ECDSA P-256 演算法，並將私鑰跟憑證都存入 Secret &lt;code&gt;root-secret&lt;/code&gt;）&lt;/li&gt;
&lt;li&gt;以及 &lt;code&gt;Issuer&lt;/code&gt;（引用該 Root CA 來簽發後續憑證）&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將上述資源套用至叢集，Cert-manager 會自動產生 Root CA 憑證與私鑰，並建立可用於 &lt;code&gt;minio&lt;/code&gt; namespace 中後續憑證簽發的 CA Issuer。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f cert-manager/minio-pki-bootstrap.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 minio &lt;code&gt;values.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;vim custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;global:
imagePullSecrets:
- application-collection
mode: standalone
persistence:
size: 5Gi
resources:
requests:
memory: 512Mi
rootPassword: admin123
rootUser: admin
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: &amp;#34;0&amp;#34;
cert-manager.io/issuer: ca-issuer
path: /
hosts:
- api.minio.kubeantony.com
tls:
- secretName: minio-api-tls
hosts:
- api.minio.kubeantony.com
consoleIngress:
enabled: true
ingressClassName: nginx
annotations:
cert-manager.io/issuer: ca-issuer
path: /
hosts:
- console.minio.kubeantony.com
tls:
- secretName: minio-console-tls
hosts:
- console.minio.kubeantony.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 Minio&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm -n minio upgrade --install minio . -f custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Release &amp;#34;minio&amp;#34; has been upgraded. Happy Helming!
NAME: minio
LAST DEPLOYED: Mon Mar 9 14:40:55 2026
NAMESPACE: minio
STATUS: deployed
REVISION: 9
TEST SUITE: None
NOTES:
MinIO can be accessed via port 9000 on the following DNS name from within your cluster:
minio.minio.cluster.local
To access MinIO from localhost, run the below commands:
1. export POD_NAME=$(kubectl get pods --namespace minio -l &amp;#34;release=minio&amp;#34; -o jsonpath=&amp;#34;{.items[0].metadata.name}&amp;#34;)
2. kubectl port-forward $POD_NAME 9000 --namespace minio
Read more about port forwarding here: http://kubernetes.io/docs/user-guide/kubectl/kubectl_port-forward/
You can now access MinIO server on http://localhost:9000. Follow the below steps to connect to MinIO server with mc client:
1. Download the MinIO mc client - https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart
2. export MC_HOST_minio-local=http://$(kubectl get secret --namespace minio minio -o jsonpath=&amp;#34;{.data.rootUser}&amp;#34; | base64 --decode):$(kubectl get secret --namespace minio minio -o jsonpath=&amp;#34;{.data.rootPassword}&amp;#34; | base64 --decode)@localhost:9000
3. mc ls minio-local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Minio Pods 有正常運作&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n minio get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
minio-7f67bcc94c-7hcc5 1/1 Running 0 3h58m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查看 Ingress&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n minio get ing&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CLASS HOSTS ADDRESS PORTS AGE
minio nginx api.minio.kubeantony.com 192.168.11.154,192.168.11.155,192.168.11.156 80, 443 3h52m
minio-console nginx console.minio.kubeantony.com 192.168.11.154,192.168.11.155,192.168.11.156 80, 443 3h29m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;打開瀏覽器，連線至 Minio 管理網站&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://console.minio.kubeantony.com/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;確認打開瀏覽器的電腦能透過 DNS 解析 Minio FQDN 的 IP&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/SkKuYgnYZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Podman Deploy Neuvector AllInOne</title><link>https://blog.kubeantony.com/archive/container/podman-deploy-neuvector-allinone/</link><pubDate>Wed, 04 Mar 2026 15:58:24 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/podman-deploy-neuvector-allinone/</guid><description>
&lt;h2&gt;Deploy allinone (NO privileged mode) with podman&lt;span class="hx:absolute hx:-mt-20" id="deploy-allinone-no-privileged-mode-with-podman"&gt;&lt;/span&gt;
&lt;a href="#deploy-allinone-no-privileged-mode-with-podman" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 準備環境&lt;span class="hx:absolute hx:-mt-20" id="1-準備環境"&gt;&lt;/span&gt;
&lt;a href="#1-%e6%ba%96%e5%82%99%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;建立 NeuVector 用於持久化儲存設定檔的目錄
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir /var/neuvector&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;設定開機自動啟動並立即啟動 Podman socket
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now podman.socket&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;建立一個 systemd 服務，將 Podman 的 socket 軟連結到傳統 Docker 的 socket 路徑，這是為了讓需要和 Docker API 互動的應用程式 (如此處的 NeuVector) 能無縫地與 Podman 運作
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tee /etc/systemd/system/podman-docker-symlink.service &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
[Unit]
Description=Create symlink from docker.sock to podman.sock
After=podman.socket
[Service]
Type=oneshot
ExecStart=/bin/ln -sf /run/podman/podman.sock /var/run/docker.sock
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;設定開機自動啟動並立即啟動建立 symlink 的服務
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now podman-docker-symlink.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2. 建立 NeuVector 內部元件 (Controller, Enforcer, Scanner) 之間加密通訊所需的 TLS 憑證&lt;span class="hx:absolute hx:-mt-20" id="2-建立-neuvector-內部元件-controller-enforcer-scanner-之間加密通訊所需的-tls-憑證"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%bb%ba%e7%ab%8b-neuvector-%e5%85%a7%e9%83%a8%e5%85%83%e4%bb%b6-controller-enforcer-scanner-%e4%b9%8b%e9%96%93%e5%8a%a0%e5%af%86%e9%80%9a%e8%a8%8a%e6%89%80%e9%9c%80%e7%9a%84-tls-%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;建立存放憑證的目錄，並進入該目錄
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/neuvector/certs/internal; cd /etc/neuvector/certs/internal&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;建立 OpenSSL 設定檔，用於定義憑證的內容 (如國家、組織、SANs 等)
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tee /etc/neuvector/certs/internal/ca.cfg &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = TW
ST = Taipei
L = San Jose
O = NeuVector Inc.
OU = Neuvector
CN = Neuvector
[v3_req]
keyUsage = digitalSignature, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth, clientAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = Neuvector
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;產生 CA (憑證頒發機構) 的私鑰
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl genrsa -out ca.key 2048&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;使用 CA 私鑰產生 CA 的根憑證
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl req -x509 -sha256 -new -nodes -key ca.key -days 3650 -subj &amp;#34;/C=TW/ST=Taipei/L=Taipei/O=NeuVector Inc./OU=Neuvector/CN=Neuvector&amp;#34; -out ca.cert&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;產生給服務使用的私鑰
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl genrsa -out cert.key 2048&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;產生憑證簽署請求 (CSR)
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl req -new -key cert.key -sha256 -out cert.csr -config ca.cfg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;使用 CA 簽署 CSR，產生最終給服務使用的憑證
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl x509 -req -sha256 -in cert.csr -CA ca.cert -CAkey ca.key -CAcreateserial -out cert.pem -days 3650 -extensions &amp;#39;v3_req&amp;#39; -extfile ca.cfg &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3. 啟動 NeuVector App Container&lt;span class="hx:absolute hx:-mt-20" id="3-啟動-neuvector-app-container"&gt;&lt;/span&gt;
&lt;a href="#3-%e5%95%9f%e5%8b%95-neuvector-app-container" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;動態獲取主機指定網路介面 (此處為 ens18) 的 IP 位址，並存入變數 &lt;code&gt;IP&lt;/code&gt;，這個 IP 將用來告訴 NeuVector 元件如何互相連線&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NIC=&amp;#39;ens18&amp;#39; &amp;amp;&amp;amp; \
IP=$(ip -4 -o addr show ${NIC} | awk &amp;#39;{print $4}&amp;#39; | cut -d/ -f1)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 NeuVector 的 All-in-One main container (包含 Controller, Enforcer, Manager)&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d --name allinone \
--pid=host \
--cap-add=SYS_ADMIN \
--cap-add=NET_ADMIN \
--cap-add=SYS_PTRACE \
--cap-add=IPC_LOCK \
--security-opt label=disable \
--security-opt apparmor=unconfined \
--security-opt seccomp=unconfined \
-e CLUSTER_JOIN_ADDR=${IP} \
-e NV_PLATFORM_INFO=platform=Docker \
-e CTRL_PERSIST_CONFIG=1 \
-p 18300:18300 \
-p 18301:18301 \
-p 18400:18400 \
-p 18401:18401 \
-p 18301:18301/udp \
-p 8443:8443 \
-v /lib/modules:/lib/modules:ro \
-v /var/neuvector:/var/neuvector \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /sys/fs/cgroup:/host/cgroup:ro \
-v /proc:/host/proc:ro \
-v /etc/neuvector/certs/internal:/etc/neuvector/certs/internal/:ro \
docker.io/neuvector/allinone:5.4.9&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--pid=host, --cap-add=...&lt;/code&gt; 等參數是為了賦予 container 足夠的權限來監控主機的程序與網路活動&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-e CLUSTER_JOIN_ADDR=${IP}&lt;/code&gt; 設定叢集加入位址&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-v 掛載主機路徑&lt;/code&gt;，讓 container 能存取 Docker socket、主機核心模組、cgroup 及程序資訊，並持久化設定與讀取憑證&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 NeuVector 的 Scanner container，專門用於執行映像檔弱點掃描，它會透過 &lt;code&gt;CLUSTER_JOIN_ADDR&lt;/code&gt; 連接到 All-in-One Neuvector Controller&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -td --name scanner \
-e CLUSTER_JOIN_ADDR=${IP} \
-e NV_PLATFORM_INFO=platform=Docker \
-p 18402:18402 \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /etc/neuvector/certs/internal:/etc/neuvector/certs/internal/:ro \
docker.io/neuvector/scanner:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;4. 設定 Neuvector Allinone container 開機自動啟動&lt;span class="hx:absolute hx:-mt-20" id="4-設定-neuvector-allinone-container-開機自動啟動"&gt;&lt;/span&gt;
&lt;a href="#4-%e8%a8%ad%e5%ae%9a-neuvector-allinone-container-%e9%96%8b%e6%a9%9f%e8%87%aa%e5%8b%95%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立環境變數檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/neuvector
sudo tee /etc/neuvector/allinone.env &amp;gt;/dev/null &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
# 請把下行改成你的 IP
CLUSTER_JOIN_ADDR=192.168.11.131
NV_PLATFORM_INFO=platform=Docker
CTRL_PERSIST_CONFIG=1
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Quadlet &lt;code&gt;.container&lt;/code&gt; 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nano /etc/containers/systemd/allinone.container&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;設定內容如下 ：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;注意，&lt;code&gt;CLUSTER_JOIN_ADDR&lt;/code&gt; 的值需依照環境而設定&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[Unit]
Description=NeuVector All-in-One (via Podman Quadlet)
Wants=network-online.target
After=network-online.target
RequiresMountsFor=/var/neuvector /lib/modules /etc/neuvector/certs/internal
[Container]
Image=docker.io/neuvector/allinone:5.4.9
ContainerName=allinone
PodmanArgs=--pid=host --security-opt apparmor=unconfined
AddCapability=SYS_ADMIN
AddCapability=NET_ADMIN
AddCapability=SYS_PTRACE
AddCapability=IPC_LOCK
# 環境變數
EnvironmentFile=/etc/neuvector/allinone.env
# Port 對應（含 UDP）
PublishPort=18300:18300
PublishPort=18301:18301
PublishPort=18400:18400
PublishPort=18401:18401
PublishPort=18301:18301/udp
PublishPort=8443:8443
# Volume 對應
Volume=/lib/modules:/lib/modules:ro
Volume=/var/neuvector:/var/neuvector
Volume=/var/run/docker.sock:/var/run/docker.sock:ro
Volume=/sys/fs/cgroup:/host/cgroup:ro
Volume=/proc:/host/proc:ro
Volume=/etc/neuvector/certs/internal:/etc/neuvector/certs/internal:ro
# 若希望啟動時一定拉一次映像檔，可取消註解
# Pull=always
[Service]
Restart=always
RestartSec=5s
TimeoutStartSec=600
[Install]
WantedBy=multi-user.target&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重載 systemd daemon：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟用並立即啟動服務：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl start allinone.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果噴錯代表 podman Quadlet 的設定檔有寫錯，請執行以下命令確認設定檔哪裡有錯
&lt;code&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查 systemd 服務狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;systemctl status allinone.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● allinone.service - NeuVector All-in-One (via Podman Quadlet)
Loaded: loaded (/etc/containers/systemd/allinone.container; generated)
Active: active (running) since Fri 2025-08-15 17:30:42 CST; 9min ago
Main PID: 3957 (conmon)
Tasks: 83 (limit: 50507)
Memory: 897.2M
CPU: 13.760s
...以下省略&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 podman 確認容器狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps -a --filter &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;allinone&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7963890f525a docker.io/neuvector/allinone:5.4.9 40 seconds ago Up 41 seconds 0.0.0.0:8443-&amp;gt;8443/tcp, 0.0.0.0:10443-&amp;gt;10443/tcp, 0.0.0.0:18300-18301-&amp;gt;18300-18301/tcp, 0.0.0.0:18400-18401-&amp;gt;18400-18401/tcp, 0.0.0.0:18301-&amp;gt;18301/udp allinone&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;5. 設定 Neuvector scanner container 開機自動啟動&lt;span class="hx:absolute hx:-mt-20" id="5-設定-neuvector-scanner-container-開機自動啟動"&gt;&lt;/span&gt;
&lt;a href="#5-%e8%a8%ad%e5%ae%9a-neuvector-scanner-container-%e9%96%8b%e6%a9%9f%e8%87%aa%e5%8b%95%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立環境變數檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tee /etc/neuvector/scanner.env &amp;gt;/dev/null &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
# 請把下行改成你的 IP
CLUSTER_JOIN_ADDR=192.168.11.131
NV_PLATFORM_INFO=platform=Docker
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Quadlet &lt;code&gt;.container&lt;/code&gt; 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nano /etc/containers/systemd/scanner.container&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;設定內容如下 ：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;注意，&lt;code&gt;CLUSTER_JOIN_ADDR&lt;/code&gt; 的值需依照環境而設定&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# /etc/containers/systemd/scanner.container
[Unit]
Description=NeuVector Scanner (via Podman Quadlet)
Wants=network-online.target
After=network-online.target
[Container]
ContainerName=scanner
Image=docker.io/neuvector/scanner:latest
EnvironmentFile=/etc/neuvector/scanner.env
PublishPort=18402:18402
Volume=/var/run/docker.sock:/var/run/docker.sock:ro
Volume=/etc/neuvector/certs/internal:/etc/neuvector/certs/internal:ro
[Install]
WantedBy=multi-user.target&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重載 systemd daemon：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟用並立即啟動服務：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl start scanner.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果噴錯代表 podman Quadlet 的設定檔有寫錯，請執行以下命令確認設定檔哪裡有錯&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查 systemd 服務狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status scanner.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● scanner.service - NeuVector Scanner (via Podman Quadlet)
Loaded: loaded (/etc/containers/systemd/scanner.container; generated)
Active: active (running) since Fri 2025-08-15 17:56:43 CST; 6min ago
Main PID: 4564 (conmon)
Tasks: 12 (limit: 50507)
Memory: 1.8G
CPU: 20.587s
...以下省略&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 podman 確認 container 狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps -a --filter &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;scanner&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b4fede8ec2ac docker.io/neuvector/scanner:latest 8 minutes ago Up 8 minutes 0.0.0.0:18402-&amp;gt;18402/tcp scanner&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;6. 重新開機測試&lt;span class="hx:absolute hx:-mt-20" id="6-重新開機測試"&gt;&lt;/span&gt;
&lt;a href="#6-%e9%87%8d%e6%96%b0%e9%96%8b%e6%a9%9f%e6%b8%ac%e8%a9%a6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;將主機重開
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;開機後，檢查 container 狀態
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a --filter name=scanner --filter name=allinone&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
正確執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
78a475cb15a3 docker.io/neuvector/scanner:latest 25 seconds ago Up 26 seconds 0.0.0.0:18402-&amp;gt;18402/tcp scanner
10bd318a7f4a docker.io/neuvector/allinone:5.4.9 25 seconds ago Up 26 seconds 0.0.0.0:18301-&amp;gt;18301/udp, 0.0.0.0:8443-&amp;gt;8443/tcp, 0.0.0.0:10443-&amp;gt;10443/tcp, 0.0.0.0:18300-18301-&amp;gt;18300-18301/tcp, 0.0.0.0:18400-18401-&amp;gt;18400-18401/tcp allinone&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;打開瀏覽器，確認 Neuvector Web Console 是否正常
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkHwvK2_ll.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;登入管理網站
&lt;ul&gt;
&lt;li&gt;帳號 : &lt;code&gt;admin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;密碼 : &lt;code&gt;admin&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1e6wF2ueg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;7. 暴露 Neuvector Metrics&lt;span class="hx:absolute hx:-mt-20" id="7-暴露-neuvector-metrics"&gt;&lt;/span&gt;
&lt;a href="#7-%e6%9a%b4%e9%9c%b2-neuvector-metrics" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 Podman Secret 儲存 admin 帳號的密碼&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;printf &amp;#39;admin&amp;#39; | sudo podman secret create neuvector_pass -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 Neuvector Exporter Container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d \
--name neuvector.prometheus-exporter \
--user 1000:1000 \
-e CTRL_API_SERVICE=192.168.11.131:10443 \
-e CTRL_USERNAME=admin \
--secret neuvector_pass,type=env,target=CTRL_PASSWORD \
-e EXPORTER_PORT=8068 \
--cap-drop=ALL \
--security-opt no-new-privileges:true \
--read-only \
registry.rancher.com/rancher/neuvector-prometheus-exporter:1.0.9&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Container 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a --filter name=neuvector.prometheus-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6acc80576905 registry.rancher.com/rancher/neuvector-prometheus-exporter:1.0.9 7 minutes ago Up 7 minutes neuvector.prometheus-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲取 Container IP&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman inspect neuvector.prometheus-exporter --format &amp;#39;{{.NetworkSettings.IPAddress}}&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;10.88.0.19&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試是否可得到 Metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -s http://10.88.0.19:8068/ | head -n 5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation=&amp;#34;0&amp;#34;} 368.0
python_gc_objects_collected_total{generation=&amp;#34;1&amp;#34;} 0.0
python_gc_objects_collected_total{generation=&amp;#34;2&amp;#34;} 0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Quadlet &lt;code&gt;.container&lt;/code&gt; 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nano /etc/containers/systemd/neuvector-prometheus-exporter.container&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;設定內容如下 ：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;注意，&lt;code&gt;CTRL_API_SERVICE&lt;/code&gt; 的值需依照環境而設定
&lt;font color=red&gt;如果無 TLS 的需求，可將 &lt;code&gt;PublishPort&lt;/code&gt; 取消註解並跳過第 11 步驟之後的所有步驟。&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[Unit]
Description=NeuVector Prometheus Exporter
After=network-online.target
Wants=network-online.target
[Container]
ContainerName=neuvector.prometheus-exporter
Image=registry.rancher.com/rancher/neuvector-prometheus-exporter:1.0.9
User=1000
Group=1000
# Environment
Environment=CTRL_API_SERVICE=192.168.11.131:10443
Environment=CTRL_USERNAME=admin
Environment=EXPORTER_PORT=8068
# Secret (must be pre-created)
Secret=neuvector_pass,type=env,target=CTRL_PASSWORD
# Security hardening
DropCapability=ALL
SecurityLabelNested=true
NoNewPrivileges=true
ReadOnly=true
# Publish port if external access is needed (uncomment to enable)
# PublishPort=8068:8068
[Service]
Restart=on-failure
TimeoutStartSec=300
[Install]
WantedBy=default.target&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重載 systemd daemon：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟用並立即啟動服務：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl start neuvector-prometheus-exporter.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果噴錯代表 podman Quadlet 的設定檔有寫錯，請執行以下命令確認設定檔哪裡有錯&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查 systemd 服務狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status neuvector-prometheus-exporter.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● neuvector-prometheus-exporter.service - NeuVector Prometheus Exporter
Loaded: loaded (/etc/containers/systemd/neuvector-prometheus-exporter.container; generated)
Active: active (running) since Wed 2026-03-04 21:32:32 CST; 18min ago
Main PID: 7980 (conmon)
Tasks: 4 (limit: 50507)
Memory: 23.6M
CPU: 387ms
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 podman 確認 container 狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps -a --filter &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;neuvector.prometheus-exporter&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6acc80576905 registry.rancher.com/rancher/neuvector-prometheus-exporter:1.0.9 19 minutes ago Up 19 minutes neuvector.prometheus-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;請參考以下 Git repo 的 README 做出 TLS 自簽憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://github.com/braveantony/mkcert.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立目錄，並拷貝憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/nginx/
cp mkcert/kubeantony.com/kubeantony.com.crt ${HOME}/nginx/server.crt
cp mkcert/kubeantony.com/kubeantony.com.key ${HOME}/nginx/server.key
chmod 644 ${HOME}/nginx/server.key
ls -lZ ${HOME}/nginx/server.*&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;-rw-r--r--. 1 bigred bigred system_u:object_r:container_file_t:s0:c948,c1020 2167 Mar 4 22:39 /home/bigred/nginx/server.crt
-rw-r--r--. 1 bigred bigred system_u:object_r:container_file_t:s0:c948,c1020 3272 Mar 4 22:39 /home/bigred/nginx/server.key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意 &lt;code&gt;server.key&lt;/code&gt; 權限要設為 &lt;code&gt;644&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 &lt;code&gt;nginx.conf&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano ${HOME}/nginx/nginx.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;server_name&lt;/code&gt; 請依序環境設定，記得在環境中的 DNS Server 將之添加為 A Record&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;error_log /dev/stderr warn;
worker_processes 4;
worker_rlimit_nofile 40000;
pid /var/run/nginx.pid;
events {
worker_connections 8192;
}
http {
access_log /dev/stdout;
server_tokens off;
add_header X-Content-Type-Options &amp;#34;nosniff&amp;#34; always;
add_header X-Frame-Options &amp;#34;DENY&amp;#34; always;
add_header X-XSS-Protection &amp;#34;1; mode=block&amp;#34; always;
add_header Referrer-Policy &amp;#34;strict-origin-when-cross-origin&amp;#34; always;
client_max_body_size 1m;
client_body_timeout 10s;
client_header_timeout 10s;
send_timeout 10s;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_session_tickets off;
ssl_prefer_server_ciphers on;
# 預設拒絕未匹配的 Host
server {
listen 8443 ssl default_server;
server_name _;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
return 444;
}
server {
listen 8443 ssl;
server_name aionv-metrics.kubeantony.com;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
# add_header Strict-Transport-Security &amp;#34;max-age=31536000; includeSubDomains&amp;#34; always;
location / {
proxy_pass http://neuvector.prometheus-exporter:8068;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90s;
proxy_connect_timeout 10s;
proxy_send_timeout 10s;
proxy_hide_header X-Powered-By;
}
location ~* ^/(\.env|\.git|wp-admin|phpMyAdmin) {
return 444;
}
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 Podman Default Network 啟用 DNS&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#39;/dns_enabled/s/false/true/&amp;#39; /etc/containers/networks/podman.json
sudo podman network reload --all&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Nginx Container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d --name nginx -p 8068:8443 \
--read-only \
--mount type=tmpfs,destination=/tmp,tmpfs-size=10M,tmpfs-mode=1777,U=true \
--mount type=tmpfs,destination=/var/cache/nginx,tmpfs-size=50M,U=true \
--mount type=tmpfs,destination=/var/run,tmpfs-size=10M,U=true \
--mount type=tmpfs,destination=/var/log/nginx,tmpfs-size=10M,U=true \
--mount type=tmpfs,destination=/var/lib/nginx,tmpfs-size=50M,U=true \
--user $(id -u):$(id -g) \
--cap-drop ALL \
--security-opt no-new-privileges:true \
--pids-limit 100 \
--restart unless-stopped \
-v ${HOME}/nginx/nginx.conf:/etc/nginx/nginx.conf:ro,Z \
-v ${HOME}/nginx/server.crt:/etc/nginx/ssl/server.crt:ro,Z \
-v ${HOME}/nginx/server.key:/etc/nginx/ssl/server.key:ro,Z \
registry.suse.com/suse/nginx:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 Container 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a --filter name=nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
041b60ecbc36 registry.suse.com/suse/nginx:latest nginx -g daemon o... 7 seconds ago Up 7 seconds 0.0.0.0:8068-&amp;gt;8443/tcp, 80/tcp nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證是否成功能透過 TLS 存取 Neuvector Metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sk https://aionv-metrics.kubeantony.com:8068/ | head -n 5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation=&amp;#34;0&amp;#34;} 368.0
python_gc_objects_collected_total{generation=&amp;#34;1&amp;#34;} 0.0
python_gc_objects_collected_total{generation=&amp;#34;2&amp;#34;} 0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Quadlet &lt;code&gt;.container&lt;/code&gt; 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 定義變數&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CONTAINER_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;nginx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;IMAGE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;registry.suse.com/suse/nginx:latest&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;HOST_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;8068&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;CONTAINER_PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;8443&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;NGINX_CONF_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/nginx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;QUADLET_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;/etc/containers/systemd/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 建立目錄&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;QUADLET_DIR&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;設定內容如下 ：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tee &amp;#34;${QUADLET_DIR}/${CONTAINER_NAME}.container&amp;#34; &amp;gt; /dev/null &amp;lt;&amp;lt;EOF
[Unit]
Description=Nginx Reverse Proxy (Hardened)
After=network-online.target
Wants=network-online.target
[Container]
ContainerName=${CONTAINER_NAME}
Image=${IMAGE}
PublishPort=${HOST_PORT}:${CONTAINER_PORT}
ReadOnly=true
UserNS=keep-id
DropCapability=ALL
SecurityLabelDisable=false
PidsLimit=100
NoNewPrivileges=true
User=$(id -u):$(id -g)
Mount=type=tmpfs,destination=/tmp,tmpfs-size=10M,tmpfs-mode=1777,U=true
Mount=type=tmpfs,destination=/var/cache/nginx,tmpfs-size=50M,U=true
Mount=type=tmpfs,destination=/var/run,tmpfs-size=10M,U=true
Mount=type=tmpfs,destination=/var/log/nginx,tmpfs-size=10M,U=true
Mount=type=tmpfs,destination=/var/lib/nginx,tmpfs-size=50M,U=true
Volume=${NGINX_CONF_DIR}/nginx.conf:/etc/nginx/nginx.conf:ro,Z
Volume=${NGINX_CONF_DIR}/server.crt:/etc/nginx/ssl/server.crt:ro,Z
Volume=${NGINX_CONF_DIR}/server.key:/etc/nginx/ssl/server.key:ro,Z
[Service]
Restart=always
TimeoutStartSec=30
[Install]
WantedBy=default.target
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重載 systemd daemon：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟用並立即啟動服務：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl start nginx.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果噴錯代表 podman Quadlet 的設定檔有寫錯，請執行以下命令確認設定檔哪裡有錯&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo /usr/libexec/podman/quadlet -dryrun&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查 systemd 服務狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status nginx.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● nginx.service - Nginx Reverse Proxy (Hardened)
Loaded: loaded (/etc/containers/systemd/nginx.container; generated)
Active: active (running) since Wed 2026-03-04 23:27:42 CST; 33s ago
Main PID: 296160 (conmon)
Tasks: 6 (limit: 50507)
Memory: 17.2M
CPU: 107ms
...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 podman 確認 container 狀態：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo podman ps -a --filter &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nginx&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dde5bc3186e8 registry.suse.com/suse/nginx:latest nginx -g daemon o... About a minute ago Up About a minute 0.0.0.0:8068-&amp;gt;8443/tcp, 80/tcp nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;再次測試是否可得到 Metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sk https://aionv-metrics.kubeantony.com:8068/ | head -n 5&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation=&amp;#34;0&amp;#34;} 368.0
python_gc_objects_collected_total{generation=&amp;#34;1&amp;#34;} 0.0
python_gc_objects_collected_total{generation=&amp;#34;2&amp;#34;} 0.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;參考網站&lt;span class="hx:absolute hx:-mt-20" id="參考網站"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e7%b6%b2%e7%ab%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://documentation.suse.com/cloudnative/security/5.4/en/docker.html#_deploy_allinone_no_privileged_mode_with_docker_run"target="_blank" rel="noopener"&gt;Deploy allinone (NO privileged mode) with docker run - SUSE Security Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://hackmd.io/@7vxmAdNPTmmlYGSRMuvbmw/SJ4nTdzRC"target="_blank" rel="noopener"&gt;安裝 Neuvector all-in-one (Docker、Podman)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Install Prometheus with Rancher Application Collection</title><link>https://blog.kubeantony.com/archive/rancher/install-prometheus-with-rancher-application-collection/</link><pubDate>Wed, 04 Mar 2026 06:29:22 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/install-prometheus-with-rancher-application-collection/</guid><description>
&lt;h2&gt;Prepare&lt;span class="hx:absolute hx:-mt-20" id="prepare"&gt;&lt;/span&gt;
&lt;a href="#prepare" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;helm login&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm registry login dp.apps.rancher.io \
-u tropical_flower_6fT5U@apps.rancher.io \
-p Z2xlbHB3enpmcXdmdnBkbnl0aGZ3Znlia2l2cHRoZ3hlY2VveWptdnBrZXh3Y215eG13Y2xhcGRocGpyemZreg==&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Harvester 使用 Velero 外部 CSI 儲存備份：如何確保 VM 資料一致性。</title><link>https://blog.kubeantony.com/archive/rancher/harvester-%E4%BD%BF%E7%94%A8-velero-%E5%A4%96%E9%83%A8-csi-%E5%84%B2%E5%AD%98%E5%82%99%E4%BB%BD-%E5%A6%82%E4%BD%95%E7%A2%BA%E4%BF%9D-vm-%E8%B3%87%E6%96%99%E4%B8%80%E8%87%B4%E6%80%A7/</link><pubDate>Sat, 28 Feb 2026 14:17:54 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/harvester-%E4%BD%BF%E7%94%A8-velero-%E5%A4%96%E9%83%A8-csi-%E5%84%B2%E5%AD%98%E5%82%99%E4%BB%BD-%E5%A6%82%E4%BD%95%E7%A2%BA%E4%BF%9D-vm-%E8%B3%87%E6%96%99%E4%B8%80%E8%87%B4%E6%80%A7/</guid><description>
&lt;h2&gt;1. Preface&lt;span class="hx:absolute hx:-mt-20" id="1-preface"&gt;&lt;/span&gt;
&lt;a href="#1-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Harvester 1.5 導入了對使用外部容器儲存介面（CSI）驅動程式來配置虛擬機器根磁碟區（root volumes）與資料磁碟區（data volumes）的支援。&lt;/p&gt;
&lt;p&gt;本文將示範如何使用 Velero 1.17.0 在 Harvester 中執行虛擬機器的備份與還原。文章將透過具體的指令與資源清單（manifests）來完成以下操作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;備份特 namespace 內的虛擬機器、其 NFS CSI 磁碟區，以及相關的命名空間層級設定檔&lt;/li&gt;
&lt;li&gt;將備份產物匯出至 AWS S3 儲存體（bucket）&lt;/li&gt;
&lt;li&gt;還原至同一個叢集（cluster）上的不同 namespace&lt;/li&gt;
&lt;li&gt;還原至不同的叢集&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Velero 是一款 Kubernetes 原生的備份與還原工具，讓使用者能夠對虛擬機器執行排程與隨選（on-demand）備份，並將資料儲存至外部的物件儲存供應商（例如 S3、Azure Blob 或 GCS），完美契合企業級的備份與災難復原實務標準。&lt;/p&gt;
&lt;h2&gt;2. 安裝與部署 Garage（輕量級 S3 相容的物件儲存系統）&lt;span class="hx:absolute hx:-mt-20" id="2-安裝與部署-garage輕量級-s3-相容的物件儲存系統"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%ae%89%e8%a3%9d%e8%88%87%e9%83%a8%e7%bd%b2-garage%e8%bc%95%e9%87%8f%e7%b4%9a-s3-%e7%9b%b8%e5%ae%b9%e7%9a%84%e7%89%a9%e4%bb%b6%e5%84%b2%e5%ad%98%e7%b3%bb%e7%b5%b1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立永存目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /garage/{data,meta,config}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 &lt;code&gt;garage.toml&lt;/code&gt; 設定檔&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;[s3_api]&lt;/code&gt; 和 &lt;code&gt;[s3_web]&lt;/code&gt; 區塊底下的 &lt;code&gt;root_domain&lt;/code&gt; 的值需要根據環境調整&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /garage/config/garage.toml &amp;gt; /dev/null
metadata_dir = &amp;#34;/var/lib/garage/meta&amp;#34;
data_dir = &amp;#34;/var/lib/garage/data&amp;#34;
db_engine = &amp;#34;sqlite&amp;#34;
replication_factor = 1
rpc_bind_addr = &amp;#34;[::]:3901&amp;#34;
rpc_public_addr = &amp;#34;127.0.0.1:3901&amp;#34;
rpc_secret = &amp;#34;ba7861f27fccfe06a99245b49e33113ca846cecdc9956169a47d7eecd74aa7d8&amp;#34;
[s3_api]
s3_region = &amp;#34;garage&amp;#34;
api_bind_addr = &amp;#34;[::]:3900&amp;#34;
root_domain = &amp;#34;api.garage.kubeantony.com&amp;#34;
[s3_web]
bind_addr = &amp;#34;[::]:3902&amp;#34;
root_domain = &amp;#34;web.garage.kubeantony.com&amp;#34;
index = &amp;#34;index.html&amp;#34;
[k2v_api]
api_bind_addr = &amp;#34;[::]:3904&amp;#34;
[admin]
api_bind_addr = &amp;#34;[::]:3903&amp;#34;
admin_token = &amp;#34;KV0EuVoDxze0Ut7tQdkvNiU8TKcD8LejZQglH/JGK00=&amp;#34;
metrics_token = &amp;#34;RQxx1DjKcnhpEVnPmjxWn&amp;#43;CzLY5wNBNT60GMvHQ&amp;#43;LXo=&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;透過 Podman 部署 Garage&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run \
-d \
--name garaged \
--network host \
-v /garage/config/garage.toml:/etc/garage.toml \
-v /garage/meta:/var/lib/garage/meta \
-v /garage/data:/var/lib/garage/data \
dxflrs/garage:v2.2.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Garage Container 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a --filter name=garage&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
499fff9ed2db docker.io/dxflrs/garage:v2.2.0 /garage server 31 minutes ago Up 31 minutes garaged&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查詢 Garage 節點狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec -it garaged /garage status&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T06:41:45.072105Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T06:41:45.113726Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== HEALTHY NODES ====
ID Hostname Address Tags Zone Capacity DataAvail Version
368849c86cba2382 garage.kubeantony.com 127.0.0.1:3901 NO ROLE ASSIGNED v2.2.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將指定的 Garage 節點設定至 &lt;code&gt;dc1&lt;/code&gt; 可用區（Zone）和 &lt;code&gt;50GB&lt;/code&gt; 的儲存容量。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec -it garaged /garage layout assign -z dc1 -c 50G 368849c86cba2382&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T06:42:30.841741Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T06:42:30.882712Z INFO garage_net::netapp: Connection established to 368849c86cba2382
Role changes are staged but not yet committed.
Use `garage layout show` to view staged role changes,
and `garage layout apply` to enact staged changes.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;執行結果顯示此變更目前僅處於「暫存 &lt;code&gt;staged&lt;/code&gt;」狀態&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;正式套用先前暫存的叢集配置（版本 1），使節點的角色與容量設定正式生效。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage layout apply --version 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T06:42:50.085913Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T06:42:50.126651Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== COMPUTATION OF A NEW PARTITION ASSIGNATION ====
Partitions are replicated 1 times on at least 1 distinct zones.
Optimal partition size: 195.3 MB
Usable capacity / total cluster capacity: 50.0 GB / 50.0 GB (100.0 %)
Effective capacity (replication factor 1): 50.0 GB
dc1 Tags Partitions Capacity Usable capacity
368849c86cba2382 [] 256 (256 new) 50.0 GB 50.0 GB (100.0%)
TOTAL 256 (256 unique) 50.0 GB 50.0 GB (100.0%)
New cluster layout with updated role assignment has been applied in cluster.
Data will now be moved around between nodes accordingly.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;再次確認 Garage 節點狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage status&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T07:49:07.462651Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T07:49:07.503706Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== HEALTHY NODES ====
ID Hostname Address Tags Zone Capacity DataAvail Version
368849c86cba2382 garage.kubeantony.com 127.0.0.1:3901 [] dc1 50.0 GB 58.5 GB (82.0%) v2.2.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Bucket&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage bucket create vm-backup&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T07:54:42.568429Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T07:54:42.609720Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== BUCKET INFORMATION ====
Bucket: be30df62bea032acdc9ba3b992b32a43794b9f950599870e21ee706340c39c96
Created: 2026-02-26 07:54:42.610 &amp;#43;00:00
Size: 0 B (0 B)
Objects: 0
Website access: false
Global alias: vm-backup
==== KEYS FOR THIS BUCKET ====
Permissions Access key Local aliases&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 API Key&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage key create vm-backup-access-key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T07:56:11.307951Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T07:56:11.348732Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== ACCESS KEY INFORMATION ====
Key ID: GK6e4243deca7bc09fdffcb405
Key name: vm-backup-access-key
Secret key: 9280dbc88cb656a8589783f0762652fdb93362b2df0c7a47cfa7f2ae9b15899f
Created: 2026-02-26 07:56:11.348 &amp;#43;00:00
Validity: valid
Expiration: never
Can create buckets: false
==== BUCKETS FOR THIS KEY ====
Permissions ID Global aliases Local aliases&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;賦予權限&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage bucket allow --read --write --owner vm-backup --key vm-backup-access-key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T07:57:44.077279Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T07:57:44.118727Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== BUCKET INFORMATION ====
Bucket: be30df62bea032acdc9ba3b992b32a43794b9f950599870e21ee706340c39c96
Created: 2026-02-26 07:54:42.610 &amp;#43;00:00
Size: 0 B (0 B)
Objects: 0
Website access: false
Global alias: vm-backup
==== KEYS FOR THIS BUCKET ====
Permissions Access key Local aliases
RWO GK6e4243deca7bc09fdffcb405 vm-backup-access-key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試掛載，安裝 s3fs&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo apt-get install s3fs -y&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 s3fs&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#34;GK6e4243deca7bc09fdffcb405:9280dbc88cb656a8589783f0762652fdb93362b2df0c7a47cfa7f2ae9b15899f&amp;#34; &amp;gt; ${HOME}/.passwd-s3fs
chmod 600 ${HOME}/.passwd-s3fs
sudo sed -i &amp;#39;s/#user_allow_other/user_allow_other/&amp;#39; /etc/fuse.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立掛載點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /mnt/garage-s3
sudo chown $USER:$USER /mnt/garage-s3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將自建 Garage S3 上的 &lt;code&gt;vm-backup&lt;/code&gt; bucket 儲存體掛載至本地 &lt;code&gt;/mnt/garage-s3&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;s3fs vm-backup /mnt/garage-s3 \
-o passwd_file=${HOME}/.passwd-s3fs \
-o url=http://garage.kubeantony.com:3900 \
-o use_path_request_style \
-o allow_other \
-o umask=000 \
-o endpoint=garage&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 &lt;code&gt;/mnt/garage-s3&lt;/code&gt; 目錄已掛載到 s3&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;findmnt -t fuse.s3fs&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;TARGET SOURCE
FSTYPE OPTIONS
/mnt/garage-s3 s3fs fuse.s3fs rw,nosuid,nodev,relatime,user_id=1000,group_id=1000,allow_other&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;寫入資料&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#34;test connection&amp;#34; &amp;gt; /mnt/garage-s3/test.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查詢 &lt;code&gt;vm-backup&lt;/code&gt; Bucket 詳細狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec garaged /garage bucket info vm-backup&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;2026-02-26T08:17:07.919852Z INFO garage_net::netapp: Connected to 127.0.0.1:3901, negotiating handshake...
2026-02-26T08:17:07.960680Z INFO garage_net::netapp: Connection established to 368849c86cba2382
==== BUCKET INFORMATION ====
Bucket: be30df62bea032acdc9ba3b992b32a43794b9f950599870e21ee706340c39c96
Created: 2026-02-26 07:54:42.610 &amp;#43;00:00
Size: 16 B (16 B)
Objects: 1
Website access: false
Global alias: vm-backup
==== KEYS FOR THIS BUCKET ====
Permissions Access key Local aliases
RWO GK6e4243deca7bc09fdffcb405 vm-backup-access-key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;清除測試資料與取消掛載&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;rm /mnt/garage-s3/test.txt
umount /mnt/garage-s3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. Install and Configure Velero&lt;span class="hx:absolute hx:-mt-20" id="3-install-and-configure-velero"&gt;&lt;/span&gt;
&lt;a href="#3-install-and-configure-velero" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ssh 連線到 Harvester Control plane 節點執行以下操作&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 Velero CLI&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 設定版本
VERSION=v1.17.0
# 使用 curl 下載並重新命名檔案
curl -L https://github.com/vmware-tanzu/velero/releases/download/$VERSION/velero-$VERSION-linux-amd64.tar.gz -o velero.tar.gz
# 解壓縮
tar -xvf velero.tar.gz
# 移動到系統路徑
mv velero-$VERSION-linux-amd64/velero /root/bin/
# 測試
velero version --client-only&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Client:
Version: v1.17.0
Git commit: 3172d9f99c3d501aad9ddfac8176d783f7692dce&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設置以下 shell 變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;BUCKET_NAME=vm-backup
BUCKET_REGION=garage
echo &amp;#34;[default]
aws_access_key_id=GK6e4243deca7bc09fdffcb405
aws_secret_access_key=9280dbc88cb656a8589783f0762652fdb93362b2df0c7a47cfa7f2ae9b15899f&amp;#34; &amp;gt; ${HOME}/.passwd
AWS_CREDENTIALS_FILE=${HOME}/.passwd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 Harvester 集群上安裝 Velero&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero install \
--provider aws \
--features=EnableCSI \
--plugins &amp;#34;velero/velero-plugin-for-aws:v1.12.0,quay.io/kubevirt/kubevirt-velero-plugin:v0.7.1&amp;#34; \
--bucket &amp;#34;${BUCKET_NAME}&amp;#34; \
--secret-file &amp;#34;${AWS_CREDENTIALS_FILE}&amp;#34; \
--backup-location-config region=&amp;#34;${BUCKET_REGION}&amp;#34; \
--snapshot-location-config region=&amp;#34;${BUCKET_REGION}&amp;#34; \
--use-node-agent&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在這個設定中，Velero 被設定為：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;跑在 &lt;code&gt;velero&lt;/code&gt; namespace&lt;/li&gt;
&lt;li&gt;啟用 CSI 儲存卷快照 (volume snapshot) API&lt;/li&gt;
&lt;li&gt;啟用內建的節點代理程式 (node agent) 資料移動控制器與 Pod&lt;/li&gt;
&lt;li&gt;使用 &lt;code&gt;velero-plugin-for-aws&lt;/code&gt; 外掛程式來管理與 S3 物件儲存庫的互動&lt;/li&gt;
&lt;li&gt;使用 &lt;code&gt;kubevirt-velero-plugin&lt;/code&gt; 外掛程式來備份與還原 KubeVirt 資源&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Velero 已安裝並正在運行&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n velero get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
node-agent-49f56 1/1 Running 0 4m30s
node-agent-dhtmj 1/1 Running 0 4m30s
node-agent-n4wh9 1/1 Running 0 4m30s
velero-6c57f94f49-bxcjx 1/1 Running 0 4m30s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 velero CLI 以輸出 CSI 物件的備份和還原狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero client config set features=EnableCSI&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;patch backupstoragelocation&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl patch backupstoragelocation default -n velero --type merge --patch &amp;#39;{&amp;#34;spec&amp;#34;:{&amp;#34;config&amp;#34;:{&amp;#34;s3Url&amp;#34;:&amp;#34;http://garage.kubeantony.com:3900&amp;#34;,&amp;#34;s3ForcePathStyle&amp;#34;:&amp;#34;true&amp;#34;}}}&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check Backup-location status&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero backup-location get&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME PROVIDER BUCKET/PREFIX PHASE LAST VALIDATED ACCESS MODE DEFAULT
default aws vm-backup Available 2026-02-28 11:56:20 &amp;#43;0000 UTC ReadWrite true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. Deploy the NFS CSI and Example Server&lt;span class="hx:absolute hx:-mt-20" id="4-deploy-the-nfs-csi-and-example-server"&gt;&lt;/span&gt;
&lt;a href="#4-deploy-the-nfs-csi-and-example-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在 Kubernetes 叢集上設置 NFS 伺服器&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -s -O https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nfs-server.yaml
vim nfs-server.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; volumes:
- name: nfs-vol
hostPath:
path: /root/nfs-data # modify this to specify another path to store nfs share data
type: DirectoryOrCreate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 NFS 伺服器&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f nfs-server.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;service/nfs-server created
deployment.apps/nfs-server created&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查 NFS 伺服器是否正常運作&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
nfs-server-69ff4786bd-4pf6v 1/1 Running 0 3m22s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 NFS CSI 驅動程式&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -skSL https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/v4.13.1/deploy/install-driver.sh | bash -s v4.13.1 --&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Installing NFS CSI driver, version: v4.13.1 ...
serviceaccount/csi-nfs-controller-sa created
serviceaccount/csi-nfs-node-sa created
clusterrole.rbac.authorization.k8s.io/nfs-external-provisioner-role created
clusterrolebinding.rbac.authorization.k8s.io/nfs-csi-provisioner-binding created
clusterrole.rbac.authorization.k8s.io/nfs-external-resizer-role created
clusterrolebinding.rbac.authorization.k8s.io/nfs-csi-resizer-role created
csidriver.storage.k8s.io/nfs.csi.k8s.io created
deployment.apps/csi-nfs-controller created
daemonset.apps/csi-nfs-node created
NFS CSI driver installed successfully.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 pods 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pod -o wide -l &amp;#39;app in (csi-nfs-controller, csi-nfs-node)&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
csi-nfs-controller-68599bd8b6-v68cr 5/5 Running 0 8m36s 192.168.11.183 hvx-03 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
csi-nfs-node-2s57l 3/3 Running 0 8m35s 192.168.11.181 hvx-01 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
csi-nfs-node-79zpf 3/3 Running 0 8m35s 192.168.11.182 hvx-02 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
csi-nfs-node-smcq8 3/3 Running 0 8m35s 192.168.11.183 hvx-03 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Client pod 掛載 NFS Volume 檢查 NFS 伺服器是否正常運作&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nginx-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 client pod 運作正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get pod nginx-nfs-example&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
nginx-nfs-example 1/1 Running 0 43m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;從範例 pod 檢查掛載點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec nginx-nfs-example -- bash -c &amp;#34;findmnt /var/www -o TARGET,SOURCE,FSTYPE&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;TARGET SOURCE FSTYPE
/var/www nfs-server.default.svc.cluster.local:/ nfs4&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;清除 client pod&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nginx-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 NFS Storage Class YAML 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;vi nfs-sc.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: nfs-csi
provisioner: nfs.csi.k8s.io
parameters:
server: nfs-server.default.svc.cluster.local
share: /
# csi.storage.k8s.io/provisioner-secret is only needed for providing mountOptions in DeleteVolume
# csi.storage.k8s.io/provisioner-secret-name: &amp;#34;mount-options&amp;#34;
# csi.storage.k8s.io/provisioner-secret-namespace: &amp;#34;default&amp;#34;
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
mountOptions:
- nfsvers=4.1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 NFS Storage Class&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f nfs-sc.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create source PVC and an example pod to write data&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-dynamic.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nginx-pod-nfs.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check the Source PVC&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec nginx-nfs -- ls /mnt/nfs&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;outfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a snapshot on source PVC&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/snapshotclass-nfs.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/snapshot-nfs-dynamic.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check snapshot Status&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl describe volumesnapshot test-nfs-snapshot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Name: test-nfs-snapshot
Namespace: default
Labels: &amp;lt;none&amp;gt;
Annotations: &amp;lt;none&amp;gt;
API Version: snapshot.storage.k8s.io/v1
Kind: VolumeSnapshot
Metadata:
Creation Timestamp: 2026-02-28T09:37:06Z
Finalizers:
snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
snapshot.storage.kubernetes.io/volumesnapshot-bound-protection
Generation: 1
Resource Version: 15038120
UID: 59a4ddb9-a123-4dea-b220-e0fcac477f59
Spec:
Source:
Persistent Volume Claim Name: pvc-nfs-dynamic
Volume Snapshot Class Name: csi-nfs-snapclass
Status:
Bound Volume Snapshot Content Name: snapcontent-59a4ddb9-a123-4dea-b220-e0fcac477f59
Creation Time: 2026-02-28T09:37:06Z
Ready To Use: true
Restore Size: 1026
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal CreatingSnapshot 46s snapshot-controller Waiting for a snapshot default/test-nfs-snapshot to be created by the CSI driver.
Normal SnapshotCreated 46s snapshot-controller Snapshot default/test-nfs-snapshot was successfully created by the CSI driver.
Normal SnapshotReady 46s snapshot-controller Snapshot default/test-nfs-snapshot is ready to use.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;In above example, &lt;code&gt;snapcontent-59a4ddb9-a123-4dea-b220-e0fcac477f59&lt;/code&gt; is the snapshot name.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new PVC based on snapshot&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/pvc-nfs-snapshot-restored.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check data&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl exec nginx-nfs-restored-snapshot -- ls /mnt/nfs&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;outfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;清除範例 pod&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nginx-pod-nfs.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-dynamic.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/nginx-pod-restored-snapshot.yaml
kubectl delete -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/snapshot/pvc-nfs-snapshot-restored.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. Preparing the Virtual Machine and Image&lt;span class="hx:absolute hx:-mt-20" id="5-preparing-the-virtual-machine-and-image"&gt;&lt;/span&gt;
&lt;a href="#5-preparing-the-virtual-machine-and-image" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a custom namespace named &lt;code&gt;demo-src&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create ns demo-src&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;上傳 ubuntu images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://cloud-images.ubuntu.com/minimal/releases/noble/release-20260218/ubuntu-24.04-minimal-cloudimg-amd64.img&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;點選左側選單 images -&amp;gt; 在 URL 欄位輸入以上網址&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1uSaVlYZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Stoage 選擇 &lt;code&gt;nfs-csi&lt;/code&gt; -&amp;gt; Create
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyBnaEgF-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;確認虛擬機映像檔已成功上傳至 Harvester：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkLjAVxY-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 VM&lt;/p&gt;
&lt;p&gt;輸入 VM 名稱: &lt;code&gt;test&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S17N-SxYbe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;點選 Volumes -&amp;gt; 選擇剛剛上傳的 Image &lt;code&gt; demo-src/ubuntu-24.04-minimal-cloudimg-amd64.img (nfs-csi / 3.5 Gi)&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJUmNrlFbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;點選 Add Volume -&amp;gt; StorageClass &lt;code&gt;nfs-csi&lt;/code&gt; -&amp;gt; Volume Mode: &lt;code&gt;Filesystem&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1hYNSgtbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Cloud Config user-data&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh_pwauth: true
users:
- default
- name: rancher
gecos: rancher
groups: users
lock_passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
plain_text_passwd: &amp;#39;rancher&amp;#39;
shell: /bin/bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;點選 Console -&amp;gt; Open in Serial Console&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryB_6Bxtbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;add some files to both the root and data volumes.&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo touch /test
sudo mkdir /data
sudo mkfs.ext4 /dev/vdb
echo &amp;#39;/dev/vdb /data ext4 defaults 0 2&amp;#39; | sudo tee -a /etc/fstab
sudo mount -a
echo &amp;#34;haha&amp;#34; | sudo tee /data/test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;6. 驗證檔案系統凍結相容性&lt;span class="hx:absolute hx:-mt-20" id="6-驗證檔案系統凍結相容性"&gt;&lt;/span&gt;
&lt;a href="#6-%e9%a9%97%e8%ad%89%e6%aa%94%e6%a1%88%e7%b3%bb%e7%b5%b1%e5%87%8d%e7%b5%90%e7%9b%b8%e5%ae%b9%e6%80%a7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Access the virtual machine&amp;rsquo;s virt-launcher &lt;code&gt;compute&lt;/code&gt; container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;POD=$(kubectl get pods -n demo-src \
-l vm.kubevirt.io/name=test \
-o jsonpath=&amp;#39;{.items[0].metadata.name}&amp;#39;)
kubectl exec -it $POD -n demo-src -c compute -- bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Test filesystem freeze using the virt-freezer application available in the compute container:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;virt-freezer --freeze --namespace demo-src --name test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{&amp;#34;component&amp;#34;:&amp;#34;freezer&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;info&amp;#34;,&amp;#34;msg&amp;#34;:&amp;#34;Guest agent version is 8.2.2&amp;#34;,&amp;#34;pos&amp;#34;:&amp;#34;virt-freezer.go:114&amp;#34;,&amp;#34;timestamp&amp;#34;:&amp;#34;2026-02-28T14:00:43.873324Z&amp;#34;}
{&amp;#34;component&amp;#34;:&amp;#34;freezer&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;info&amp;#34;,&amp;#34;msg&amp;#34;:&amp;#34;Operation completed successfully&amp;#34;,&amp;#34;pos&amp;#34;:&amp;#34;virt-freezer.go:152&amp;#34;,&amp;#34;timestamp&amp;#34;:&amp;#34;2026-02-28T14:00:43.940305Z&amp;#34;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;解凍&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;virt-freezer --unfreeze --namespace demo-src --name test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{&amp;#34;component&amp;#34;:&amp;#34;freezer&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;info&amp;#34;,&amp;#34;msg&amp;#34;:&amp;#34;Guest agent version is 8.2.2&amp;#34;,&amp;#34;pos&amp;#34;:&amp;#34;virt-freezer.go:114&amp;#34;,&amp;#34;timestamp&amp;#34;:&amp;#34;2026-02-28T14:02:06.328210Z&amp;#34;}
{&amp;#34;component&amp;#34;:&amp;#34;freezer&amp;#34;,&amp;#34;level&amp;#34;:&amp;#34;info&amp;#34;,&amp;#34;msg&amp;#34;:&amp;#34;Operation completed successfully&amp;#34;,&amp;#34;pos&amp;#34;:&amp;#34;virt-freezer.go:152&amp;#34;,&amp;#34;timestamp&amp;#34;:&amp;#34;2026-02-28T14:02:06.338162Z&amp;#34;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定在開始建立備份前凍結 VM 檔案系統，備份完成後解凍虛擬機檔案系統&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl patch virtualmachine test -n demo-src --type merge --patch &amp;#39;{
&amp;#34;spec&amp;#34;: {
&amp;#34;template&amp;#34;: {
&amp;#34;metadata&amp;#34;: {
&amp;#34;annotations&amp;#34;: {
&amp;#34;pre.hook.backup.velero.io/command&amp;#34;: &amp;#34;[\&amp;#34;/usr/bin/virt-freezer\&amp;#34;, \&amp;#34;--freeze\&amp;#34;, \&amp;#34;--namespace\&amp;#34;, \&amp;#34;demo-src\&amp;#34;, \&amp;#34;--name\&amp;#34;, \&amp;#34;ub-test\&amp;#34;]&amp;#34;,
&amp;#34;pre.hook.backup.velero.io/container&amp;#34;: &amp;#34;compute&amp;#34;,
&amp;#34;pre.hook.backup.velero.io/on-error&amp;#34;: &amp;#34;Fail&amp;#34;,
&amp;#34;pre.hook.backup.velero.io/timeout&amp;#34;: &amp;#34;30s&amp;#34;,
&amp;#34;post.hook.backup.velero.io/command&amp;#34;: &amp;#34;[\&amp;#34;/usr/bin/virt-freezer\&amp;#34;, \&amp;#34;--thaw\&amp;#34;, \&amp;#34;--namespace\&amp;#34;, \&amp;#34;demo-src\&amp;#34;, \&amp;#34;--name\&amp;#34;, \&amp;#34;ub-test\&amp;#34;]&amp;#34;,
&amp;#34;post.hook.backup.velero.io/container&amp;#34;: &amp;#34;compute&amp;#34;,
&amp;#34;post.hook.backup.velero.io/on-error&amp;#34;: &amp;#34;Continue&amp;#34;,
&amp;#34;post.hook.backup.velero.io/timeout&amp;#34;: &amp;#34;30s&amp;#34;
}
}
}
}
}&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;到 Harvester UI 將目標 vm 重新開機，套用最新的設定檔&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;7. Backup the Source Namespace&lt;span class="hx:absolute hx:-mt-20" id="7-backup-the-source-namespace"&gt;&lt;/span&gt;
&lt;a href="#7-backup-the-source-namespace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;使用 velero CLI 利用 Velero 內建的資料移動工具，建立 demo-src 命名空間的備份&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;BACKUP_NAME=backup-demo-src-`date &amp;#34;&amp;#43;%s&amp;#34;`
velero backup create &amp;#34;${BACKUP_NAME}&amp;#34; \
--include-namespaces demo-src \
--snapshot-move-data&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Backup request &amp;#34;backup-demo-src-1772286287&amp;#34; submitted successfully.
Run `velero backup describe backup-demo-src-1772286287` or `velero backup logs backup-demo-src-1772286287` for more details.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;DataUpload&lt;/code&gt; 的自訂資源提供了備份進度的見解&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero backup get &amp;#34;${BACKUP_NAME}&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
backup-demo-src-1772278089 InProgress 0 0 2026-02-28 11:56:33 &amp;#43;0000 UTC 29d default &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;hellip;過幾分鐘後&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
backup-demo-src-1772278089 Completed 0 0 2026-02-28 11:56:33 &amp;#43;0000 UTC 29d default &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;8. Restore To A Different Namespace&lt;span class="hx:absolute hx:-mt-20" id="8-restore-to-a-different-namespace"&gt;&lt;/span&gt;
&lt;a href="#8-restore-to-a-different-namespace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Save the following restore modifier to a local file named &lt;code&gt;modifier-data-volumes.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; modifier-data-volumes.yaml
version: v1
resourceModifierRules:
- conditions:
groupResource: persistentvolumeclaims
matches:
- path: /metadata/annotations/harvesterhci.io~1volumeForVirtualMachine
value: &amp;#34;\&amp;#34;true\&amp;#34;&amp;#34;
patches:
- operation: remove
path: /metadata/annotations/harvesterhci.io~1volumeForVirtualMachine
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create the restore modifier&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n velero create cm modifier-data-volumes --from-file=modifier-data-volumes.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Assign the backup name to a shell variable&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero restore create \
--from-backup &amp;#34;${BACKUP_NAME}&amp;#34; \
--namespace-mappings &amp;#34;demo-src:demo-dst&amp;#34; \
--exclude-resources &amp;#34;virtualmachineimages.harvesterhci.io&amp;#34; \
--resource-modifier-configmap &amp;#34;modifier-data-volumes&amp;#34; \
--labels &amp;#34;velero.kubevirt.io/clear-mac-address=true,velero.kubevirt.io/generate-new-firmware-uuid=true&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Restore request &amp;#34;backup-demo-src-1772286287-20260228141734&amp;#34; submitted successfully.
Run `velero restore describe backup-demo-src-1772286287-20260228141734` or `velero restore logs backup-demo-src-1772286287-20260228141734` for more details.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;修復期間：
虛擬機的 MAC 位址與韌體 UUID 會被重置，以避免與現有虛擬機發生潛在衝突。
虛擬機映像清單被排除，因為 Velero 會從備份中恢復整個虛擬機狀態。
會呼叫 modifier-data-volumes 的還原修飾符來修改虛擬機器的資料卷的元資料，以避免與 CDI 卷匯入填充器發生衝突。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;當還原操作仍在進行中時，&lt;code&gt;DataDownload&lt;/code&gt; 的自訂資源可用來檢視作業進度：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;RESTORE_NAME=backup-demo-src-1772286287-20260228141734
kubectl -n velero get datadownload -l velero.io/restore-name=&amp;#34;${RESTORE_NAME}&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS STARTED BYTES DONE TOTAL BYTES STORAGE LOCATION AGE NODE
backup-demo-src-1772286287-20260228135229-9fnqg Completed 59s 3758096384 3758096384 default 75s hvx-02
backup-demo-src-1772286287-20260228135229-fqrhx Completed 72s 192040960 192040960 default 74s hvx-02
backup-demo-src-1772286287-20260228135229-kp2jw Completed 71s 10737418240 10737418240 default 75s hvx-01
backup-demo-src-1772286287-20260228135229-n7bcp Completed 70s 10146021376 10146021376 default 74s hvx-03&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認還原成功完成：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;velero restore get&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME BACKUP STATUS STARTED COMPLETED ERRORS WARNINGS CREATED SELECTOR
backup-demo-src-1772286287-20260228135229 backup-demo-src-1772286287 Completed 2026-02-28 13:52:29 &amp;#43;0000 UTC 2026-02-28 13:54:00 &amp;#43;0000 UTC 0 6 2026-02-28 13:52:29 &amp;#43;0000 UTC &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認虛擬機及其設定是否已恢復到新的 &lt;code&gt;demo-dst&lt;/code&gt; namespace：&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>How to update rke2 to cis profile</title><link>https://blog.kubeantony.com/archive/rancher/how-to-update-rke2-to-cis-profile/</link><pubDate>Tue, 24 Feb 2026 07:18:08 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/how-to-update-rke2-to-cis-profile/</guid><description>
&lt;h2&gt;以下命令要先在 update 之前執行&lt;span class="hx:absolute hx:-mt-20" id="以下命令要先在-update-之前執行"&gt;&lt;/span&gt;
&lt;a href="#%e4%bb%a5%e4%b8%8b%e5%91%bd%e4%bb%a4%e8%a6%81%e5%85%88%e5%9c%a8-update-%e4%b9%8b%e5%89%8d%e5%9f%b7%e8%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Control-plane node 跑&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp -vf /usr/local/share/rke2/rke2-cis-sysctl.conf /etc/sysctl.d/60-rke2-cis.conf &amp;amp;&amp;amp; \
sudo systemctl restart systemd-sysctl &amp;amp;&amp;amp; \
sudo useradd -r -c &amp;#34;etcd user&amp;#34; -s /sbin/nologin -M etcd -U; \
sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;如果先更新下去會在 rke2-server 的 service 看到以下錯誤訊息&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;missing required: user: unknown user etcd\nmissing required: group: unknown group etcd\n&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p&gt;worker node 跑 (如果是透過 Rancher 去更新，以下指令不用做)&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cp /opt/rke2/share/rke2/rke2-cis-sysctl.conf /etc/sysctl.d/60-rke2-cis.conf &amp;amp;&amp;amp; \
systemctl restart systemd-sysctl
reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Ref&lt;span class="hx:absolute hx:-mt-20" id="ref"&gt;&lt;/span&gt;
&lt;a href="#ref" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://docs.rke2.io/security/hardening_guide/"target="_blank" rel="noopener"&gt;CIS Hardening Guide - RKE2 Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Install Harbor using Podman</title><link>https://blog.kubeantony.com/archive/container/install-harbor-using-podman/</link><pubDate>Tue, 24 Feb 2026 02:14:22 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/install-harbor-using-podman/</guid><description>
&lt;h2&gt;先決條件&lt;span class="hx:absolute hx:-mt-20" id="先決條件"&gt;&lt;/span&gt;
&lt;a href="#%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 已安裝 &lt;code&gt;podman&lt;/code&gt;，版本 &lt;code&gt;4.9.x&lt;/code&gt; 或以上&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 已安裝 &lt;code&gt;curl&lt;/code&gt;, &lt;code&gt;wget&lt;/code&gt;, &lt;code&gt;jq&lt;/code&gt;, &lt;code&gt;git&lt;/code&gt; 和 &lt;code&gt;httpd-tools&lt;/code&gt; 工具
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo dnf install -y podman curl wget jq httpd-tools git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;本篇文章環境資訊
&lt;ul&gt;
&lt;li&gt;OS 發行版: &lt;code&gt;Red Hat Enterprise Linux 9.7 (Plow)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Kernel 版本: &lt;code&gt;5.14.0-611.24.1.el9_7.x86_64&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;podman 版本: &lt;code&gt;5.6.0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;SELinux: &lt;code&gt;Enforcing&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Firewalld systemd service: &lt;code&gt;active and enabled&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;硬體資源需求&lt;span class="hx:absolute hx:-mt-20" id="硬體資源需求"&gt;&lt;/span&gt;
&lt;a href="#%e7%a1%ac%e9%ab%94%e8%b3%87%e6%ba%90%e9%9c%80%e6%b1%82" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;資源項目&lt;/th&gt;
&lt;th&gt;最低配置&lt;/th&gt;
&lt;th&gt;建議配置&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2 核 (CPU)&lt;/td&gt;
&lt;td&gt;4 核 (CPU)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;記憶體 (Mem)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;td&gt;8 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;磁碟空間 (Disk)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;40 GB&lt;/td&gt;
&lt;td&gt;160 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Setp1: 建立 podman network&lt;span class="hx:absolute hx:-mt-20" id="setp1-建立-podman-network"&gt;&lt;/span&gt;
&lt;a href="#setp1-%e5%bb%ba%e7%ab%8b-podman-network" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman network create --subnet 10.8.0.0/16 harbor&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;若不想建立網路，可以使用預設 podman 網路，但需要將 dns 解析打開
預設網路目前版本沒有開啟 dns 解析，要不然 containers 之間沒法透過主機名稱進行互訪。
修改設定檔後需要將網路介面刪除或重新啟動主機才能生效。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Step2: 下載 Harbor 離線安裝所需的檔案&lt;span class="hx:absolute hx:-mt-20" id="step2-下載-harbor-離線安裝所需的檔案"&gt;&lt;/span&gt;
&lt;a href="#step2-%e4%b8%8b%e8%bc%89-harbor-%e9%9b%a2%e7%b7%9a%e5%ae%89%e8%a3%9d%e6%89%80%e9%9c%80%e7%9a%84%e6%aa%94%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;下載官方發布的離線版本&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_VERSION=$(curl -s https://api.github.com/repos/goharbor/harbor/releases/latest | jq -r .tag_name)
wget https://github.com/goharbor/harbor/releases/download/${HARBOR_VERSION}/harbor-offline-installer-${HARBOR_VERSION}.tgz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;第一行命令會直接到 github 抓 Harbor 官方最新 release 的版本，如果要安裝其他版本，請自行定義&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;解壓縮檔案，並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar zxf harbor-offline-installer-${HARBOR_VERSION}.tgz; cd harbor&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;匯入 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman load -i harbor.${HARBOR_VERSION}.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查是否成功&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman images&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/goharbor/harbor-exporter v2.14.2 26fc5ce17425 13 days ago 133 MB
localhost/goharbor/redis-photon v2.14.2 d62cec11627f 13 days ago 190 MB
localhost/goharbor/trivy-adapter-photon v2.14.2 6165b96861b7 13 days ago 403 MB
localhost/goharbor/harbor-registryctl v2.14.2 1364c6d80c42 13 days ago 167 MB
localhost/goharbor/registry-photon v2.14.2 4161f69794cf 13 days ago 88.4 MB
localhost/goharbor/nginx-photon v2.14.2 9383173f860e 13 days ago 175 MB
localhost/goharbor/harbor-log v2.14.2 77a92995972a 13 days ago 188 MB
localhost/goharbor/harbor-jobservice v2.14.2 5b11a15a5cb0 13 days ago 180 MB
localhost/goharbor/harbor-core v2.14.2 604ea0c2c17f 13 days ago 205 MB
localhost/goharbor/harbor-portal v2.14.2 b936a8ce0efb 13 days ago 183 MB
localhost/goharbor/harbor-db v2.14.2 d80918ffd062 13 days ago 293 MB
localhost/goharbor/prepare v2.14.2 6337f8dedb39 13 days ago 203 MB&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Step3: 部署 Harbor 各元件&lt;span class="hx:absolute hx:-mt-20" id="step3-部署-harbor-各元件"&gt;&lt;/span&gt;
&lt;a href="#step3-%e9%83%a8%e7%bd%b2-harbor-%e5%90%84%e5%85%83%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;注意，Harbor 各別的元件相互依賴，需要依照順序部署，否則元件無法啟動&lt;/p&gt;
&lt;h3&gt;3.1. 部署 redis&lt;span class="hx:absolute hx:-mt-20" id="31-部署-redis"&gt;&lt;/span&gt;
&lt;a href="#31-%e9%83%a8%e7%bd%b2-redis" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;建立 redis container
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 Redis 資料永存目錄區
REDIS_PV=&amp;#34;/data/redis&amp;#34;
[ ! -d ${REDIS_PV} ] &amp;amp;&amp;amp; sudo mkdir -p ${REDIS_PV}
sudo chown 999:999 ${REDIS_PV}
sudo podman run --name redis --detach \
--network=harbor \
--cap-add=chown --cap-add=setuid \
--cap-add=setgid --cap-drop=all \
--volume=${REDIS_PV}:/var/lib/redis:z \
goharbor/redis-photon:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.2. 部署 postgresql&lt;span class="hx:absolute hx:-mt-20" id="32-部署-postgresql"&gt;&lt;/span&gt;
&lt;a href="#32-%e9%83%a8%e7%bd%b2-postgresql" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;建立 secret：資料庫 root 使用者的密碼，這裡使用隨機密碼
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tr -dc &amp;#39;A-Za-z0-9&amp;#39; &amp;lt; /dev/urandom | head -c 16 | sudo podman secret create db-secret -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;建立 pg container
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 Redis 資料永存目錄區
PG_PV=&amp;#34;/data/database&amp;#34;
[ ! -d ${PG_PV} ] &amp;amp;&amp;amp; sudo mkdir -p ${PG_PV}
sudo chown -R 999:999 ${PG_PV}
sudo podman run --name postgresql \
--detach --network=harbor \
--cap-add=chown --cap-add=setuid \
--cap-add=setgid --cap-add=dac_override \
--cap-drop=all --shm-size=1gb \
--secret=db-secret,type=env,target=POSTGRES_PASSWORD \
--volume=${PG_PV}:/var/lib/postgresql/data:z \
goharbor/harbor-db:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.3. 部署 Registry&lt;span class="hx:absolute hx:-mt-20" id="33-部署-registry"&gt;&lt;/span&gt;
&lt;a href="#33-%e9%83%a8%e7%bd%b2-registry" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;編輯 registry 設定檔
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/harbor
sudo nano /etc/harbor/registry.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
檔案內容如下 :
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;version: 0.1
log:
level: info
fields:
service: registry
storage:
cache:
layerinfo: redis
filesystem:
rootdirectory: /storage
maintenance:
uploadpurging:
enabled: true
age: 168h
interval: 24h
dryrun: false
delete:
enabled: true
redis:
addr: redis:6379
readtimeout: 10s
writetimeout: 10s
dialtimeout: 10s
password:
db: 1
enableTLS: false
pool:
maxidle: 100
maxactive: 500
idletimeout: 60s
http:
addr: :5000
secret: placeholder
debug:
addr: :9090
prometheus:
enabled: true
path: /metrics
auth:
htpasswd:
realm: harbor-registry-basic-realm
path: /etc/registry/passwd
validation:
disabled: true
compatibility:
schema1:
enabled: true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;建立密碼
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;USERNAME=&amp;#34;harbor_registry_user&amp;#34;
PASSWORD=&amp;#34;password&amp;#34;
HASH=$(htpasswd -nbB -C 5 &amp;#34;$USERNAME&amp;#34; &amp;#34;$PASSWORD&amp;#34; | cut -d: -f2)
echo &amp;#34;$USERNAME:$HASH&amp;#34; | sudo podman secret create registry-auth -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;啟動 registry container
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 REGISTRY 資料永存目錄區
REGISTRY_PV=&amp;#34;/data/registry&amp;#34;
[ ! -d ${REGISTRY_PV} ] &amp;amp;&amp;amp; sudo mkdir -p ${REGISTRY_PV}
sudo chown 10000:10000 ${REGISTRY_PV}
sudo podman run --name=registry \
--detach --network=harbor \
--cap-add=chown --cap-add=setuid \
--cap-add=setgid --cap-drop=all \
--secret=registry-auth,target=/etc/registry/passwd \
--volume=${REGISTRY_PV}:/storage:z \
--volume=/etc/harbor/registry.yml:/etc/registry/config.yml:ro \
--volume=$(find /etc/ssl/certs/ -name ca-*.crt ! -name &amp;#34;*trust*&amp;#34;):/etc/registry/root.crt:ro \
goharbor/registry-photon:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.4. 部署 portal&lt;span class="hx:absolute hx:-mt-20" id="34-部署-portal"&gt;&lt;/span&gt;
&lt;a href="#34-%e9%83%a8%e7%bd%b2-portal" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;建立設定檔
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/portal.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
檔案內容如下 :
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
client_body_temp_path /tmp/client_body_temp;
proxy_temp_path /tmp/proxy_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml&amp;#43;rss text/javascript;
location /devcenter-api-2.0 {
try_files $uri $uri/ /swagger-ui-index.html;
}
location / {
try_files $uri $uri/ /index.html;
}
location = /index.html {
add_header Cache-Control &amp;#34;no-store, no-cache, must-revalidate&amp;#34;;
}
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;建立 portal container
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run --name=portal \
--detach --network=harbor \
--cap-add=setuid --cap-add=setgid \
--cap-add=net_bind_service --cap-drop=all \
--volume=/etc/harbor/portal.conf:/etc/nginx/nginx.conf:ro \
goharbor/harbor-portal:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.5. 部署 registryctl&lt;span class="hx:absolute hx:-mt-20" id="35-部署-registryctl"&gt;&lt;/span&gt;
&lt;a href="#35-%e9%83%a8%e7%bd%b2-registryctl" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/registryctl.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;---
protocol: &amp;#34;http&amp;#34;
port: 8080
log_level: info
registry_config: &amp;#34;/etc/registry/config.yml&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立密碼&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 產生 harbor 私鑰: 用於建立 token
openssl genrsa 4096 | openssl pkey -traditional | sudo podman secret create harbor-key -
# 產生 harbor secretkey
openssl rand -base64 12 | head -c 16| sudo podman secret create harbor-secretkey -
# harbor 密碼：用於其他元件與 harbor 通訊認證
openssl rand -base64 12 | head -c 16 | sudo podman secret create harbor-secret -
# jobservice 密碼： 用於與 jobservice 通訊認證
openssl rand -base64 12 | head -c 16 | sudo podman secret create jobservice-secret -
# registry 密碼: 主要給 harbor 和 jobservice 使用
printf &amp;#34;password&amp;#34; | sudo podman secret create registry-passwd -&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 registryctl container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run --name=registryctl \
--detach --network=harbor \
--cap-add=setuid --cap-add=setgid --cap-drop=all \
--secret=harbor-secret,type=env,target=CORE_SECRET \
--secret=jobservice-secret,type=env,target=JOBSERVICE_SECRET \
--volume=${REGISTRY_PV}:/storage:z \
--volume=/etc/harbor/registry.yml:/etc/registry/config.yml:ro \
--volume=/etc/harbor/registryctl.yml:/etc/registryctl/config.yml:ro \
--volume=$(find /etc/ssl/certs/ -name ca-*.crt ! -name &amp;#34;*trust*&amp;#34;):/etc/registry/root.crt:ro \
goharbor/harbor-registryctl:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.6. 部署 harbor&lt;span class="hx:absolute hx:-mt-20" id="36-部署-harbor"&gt;&lt;/span&gt;
&lt;a href="#36-%e9%83%a8%e7%bd%b2-harbor" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/harbor.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;appname = Harbor
runmode = prod
enablegzip = true
[prod]
httpport = 8080&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 Harbor 運作所需之環境變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/coreenv&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONFIG_PATH=/etc/core/app.conf
UAA_CA_ROOT=/etc/core/certificates/uaa_ca.pem
_REDIS_URL_CORE=redis://redis:6379?idle_timeout_seconds=30
SYNC_QUOTA=true
_REDIS_URL_REG=redis://redis:6379/1?idle_timeout_seconds=30
LOG_LEVEL=info
DATABASE_TYPE=postgresql
POSTGRESQL_HOST=postgresql
POSTGRESQL_PORT=5432
POSTGRESQL_USERNAME=postgres
POSTGRESQL_DATABASE=registry
POSTGRESQL_SSLMODE=disable
POSTGRESQL_MAX_IDLE_CONNS=100
POSTGRESQL_MAX_OPEN_CONNS=900
POSTGRESQL_CONN_MAX_LIFETIME=5m
POSTGRESQL_CONN_MAX_IDLE_TIME=0
REGISTRY_URL=http://registry:5000
PORTAL_URL=http://portal:8080
TOKEN_SERVICE_URL=http://core:8080/service/token
HARBOR_ADMIN_PASSWORD=Harbor12345
MAX_JOB_WORKERS=10
WITH_TRIVY=True
CORE_URL=http://core:8080
CORE_LOCAL_URL=http://127.0.0.1:8080
JOBSERVICE_URL=http://jobservice:8080
TRIVY_ADAPTER_URL=http://trivy-adapter:8080
REGISTRY_STORAGE_PROVIDER_NAME=filesystem
READ_ONLY=false
RELOAD_KEY=
REGISTRY_CONTROLLER_URL=http://registryctl:8080
REGISTRY_CREDENTIAL_USERNAME=harbor_registry_user
CSRF_KEY=jPcpPYw2HU4V0r2LG2kyHWWSIwRE4Ln8
ROBOT_SCANNER_NAME_PREFIX=2GA78XLs
PERMITTED_REGISTRY_TYPES_FOR_PROXY_CACHE=docker-hub,harbor,azure-acr,ali-acr,aws-ecr,google-gcr,quay,docker-registry,github-ghcr,jfrog-artifactory
HTTP_PROXY=
HTTPS_PROXY=
NO_PROXY=localhost,postgresql,portal,trivy-adapter,jobservice,127.0.0.1,.local,.internal,core,registryctl,redis,registry,nginx,db,log,exporter
PORT=8080
METRIC_ENABLE=true
METRIC_PATH=/metrics
METRIC_PORT=9090
METRIC_NAMESPACE=harbor
METRIC_SUBSYSTEM=core
QUOTA_UPDATE_PROVIDER=db&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Harbor container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 Harbor 對外的 url
HARBOR_FQDN=&amp;#34;pharbor.example.com&amp;#34;
# 定義 Harbor 資料永存目錄區
HARBOR_PV=&amp;#34;/data&amp;#34;
[ ! -d ${HARBOR_PV} ] &amp;amp;&amp;amp; sudo mkdir -p ${HARBOR_PV}
sudo chown 10000:10000 ${HARBOR_PV}
# Run Harbor Container
sudo podman run --name=core --detach \
--network=harbor \
--cap-add=setuid \
--cap-add=setgid \
--cap-drop=all \
--env-file=/etc/harbor/coreenv \
--env=EXT_ENDPOINT=https://${HARBOR_FQDN} \
--secret=harbor-secret,type=env,target=CORE_SECRET \
--secret=db-secret,type=env,target=POSTGRESQL_PASSWORD \
--secret=jobservice-secret,type=env,target=JOBSERVICE_SECRET \
--secret=registry-passwd,type=env,target=REGISTRY_CREDENTIAL_PASSWORD \
--secret=harbor-secretkey,type=mount,target=/etc/core/key \
--secret=harbor-key,type=mount,target=/etc/core/private_key.pem \
--volume=${HARBOR_PV}:/data:z \
--volume=/etc/harbor/harbor.conf:/etc/core/app.conf:ro \
--volume=$(find /etc/ssl/certs/ -name ca-*.crt ! -name &amp;#34;*trust*&amp;#34;):/etc/core/certificates/root.crt:ro \
--volume=/usr/share/zoneinfo/Asia/Taipei:/etc/localtime:ro \
goharbor/harbor-core:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.7. 部署 jobservice&lt;span class="hx:absolute hx:-mt-20" id="37-部署-jobservice"&gt;&lt;/span&gt;
&lt;a href="#37-%e9%83%a8%e7%bd%b2-jobservice" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/jobservice.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;---
#Protocol used to serve
protocol: &amp;#34;http&amp;#34;
#Server listening port
port: 8080
#Worker pool
worker_pool:
#Worker concurrency
workers: 10
backend: &amp;#34;redis&amp;#34;
#Additional config if use &amp;#39;redis&amp;#39; backend
redis_pool:
#redis://[arbitrary_username:password@]ipaddress:port/database_index
redis_url: redis://redis:6379/2?idle_timeout_seconds=30
namespace: &amp;#34;harbor_job_service_namespace&amp;#34;
idle_timeout_second: 3600
#Loggers for the running job
job_loggers:
# The jobLoggers backend name, only support &amp;#34;STD_OUTPUT&amp;#34;, &amp;#34;FILE&amp;#34; and/or &amp;#34;DB&amp;#34;
- name: &amp;#34;STD_OUTPUT&amp;#34;
level: &amp;#34;INFO&amp;#34; # INFO/DEBUG/WARNING/ERROR/FATAL
- name: &amp;#34;FILE&amp;#34;
level: &amp;#34;INFO&amp;#34;
settings: # Customized settings of logger
base_dir: &amp;#34;/var/log/jobs&amp;#34;
sweeper:
duration: 1 #days
settings: # Customized settings of sweeper
work_dir: &amp;#34;/var/log/jobs&amp;#34;
#Loggers for the job service
loggers:
- name: &amp;#34;STD_OUTPUT&amp;#34; # Same with above
level: &amp;#34;INFO&amp;#34;
metric:
enabled: true
path: /metrics
port: 9090
reaper:
# the max time to wait for a task to finish, if unfinished after max_update_hours, the task will be mark as error, but the task will continue to run, default value is 24,
max_update_hours: 24
# the max time for execution in running state without new task created
max_dangling_hours: 168
# the max size of job log returned by API, default is 10M
max_retrieve_size_mb: 10&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯環境變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/jobservice.env&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;REGISTRY_URL=http://registry:5000
CORE_URL=http://core:8080
REGISTRY_CONTROLLER_URL=http://registryctl:8080
JOBSERVICE_WEBHOOK_JOB_MAX_RETRY=3
JOBSERVICE_WEBHOOK_JOB_HTTP_CLIENT_TIMEOUT=3
LOG_LEVEL=info
HTTP_PROXY=
HTTPS_PROXY=
NO_PROXY=localhost,postgresql,portal,trivy-adapter,jobservice,127.0.0.1,.local,.internal,core,registryctl,redis,registry,nginx,db,log,exporter
REGISTRY_CREDENTIAL_USERNAME=harbor_registry_user
MAX_JOB_DURATION_SECONDS=86400
METRIC_NAMESPACE=harbor
METRIC_SUBSYSTEM=jobservice&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 jobservice container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 Jobservice 資料永存目錄區
JOBSVC_PV=&amp;#34;/data/job_logs&amp;#34;
[ ! -d ${JOBSVC_PV} ] &amp;amp;&amp;amp; sudo mkdir -p ${JOBSVC_PV}
sudo chown 10000:10000 ${JOBSVC_PV}
sudo podman run --name=jobservice --detach \
--network=harbor \
--cap-add=setuid \
--cap-add=setgid \
--cap-add=chown \
--cap-drop=all \
--env-file=/etc/harbor/jobservice.env \
--secret=harbor-secret,type=env,target=CORE_SECRET \
--secret=jobservice-secret,type=env,target=JOBSERVICE_SECRET \
--secret=registry-passwd,type=env,target=REGISTRY_CREDENTIAL_PASSWORD \
--volume=/etc/harbor/jobservice.yml:/etc/jobservice/config.yml \
--volume=${JOBSVC_PV}:/var/log/jobs:z \
--volume=$(realpath $(find /etc/ssl/certs/ -name ca-*.crt ! -name &amp;#34;*trust*&amp;#34;)):/harbor_cust_cert/root.crt:ro,Z \
goharbor/harbor-jobservice:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.8. 部署 exporter&lt;span class="hx:absolute hx:-mt-20" id="38-部署-exporter"&gt;&lt;/span&gt;
&lt;a href="#38-%e9%83%a8%e7%bd%b2-exporter" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯環境變數檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/exporter.env&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;LOG_LEVEL=info
HARBOR_EXPORTER_PORT=8080
HARBOR_EXPORTER_METRICS_PATH=/metrics
HARBOR_EXPORTER_METRICS_ENABLED=true
HARBOR_EXPORTER_MAX_REQUESTS=30
HARBOR_EXPORTER_CACHE_TIME=23
HARBOR_EXPORTER_CACHE_CLEAN_INTERVAL=14400
HARBOR_METRIC_NAMESPACE=harbor
HARBOR_METRIC_SUBSYSTEM=exporter
HARBOR_SERVICE_HOST=core
HARBOR_REDIS_URL=redis://redis:6379/2?idle_timeout_seconds=30
HARBOR_REDIS_NAMESPACE=harbor_job_service_namespace
HARBOR_REDIS_TIMEOUT=3600
HARBOR_SERVICE_PORT=8080
HARBOR_SERVICE_SCHEME=http
HARBOR_DATABASE_HOST=postgresql
HARBOR_DATABASE_PORT=5432
HARBOR_DATABASE_USERNAME=postgres
HARBOR_DATABASE_DBNAME=registry
HARBOR_DATABASE_SSLMODE=disable
HARBOR_DATABASE_MAX_IDLE_CONNS=100
HARBOR_DATABASE_MAX_OPEN_CONNS=900
HARBOR_DATABASE_CONN_MAX_LIFETIME=5m
HARBOR_DATABASE_CONN_MAX_IDLE_TIME=0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 exporter container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run -d \
--name exporter --network harbor \
--env-file /etc/harbor/exporter.env \
--secret=db-secret,type=env,target=HARBOR_DATABASE_PASSWORD \
--volume=$(realpath $(find /etc/ssl/certs/ -name ca-*.crt ! -name &amp;#34;*trust*&amp;#34;)):/harbor_cust_cert/root.crt:ro,Z \
goharbor/harbor-exporter:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.9. 部署 Nginx&lt;span class="hx:absolute hx:-mt-20" id="39-部署-nginx"&gt;&lt;/span&gt;
&lt;a href="#39-%e9%83%a8%e7%bd%b2-nginx" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;產生自簽憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;git clone https://github.com/braveantony/mkcert.git
# change for your base domain
nano mkcert/config
# Server 相關設定
DOMAIN_NAME=&amp;#34;example.com&amp;#34;
./mkcert/certctl
sudo mkdir -p /data/secret/cert
sudo cp mkcert/example.com/example.com.crt /data/secret/cert/server.crt
sudo cp mkcert/example.com/example.com.key /data/secret/cert/server.key
sudo chown -R 10000:10000 /data/secret/cert&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/nginx.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 3096;
use epoll;
multi_accept on;
}
http {
client_body_temp_path /tmp/client_body_temp;
proxy_temp_path /tmp/proxy_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
tcp_nodelay on;
include /etc/nginx/conf.d/*.upstream.conf;
# this is necessary for us to be able to disable request buffering in all cases
proxy_http_version 1.1;
upstream core {
server core:8080;
}
upstream portal {
server portal:8080;
}
log_format timed_combined &amp;#39;$remote_addr - &amp;#39;
&amp;#39;&amp;#34;$request&amp;#34; $status $body_bytes_sent &amp;#39;
&amp;#39;&amp;#34;$http_referer&amp;#34; &amp;#34;$http_user_agent&amp;#34; &amp;#39;
&amp;#39;$request_time $upstream_response_time $pipe&amp;#39;;
access_log /dev/stdout timed_combined;
map $http_x_forwarded_proto $x_forwarded_proto {
default $http_x_forwarded_proto;
&amp;#34;&amp;#34; $scheme;
}
include /etc/nginx/conf.d/*.server.conf;
server {
listen 8443 ssl;
# server_name harbordomain.com;
server_tokens off;
# SSL
ssl_certificate /etc/cert/server.crt;
ssl_certificate_key /etc/cert/server.key;
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers &amp;#39;!aNULL:kECDH&amp;#43;AESGCM:ECDH&amp;#43;AESGCM:RSA&amp;#43;AESGCM:kECDH&amp;#43;AES:ECDH&amp;#43;AES:RSA&amp;#43;AES:&amp;#39;;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;
# required to avoid HTTP 411: see Issue #1486 (https://github.com/docker/docker/issues/1486)
chunked_transfer_encoding on;
# Add extra headers
add_header Strict-Transport-Security &amp;#34;max-age=31536000; includeSubdomains; preload&amp;#34;;
add_header X-Frame-Options DENY;
add_header Content-Security-Policy &amp;#34;frame-ancestors &amp;#39;none&amp;#39;&amp;#34;;
# customized location config file can place to /etc/nginx dir with prefix harbor.https. and suffix .conf
include /etc/nginx/conf.d/harbor.https.*.conf;
location / {
proxy_pass http://portal/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / &amp;#34;/; HttpOnly; Secure&amp;#34;;
proxy_buffering off;
proxy_request_buffering off;
}
location /c/ {
proxy_pass http://core/c/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / &amp;#34;/; Secure&amp;#34;;
proxy_buffering off;
proxy_request_buffering off;
}
location /api/ {
proxy_pass http://core/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / &amp;#34;/; Secure&amp;#34;;
proxy_buffering off;
proxy_request_buffering off;
}
location /v1/ {
return 404;
}
location /v2/ {
proxy_pass http://core/v2/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_buffering off;
proxy_request_buffering off;
proxy_send_timeout 900;
proxy_read_timeout 900;
}
location /service/ {
proxy_pass http://core/service/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $x_forwarded_proto;
proxy_cookie_path / &amp;#34;/; Secure&amp;#34;;
proxy_buffering off;
proxy_request_buffering off;
}
location /service/notifications {
return 404;
}
}
server {
listen 8080;
#server_name harbordomain.com;
return 308 https://$host:443$request_uri;
}
upstream core_metrics {
server core:9090;
}
upstream js_metrics {
server jobservice:9090;
}
upstream registry_metrics {
server registry:9090;
}
upstream harbor_exporter {
server exporter:8080;
}
server {
listen 9090;
location = /metrics {
if ($arg_comp = core) { proxy_pass http://core_metrics; }
if ($arg_comp = jobservice) { proxy_pass http://js_metrics; }
if ($arg_comp = registry) { proxy_pass http://registry_metrics; }
proxy_pass http://harbor_exporter;
}
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 nginx container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run --name=proxy \
--detach --network=harbor \
--cap-drop=all \
--cap-add=setuid --cap-add=setgid --cap-add=chown \
--cap-add=net_bind_service --cap-add=dac_override \
--volume=/etc/harbor/jobservice.yml:/etc/jobservice/config.yml:z \
--volume=/etc/harbor/nginx.conf:/etc/nginx/nginx.conf:ro,z \
--volume=/data/secret/cert:/etc/cert:ro,Z \
--publish=80:8080/tcp \
--publish=443:8443/tcp \
--publish=9090:9090/tcp \
goharbor/nginx-photon:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.10. 部署 trivy&lt;span class="hx:absolute hx:-mt-20" id="310-部署-trivy"&gt;&lt;/span&gt;
&lt;a href="#310-%e9%83%a8%e7%bd%b2-trivy" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯環境變數檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/harbor/trivy.env&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;REGISTRY_URL=http://registry:5000
SCANNER_LOG_LEVEL=info
SCANNER_REDIS_URL=redis://redis:6379/5?idle_timeout_seconds=30
SCANNER_STORE_REDIS_URL=redis://redis:6379/5?idle_timeout_seconds=30
SCANNER_STORE_REDIS_NAMESPACE=harbor.scanner.trivy:store
SCANNER_STORE_REDIS_NAMESPACE=harbor.scanner.trivy:store
SCANNER_JOB_QUEUE_REDIS_URL=redis://redis:6379/5?idle_timeout_seconds=30
SCANNER_JOB_QUEUE_REDIS_NAMESPACE=harbor.scanner.trivy:job-queue
SCANNER_TRIVY_CACHE_DIR=/home/scanner/.cache/trivy
SCANNER_TRIVY_REPORTS_DIR=/home/scanner/.cache/reports
SCANNER_TRIVY_VULN_TYPE=os,library
SCANNER_TRIVY_SEVERITY=UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
SCANNER_TRIVY_IGNORE_UNFIXED=False
SCANNER_TRIVY_SKIP_UPDATE=False
SCANNER_TRIVY_SKIP_JAVA_DB_UPDATE=False
SCANNER_TRIVY_OFFLINE_SCAN=True
SCANNER_TRIVY_SECURITY_CHECKS=vuln
SCANNER_TRIVY_GITHUB_TOKEN=
SCANNER_TRIVY_INSECURE=False
SCANNER_TRIVY_TIMEOUT=5m0s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 trivy container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman run --name=trivy-adapter --detach \
--network=harbor \
--cap-drop=all \
--env-file=/etc/harbor/trivy.env \
goharbor/trivy-adapter-photon:${HARBOR_VERSION}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.11. 檢查所有服務是否異常&lt;span class="hx:absolute hx:-mt-20" id="311-檢查所有服務是否異常"&gt;&lt;/span&gt;
&lt;a href="#311-%e6%aa%a2%e6%9f%a5%e6%89%80%e6%9c%89%e6%9c%8d%e5%8b%99%e6%98%af%e5%90%a6%e7%95%b0%e5%b8%b8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;執行以下命令檢查 container 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad033894240e localhost/goharbor/redis-photon:v2.14.2 redis-server /etc... 2 hours ago Up 2 hours (healthy) redis
15a84e395302 localhost/goharbor/harbor-db:v2.14.2 2 hours ago Up 2 hours (healthy) postgresql
a2ac4a2928d0 localhost/goharbor/harbor-portal:v2.14.2 nginx -g daemon o... About an hour ago Up About an hour (healthy) portal
5dd1ea9c53d8 localhost/goharbor/registry-photon:v2.14.2 About an hour ago Up About an hour (healthy) registry
7ad9c1c36d54 localhost/goharbor/harbor-registryctl:v2.14.2 52 minutes ago Up 52 minutes (healthy) registryctl
1ecd13d98484 localhost/goharbor/harbor-core:v2.14.2 42 minutes ago Up 42 minutes (healthy) core
c7fc40df1b30 localhost/goharbor/harbor-jobservice:v2.14.2 28 minutes ago Up 28 minutes (healthy) jobservice
05c09539108d localhost/goharbor/harbor-exporter:v2.14.2 21 minutes ago Up 21 minutes exporter
243817e09c05 localhost/goharbor/nginx-photon:v2.14.2 nginx -g daemon o... 36 seconds ago Up 36 seconds (healthy) 0.0.0.0:80-&amp;gt;8080/tcp, 0.0.0.0:443-&amp;gt;8443/tcp proxy
8c381495220b localhost/goharbor/trivy-adapter-photon:v2.14.2 3 seconds ago Up 4 seconds (healthy) trivy&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.12. 連線 Harbor UI&lt;span class="hx:absolute hx:-mt-20" id="312-連線-harbor-ui"&gt;&lt;/span&gt;
&lt;a href="#312-%e9%80%a3%e7%b7%9a-harbor-ui" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;打開瀏覽器，連線至&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://$HARBOR_FQDN&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkJ22UQDel.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;輸入身分資訊 :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;帳號 : &lt;code&gt;admin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;密碼 : &lt;code&gt;Harbor12345&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkFEaLmvxg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;3.13. 設定 Harbor 開機自動啟動&lt;span class="hx:absolute hx:-mt-20" id="313-設定-harbor-開機自動啟動"&gt;&lt;/span&gt;
&lt;a href="#313-%e8%a8%ad%e5%ae%9a-harbor-%e9%96%8b%e6%a9%9f%e8%87%aa%e5%8b%95%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;目前只適用 systemd 的 OS，如果是 OpenRC 就不適用&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;產生 Systemd Unit 並控制順序&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman generate systemd --name redis --restart-policy=always --after network-online.target --files
sudo podman generate systemd --name postgresql --restart-policy=always --after container-redis.service --files
sudo podman generate systemd --name registry --restart-policy=always --after container-postgresql.service --files
sudo podman generate systemd --name portal --restart-policy=always --after container-registry.service --files
sudo podman generate systemd --name registryctl --restart-policy=always --after container-portal.service --files
sudo podman generate systemd --name core --restart-policy=always --after container-registryctl.service --files
sudo podman generate systemd --name jobservice --restart-policy=always --after container-core.service --files
sudo podman generate systemd --name exporter --restart-policy=always --after container-jobservice.service --files
sudo podman generate systemd --name proxy --restart-policy=always --after container-exporter.service --files
sudo podman generate systemd --name trivy-adapter --restart-policy=always --after container-proxy.service --files&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將這些 &lt;code&gt;.service&lt;/code&gt; 檔案複製到 systemd 系統目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp container-*.service /etc/systemd/system/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重新載入 daemon&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定服務開機自動啟動&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable \
container-redis.service \
container-postgresql.service \
container-registry.service \
container-portal.service \
container-registryctl.service \
container-core.service \
container-jobservice.service \
container-exporter.service \
container-proxy.service \
container-trivy-adapter.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重開機測試&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ssh 連線進 podman host 主機&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 harbor 各元件的 containers 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman ps -a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad033894240e localhost/goharbor/redis-photon:v2.14.2 redis-server /etc... 7 hours ago Up 50 seconds (healthy) redis
15a84e395302 localhost/goharbor/harbor-db:v2.14.2 7 hours ago Up 50 seconds (healthy) postgresql
a2ac4a2928d0 localhost/goharbor/harbor-portal:v2.14.2 nginx -g daemon o... 6 hours ago Up 49 seconds (healthy) portal
7ad9c1c36d54 localhost/goharbor/harbor-registryctl:v2.14.2 6 hours ago Up 49 seconds (healthy) registryctl
1ecd13d98484 localhost/goharbor/harbor-core:v2.14.2 6 hours ago Up 49 seconds (healthy) core
c7fc40df1b30 localhost/goharbor/harbor-jobservice:v2.14.2 6 hours ago Up 49 seconds (healthy) jobservice
05c09539108d localhost/goharbor/harbor-exporter:v2.14.2 5 hours ago Up 49 seconds exporter
8df8d211ff56 localhost/goharbor/registry-photon:v2.14.2 3 hours ago Up 49 seconds (healthy) registry
a5c4a370ab25 localhost/goharbor/trivy-adapter-photon:v2.14.2 8 minutes ago Up 49 seconds (healthy) trivy-adapter
479f0bd782bf localhost/goharbor/nginx-photon:v2.14.2 nginx -g daemon o... 5 minutes ago Up 48 seconds (healthy) 0.0.0.0:80-&amp;gt;8080/tcp, 0.0.0.0:443-&amp;gt;8443/tcp, 0.0.0.0:9090-&amp;gt;9090/tcp proxy&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Step4：驗證&lt;span class="hx:absolute hx:-mt-20" id="step4驗證"&gt;&lt;/span&gt;
&lt;a href="#step4%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定 podman 信任 harbor 自簽 root CA 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=&amp;#34;pharbor.example.com&amp;#34;
sudo mkdir -p /etc/containers/certs.d/${HARBOR_FQDN}
sudo cp ${HOME}/mkcert/example.com/example.com.crt /etc/containers/certs.d/${HARBOR_FQDN}/ca.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;podman 登入 harbor&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman login ${HARBOR_FQDN} -u admin -p &amp;#34;Harbor12345&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Login Succeeded!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 Nginx container image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman pull docker.io/library/nginx:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 image tag&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman tag docker.io/library/nginx:stable ${HARBOR_FQDN}/library/nginx:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;push image 至 harbor&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman push ${HARBOR_FQDN}/library/nginx:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Getting image source signatures
Copying blob e50a58335e13 done |
Copying blob 5c00c19cd4b3 done |
Copying blob 7dfc0854a228 done |
Copying blob 4b43bb8fd938 done |
Copying blob 5f3758e9c329 done |
Copying blob ac61f062f9a7 done |
Copying blob 16b60074fa6f done |
Copying config 94a30ed18e done |
Writing manifest to image destination&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 UI 檢查 library 專案是否多了一片 nginx image&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1uxasNLWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;刪除原始的 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman rmi docker.io/library/nginx:stable ${HARBOR_FQDN}/library/nginx:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Untagged: docker.io/library/nginx:stable
Untagged: pharbor.example.com/library/nginx:stable
Deleted: 94a30ed18e45363486a55379bd1fbb8c479f36524ae816779f3553afe6b787ed&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;從 harbor 下載 nginx image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman pull ${HARBOR_FQDN}/library/nginx:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Trying to pull pharbor.example.com/library/nginx:stable...
Getting image source signatures
Copying blob 2efbe32a5480 done |
Copying blob 6996c0be3403 done |
Copying blob ea368c811a9e done |
Copying blob 765e9812de72 done |
Copying blob b94f38f9c422 done |
Copying blob 88e560633873 done |
Copying blob f72edb929581 done |
Copying config 94a30ed18e done |
Writing manifest to image destination
94a30ed18e45363486a55379bd1fbb8c479f36524ae816779f3553afe6b787ed&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;掃描弱點和產出 SBOM&lt;/p&gt;
&lt;p&gt;點進 &lt;code&gt;library/nginx&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Skmy7nE8bx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;點選 “開始掃描” 按鈕 和 &amp;ldquo;GENERATE SBOM&amp;rdquo; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkWqGhNUbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;點選 &amp;ldquo;SBOM detials&amp;rdquo;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ0M7248be.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;檢視掃描節點
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ry4G42N8Zl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;參考資料&lt;span class="hx:absolute hx:-mt-20" id="參考資料"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e8%b3%87%e6%96%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://www.cnblogs.com/zggzcgy/p/18639254"target="_blank" rel="noopener"&gt;Podman 安裝 harbor - zggzcgy blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>部署 VKS Clusters</title><link>https://blog.kubeantony.com/archive/virtualization/%E9%83%A8%E7%BD%B2-vks-clusters/</link><pubDate>Tue, 10 Feb 2026 05:10:28 +0800</pubDate><guid>https://blog.kubeantony.com/archive/virtualization/%E9%83%A8%E7%BD%B2-vks-clusters/</guid><description>
&lt;h2&gt;1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="1-先決條件"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;多個 ESX 主機透過 &lt;strong&gt;vSphere Distributed Switch (VDS)&lt;/strong&gt; 連接。&lt;/li&gt;
&lt;li&gt;已設定 &lt;strong&gt;Shared storage&lt;/strong&gt;，例如 vSAN 或 NFS。&lt;/li&gt;
&lt;li&gt;已啟用 &lt;strong&gt;vSphere HA&lt;/strong&gt; 和 &lt;strong&gt;fully-automated DRS&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;已啟用 &lt;strong&gt;vSphere Lifecycle Manager (vLCM)&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;已設定網路，可使用 &lt;strong&gt;NSX 及其內嵌的 load balancer&lt;/strong&gt;，或使用 &lt;strong&gt;VDS 搭配外部的 load balancer&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. ESXI 安裝設定&lt;span class="hx:absolute hx:-mt-20" id="2-esxi-安裝設定"&gt;&lt;/span&gt;
&lt;a href="#2-esxi-%e5%ae%89%e8%a3%9d%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;幫每一台 esxi 都設定固定 ip、DNS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkV-PoWvbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1ofDiZwWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Byn7DsZDZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;幫每一台 esxi 設定 ntp 校時&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1FR_iZDbe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S16WtjZDWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;2.1 設定 vCenter&lt;span class="hx:absolute hx:-mt-20" id="21-設定-vcenter"&gt;&lt;/span&gt;
&lt;a href="#21-%e8%a8%ad%e5%ae%9a-vcenter" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;參考：https://hackmd.io/@wu-andy/rkXpmTGteg&lt;/p&gt;
&lt;h3&gt;2.2. 環境資訊&lt;span class="hx:absolute hx:-mt-20" id="22-環境資訊"&gt;&lt;/span&gt;
&lt;a href="#22-%e7%92%b0%e5%a2%83%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;vCenter 版本：&lt;code&gt;8.0.3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;3 台 ESXi 版本：&lt;code&gt;8.0.3&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2.3. 設定 VSS 和 VDS&lt;span class="hx:absolute hx:-mt-20" id="23-設定-vss-和-vds"&gt;&lt;/span&gt;
&lt;a href="#23-%e8%a8%ad%e5%ae%9a-vss-%e5%92%8c-vds" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;每台 ESXI 要再添加兩張網卡，總共三個，並且都要不同網段&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1hRn2DX-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h4&gt;重新命名 VSS(VM Network)&lt;span class="hx:absolute hx:-mt-20" id="重新命名-vssvm-network"&gt;&lt;/span&gt;
&lt;a href="#%e9%87%8d%e6%96%b0%e5%91%bd%e5%90%8d-vssvm-network" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;此網段為 &lt;code&gt;172.21.1.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;將 VSS(VM Network) 重新命名成 mgmt，所有 ESXI 都要做，這裡更改名稱主要是因為 supervisor 再找網卡會因為名稱有空格找不到&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkzIZpDQbx.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJKwZ6vQbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;第二台 ESXI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryatZpvQbl.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1Tn-6DQZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;第三台 ESXI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJYxGpDQZl.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1kff6vQ-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h4&gt;設定 VDS 給 VIP 使用&lt;span class="hx:absolute hx:-mt-20" id="設定-vds-給-vip-使用"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-vds-%e7%b5%a6-vip-%e4%bd%bf%e7%94%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;此網段為 &lt;code&gt;172.20.2.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;做出 VDS ，這個 VDS 給 VIP 使用&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在 vSphere Client 中，導覽到 Datacenter。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在瀏覽器中的 Datacenter 上按一下滑鼠右鍵，然後選取 Distributed Switch &amp;gt; 新增 Distributed Switch。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B15fO8Yjll.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;輸入新 Distributed Switch 的名稱，例如：&lt;code&gt;DSwitch&lt;/code&gt;。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1KPdLtsgx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在選取版本中，輸入 Distributed Switch 的版本。
選取 &lt;code&gt;8.0.3&lt;/code&gt;。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJpfKUtjgl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在設定組態中，輸入上行連接埠數目，輸入值 &lt;code&gt;1&lt;/code&gt; 和取名 &lt;code&gt;VIP&lt;/code&gt;。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1e1pr0M-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢閱設定，然後按一下完成。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1JiYUFolx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在您建立的 Distributed Switch 上按一下滑鼠右鍵，然後選取設定編輯設定。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1UI58Yilx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在進階索引標籤上，輸入大於 1700 的值作為 MTU (位元組) 值，然後按一下確定。
在承載覆疊流量的任何網路上，MTU 大小必須大於或等於 1700。
例如，9000。
如果 vks 是安裝在 NSX 環境， MTU 就要設大於 1700。沒有的話可以只設 1500
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SyvVp5y2ex.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;加入 esxi 主機&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJElZsk3gg.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkvGWi13gx.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkGVWsJ3xg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;指定一張網卡&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkP30hw7-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJejIJWnlx.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJMRCnvQWg.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJHlJTv7Wg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJd116DQ-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h4&gt;VDS 給 workload cluster 使用&lt;span class="hx:absolute hx:-mt-20" id="vds-給-workload-cluster-使用"&gt;&lt;/span&gt;
&lt;a href="#vds-%e7%b5%a6-workload-cluster-%e4%bd%bf%e7%94%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;此網段為 &lt;code&gt;172.20.3.0/24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;再做出一個 VDS，這個 VDS 給 workload cluster 使用&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJ2aJaP7be.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyBElaPmZl.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1FzxpPX-l.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1J8lpw7Wg.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1cUgaDQWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;加入 esxi 主機&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByoKxTP7Ze.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1P9xpDQZx.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkzsepDmZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;指定一張網卡&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ry_2laDQ-x.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1N0g6vQZe.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By0RxpD7Ze.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkqyZpPX-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;2.4. 確認已設定 vsan&lt;span class="hx:absolute hx:-mt-20" id="24-確認已設定-vsan"&gt;&lt;/span&gt;
&lt;a href="#24-%e7%a2%ba%e8%aa%8d%e5%b7%b2%e8%a8%ad%e5%ae%9a-vsan" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJ16qyZnle.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;要記得略過快速入門&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SklbVR_7Wl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在監控 -&amp;gt; Skyline Health 點選無回應警示&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1emVCdXbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;2.5. 確認已啟用 vSphere HA 和 fully-automated DRS&lt;span class="hx:absolute hx:-mt-20" id="25-確認已啟用-vsphere-ha-和-fully-automated-drs"&gt;&lt;/span&gt;
&lt;a href="#25-%e7%a2%ba%e8%aa%8d%e5%b7%b2%e5%95%9f%e7%94%a8-vsphere-ha-%e5%92%8c-fully-automated-drs" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkgloJZheg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Skf-oJWhle.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;2.6. 確認已啟用 vSphere Lifecycle Manager (vLCM)&lt;span class="hx:absolute hx:-mt-20" id="26-確認已啟用-vsphere-lifecycle-manager-vlcm"&gt;&lt;/span&gt;
&lt;a href="#26-%e7%a2%ba%e8%aa%8d%e5%b7%b2%e5%95%9f%e7%94%a8-vsphere-lifecycle-manager-vlcm" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkZcK1-nll.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;安裝 Avi VM&lt;span class="hx:absolute hx:-mt-20" id="安裝-avi-vm"&gt;&lt;/span&gt;
&lt;a href="#%e5%ae%89%e8%a3%9d-avi-vm" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1mXBxBolx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;VMware Avi Load Balancer&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkVSHlHslx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1ZDreHilg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hka-LxHoex.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByWrLgBoll.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJppwpPXZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJrfOpDXZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkWBdTPmZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 Avi&lt;span class="hx:absolute hx:-mt-20" id="設定-avi"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-avi" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;第一次登入才需設管理帳號密碼&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1S4tQBoee.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;設定一組密碼，用來加密設定匯出與排程備份中的敏感資料（例如金鑰、憑證、雲端/整合帳密等）。之後做還原/匯入時，必須提供同一組密語，否則無法還原。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryzkq7Soge.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1PSy8csex.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r10zl8colg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 avi 自己的 vip&lt;span class="hx:absolute hx:-mt-20" id="設定-avi-自己的-vip"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-avi-%e8%87%aa%e5%b7%b1%e7%9a%84-vip" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hy823F9ogl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;如果有多個 avi 主機也可以把其他主機加入，做出 avi 叢集&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rknE-84--l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;可以透過 vip 登入 avi&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkqDZ8VW-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定授權&lt;span class="hx:absolute hx:-mt-20" id="設定授權"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a%e6%8e%88%e6%ac%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;到授權頁面把 license 改成 enterprise tier&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJ2KVFqogx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryzh4tqixg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 DNS/NTP&lt;span class="hx:absolute hx:-mt-20" id="設定-dnsntp"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-dnsntp" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Administration Settings DNS/NTP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Byo43lEWZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkUht3kzWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJQtnl4WZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 VMware Cloud&lt;span class="hx:absolute hx:-mt-20" id="設定-vmware-cloud"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-vmware-cloud" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;建立 vCenter Cloud 讓 Avi 能「在 vSphere 上自動部署並管理」Service Engine，並使用該 vSphere 環境的 network/storage/compute 資源來提供 load balancing&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;透過在「建立」下拉清單中選擇此選項來設定VMware vCenter/vSphere ESX雲端&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BylkOOqjll.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;為雲端提供一個名稱，然後從類型選單中選擇 VMware vCenter/vSphere ESX&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;設定關閉 dhcp 和 ipv6&lt;/li&gt;
&lt;li&gt;勾選 Prefer Static Routes vs Directly Connected Network : Avi 在決定如何把 VIP 的流量送出去時，會優先使用「靜態路由（static route）」定義的 next-hop，而不是直接利用 SE 所在介面上的「直接相連（directly-connected）」行為（例如 ARP）去處理該子網流量&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJEt9BCfWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SyuVG0PQZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="3"&gt;
&lt;li&gt;配置 vCenter 的憑證&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJAHzCDQbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJtQYdqieg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="4"&gt;
&lt;li&gt;選擇指定的 datacenter ，以及選擇 Service Engine（SE）用來做管理介面（management vNIC）的網路。不用勾選 content library，然後保存&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJS-oBCGZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="5"&gt;
&lt;li&gt;設定 Network&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Byth_pbvbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="6"&gt;
&lt;li&gt;設定後保存離開，等待狀態變為綠色&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HySLnfVWZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="7"&gt;
&lt;li&gt;Infrastructure &amp;gt; Cloud Resources &amp;gt; Networks&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1-oK6WwZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;定義一個子網路（subnet）與一組靜態 IP 範圍，供 Controller 配發給 Virtual Service 的 VIP（虛擬 IP）和 Service Engine（SE）VM 的管理 / data IP&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByiVFTbPZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol start="8"&gt;
&lt;li&gt;這邊定義 ip range，supervisor 在啟用的時候會先從裡面拿兩個 VIP 出來用，這兩個 VIP 後端會導流到 supervisor 在 worklaod 網路的那隻腳&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1ExqaWvWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;所以 supervisor 會有三個 VIP&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;一個在管理網段(5 個 IP 裡面其中的一個) &amp;mdash;&amp;gt; 提供 supervisor 內部運作用&lt;/li&gt;
&lt;li&gt;兩個在 SE 的 VI P範圍 (獨立的兩個VIP) &amp;mdash;&amp;gt; 提供使用這下指令與監控用
1 號不過 AVI ，由 supervisor CP 節點取得
2 號使用 AVI，在啟用過程中由 vCenter/Supervisor 發送 API 自動配置&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;ol start="9"&gt;
&lt;li&gt;定義 VIP ip range&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJf7caWvWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryQCNAvXWx.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1K7spbDWl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;建立 IPAM profile&lt;span class="hx:absolute hx:-mt-20" id="建立-ipam-profile"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-ipam-profile" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;建立虛擬服務時，需要使用 IPAM 來指派虛擬 IP 位址。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ2IqlE--e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJaauRvXZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;當有人（例如 vCenter Supervisor）向我要一個 VIP 時，我被授權從哪些網路發放 IP？這邊指定 VIP 的 network。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkHCoTZwZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;建立 DNS profile&lt;span class="hx:absolute hx:-mt-20" id="建立-dns-profile"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-dns-profile" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1xXFADQ-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkKDtRPXZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;這邊先新增任意一個 domain&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1BYYRD7Zx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;再回到 VMware Cloud 設定 IPAM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkOAYRw7-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 Certificate&lt;span class="hx:absolute hx:-mt-20" id="設定-certificate"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-certificate" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJEgNvTgWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1ME4vpxZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;這邊 common name 要填的是 avi 自己的 vip 所對應的 domain&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJVsB5pxZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SAN 要填的就是 avi 自己的 vip 位置&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1YAB96gWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r14_26ZDbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;複製憑證，待會在創建 supervisor cluster 時會需要貼上此憑證&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By1TAO6eWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;更換訪問 avi 入口憑證&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryMFjWgzWl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By2bn-xM-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 Service Engine Group&lt;span class="hx:absolute hx:-mt-20" id="設定-service-engine-group"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-service-engine-group" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Infrastructure &amp;gt; Cloud Resources &amp;gt; Service Engine Group&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJUWOQVZbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H12vapbDWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJS2-kOmbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;設定 Static Routes&lt;span class="hx:absolute hx:-mt-20" id="設定-static-routes"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-static-routes" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Infrastructure &amp;gt; Cloud Resources &amp;gt; VRF Context&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJB1pXVZZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;這邊要設定 workload 網段要路由到 VIP 網段的 gateway&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkllsfyuXbe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJVCTTZP-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;設定 vSphere zone&lt;span class="hx:absolute hx:-mt-20" id="設定-vsphere-zone"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-vsphere-zone" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJvvMH2lZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJaiQS3lbe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;選擇要用於 VKS 叢集和 vSphere Pod 的叢集&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S121EB2gWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;設定工作負載管理 (啟動 supervisor)&lt;span class="hx:absolute hx:-mt-20" id="設定工作負載管理-啟動-supervisor"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a%e5%b7%a5%e4%bd%9c%e8%b2%a0%e8%bc%89%e7%ae%a1%e7%90%86-%e5%95%9f%e5%8b%95-supervisor" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJXXVS3g-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJ0zrr2lWl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SySSSH3lZx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1SvSr2x-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJKnrBhe-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJJUIBnxbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;要將前面在 avi 創建的憑證放進來&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJRnR6bPWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;起始 ip 這邊是設給 supervisor cluster 的 vip，他需要保留五個連續 ip ，所以這裡設定 172.21.1.30，就是代表到 172.21.1.34 都會分配給 supervisor cluster 使用，會使用的是 supervisor control plane 的節點 IP+VIP+升級保留，總共 5 個 IP，但是使用順序不一定&lt;/li&gt;
&lt;li&gt;這意這邊起始 ip 不能跟前面 avi 設定的 vip 範圍重疊&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r13H1R-vWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;設定 workload cluster 網路資訊&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryOAH1OXWl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;這邊會設定 workload cluster 的 vm 他拿到的 ip 是在以下範圍&lt;/li&gt;
&lt;li&gt;網路名稱要填小寫&lt;/li&gt;
&lt;li&gt;網路範圍也不能跟前面重複&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkviZCbPbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1DIuKplZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;創建 workload cluster(TKG)&lt;span class="hx:absolute hx:-mt-20" id="創建-workload-clustertkg"&gt;&lt;/span&gt;
&lt;a href="#%e5%89%b5%e5%bb%ba-workload-clustertkg" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;確認 supervisor 狀態都正確&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkVBZkfwbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1qI-1MPbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;開啟瀏覽器，連接 &lt;code&gt;https://172.21.2.81&lt;/code&gt;，下載 &lt;code&gt;kubectl CLI Plugin&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryypGyYX-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;準備一台 ubuntu bastion 機使用指令下載&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ curl -k https://172.21.2.81/wcp/plugin/linux-amd64/vsphere-plugin.zip -o vsphere-plugin.zip&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;解壓縮&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo apt install unzip
$ unzip vsphere-plugin.zip
$ sudo cp -r bin/* /usr/local/bin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;登入 supervisor，使用 VC 帳號登入&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl vsphere login --insecure-skip-tls-verify --server=172.21.2.81
Username: administrator@vsphere.local
Password:
Logged in successfully.
You have access to the following contexts:
172.21.2.81
svc-tkg-domain-c19
svc-velero-domain-c19
If the context you wish to use is not in this list, you may need to try
logging in again later, or contact your cluster administrator.
To change context, use `kubectl config use-context &amp;lt;workload name&amp;gt;`&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;此時看到的 control-plane 三台就是剛剛創建的 supervisor vm，而 worker 就是 esxi 三台，因此如果在這裡創見 pod ，就是直接跑在 esxi 上&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl get no -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
423d9b295547c821ffd05433fe560885 Ready control-plane,master 42m v1.30.10&amp;#43;vmware.1-fips 172.21.3.52 &amp;lt;none&amp;gt; VMware Photon OS/Linux 5.10.237-2.ph4-esx containerd://1.7.25&amp;#43;vmware.2-fips
423dee48377f7b6bf5ee23a17f104118 Ready control-plane,master 42m v1.30.10&amp;#43;vmware.1-fips 172.21.3.51 &amp;lt;none&amp;gt; VMware Photon OS/Linux 5.10.237-2.ph4-esx containerd://1.7.25&amp;#43;vmware.2-fips
423df53a268cb03c9c8f7833d1968033 Ready control-plane,master 50m v1.30.10&amp;#43;vmware.1-fips 172.21.3.50 &amp;lt;none&amp;gt; VMware Photon OS/Linux 5.10.237-2.ph4-esx containerd://1.7.25&amp;#43;vmware.2-fips
esxi1.andy.lab Ready agent 4m58s v1.30.5-sph-806add6 172.21.1.2 &amp;lt;none&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt;
esxi2.andy.lab Ready agent 7m v1.30.5-sph-806add6 172.21.1.3 &amp;lt;none&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt;
esxi3.andy.lab Ready agent 5m53s v1.30.5-sph-806add6 172.21.1.4 &amp;lt;none&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt; &amp;lt;unknown&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;建立 vSphere namespace&lt;span class="hx:absolute hx:-mt-20" id="建立-vsphere-namespace"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-vsphere-namespace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1srPvk4-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;建立一個 &lt;code&gt;tkg-workloads&lt;/code&gt; namespace&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJAFqay4be.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;新增權限&lt;span class="hx:absolute hx:-mt-20" id="新增權限"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%b0%e5%a2%9e%e6%ac%8a%e9%99%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkqZODkVWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;設定 &lt;code&gt;administrator@vsphere.local&lt;/code&gt; 為擁有者&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1REuD14-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;新增儲存區&lt;span class="hx:absolute hx:-mt-20" id="新增儲存區"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%b0%e5%a2%9e%e5%84%b2%e5%ad%98%e5%8d%80" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Skh8OP1EWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SygFOPkE-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vSAN Default Storage Policy&lt;/code&gt; 在 sc 裡名稱會叫 &lt;code&gt;vsan-default-storage-policy&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl get storageclass
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
management-storage-policy-encryption csi.vsphere.vmware.com Delete Immediate true 5d18h
management-storage-policy-regular csi.vsphere.vmware.com Delete Immediate true 5d18h
management-storage-policy-single-node csi.vsphere.vmware.com Delete Immediate true 5d18h
management-storage-policy-stretched-lite csi.vsphere.vmware.com Delete Immediate true 5d18h
management-storage-policy-thin csi.vsphere.vmware.com Delete Immediate true 5d18h
vm-encryption-policy csi.vsphere.vmware.com Delete Immediate true 5d18h
vsan-default-storage-policy csi.vsphere.vmware.com Delete Immediate true 5d18h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;新增 VM Class&lt;span class="hx:absolute hx:-mt-20" id="新增-vm-class"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%b0%e5%a2%9e-vm-class" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkbn9PyN-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;選用預設定義的 &lt;code&gt;best-effort-medium&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Bk2zsDyNZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;也可以建立自定義 VM Class&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJufcn1VZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryzE53yNZe.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJyr921VWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;建立一個 4core CPU,16G RAM&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ8eoTy4bx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1x-iTJNZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;登入 supervisor，使用 VC 帳號登入&lt;span class="hx:absolute hx:-mt-20" id="登入-supervisor使用-vc-帳號登入"&gt;&lt;/span&gt;
&lt;a href="#%e7%99%bb%e5%85%a5-supervisor%e4%bd%bf%e7%94%a8-vc-%e5%b8%b3%e8%99%9f%e7%99%bb%e5%85%a5" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl vsphere login --insecure-skip-tls-verify --server=172.21.2.81
Username: administrator@vsphere.local
Password:
Logged in successfully.
You have access to the following contexts:
10.200.2.31
svc-tkg-domain-c17
svc-velero-domain-c17
tkg-workloads&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;切換 context&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl config use-context tkg-workloads&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;檢視目前 TKG 可使用的版本，這邊會使用 &lt;code&gt;v1.32.3---vmware.1-fips-vkr.2&lt;/code&gt; 版本&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl get tkr
v1.31.11---vmware.3-fips-vkr.1 v1.31.11&amp;#43;vmware.3-fips-vkr.1 True True 5d17h
v1.31.4---vmware.1-fips-vkr.3 v1.31.4&amp;#43;vmware.1-fips-vkr.3 True True 5d17h
v1.31.7---vmware.1-fips-vkr.2 v1.31.7&amp;#43;vmware.1-fips-vkr.2 True True 5d17h
v1.32.0---vmware.6-fips-vkr.2 v1.32.0&amp;#43;vmware.6-fips-vkr.2 True True 5d17h
v1.32.3---vmware.1-fips-vkr.2 v1.32.3&amp;#43;vmware.1-fips-vkr.2 True True 5d17h
v1.32.7---vmware.3-fips-vkr.1 v1.32.7&amp;#43;vmware.3-fips-vkr.1 True True 5d17h
......&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;在 content library 檢查是否已經存在&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HktPtdJEbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;如果遇到一直同步失敗，就移除 &lt;code&gt;Kubernetes Service Content Library&lt;/code&gt; 後再重新指定讓他在同步一次&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;離線環境要自行準備 content library &lt;code&gt;https://wp-content.vmware.com/v2/latest/&lt;/code&gt;
可&lt;a
href="https://hackmd.io/@wu-andy/Sy1vx3eEWx"target="_blank" rel="noopener"&gt;參考&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;編輯 cluster.yaml&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ nano my-tkg-cluster.yaml
apiVersion: run.tanzu.vmware.com/v1alpha2
kind: TanzuKubernetesCluster
metadata:
name: tkgs-v2-cluster-default
namespace: tkg-workloads
spec:
topology:
controlPlane:
replicas: 1
vmClass: best-effort-medium # 根據自己定義的名稱更換
storageClass: &amp;#39;vsan-default-storage-policy&amp;#39; # 根據自己定義的名稱更換
tkr:
reference:
name: v1.32.3---vmware.1-fips-vkr.2
nodePools:
- name: worker-nodepool-a1
replicas: 1
vmClass: best-effort-medium # 根據自己定義的名稱更換
storageClass: &amp;#39;vsan-default-storage-policy&amp;#39; # 根據自己定義的名稱更換
tkr:
reference:
name: v1.32.3---vmware.1-fips-vkr.2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;部署 3m1w 架構&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: run.tanzu.vmware.com/v1alpha2
kind: TanzuKubernetesCluster
metadata:
name: my-tkgs-cluster
namespace: tkg-workloads
spec:
topology:
controlPlane:
replicas: 3
vmClass: myvm # 根據自己定義的名稱更換
storageClass: &amp;#39;vsan-default-storage-policy&amp;#39; # 根據自己定義的名稱更換
tkr:
reference:
name: v1.32.3---vmware.1-fips-vkr.2
nodePools:
- name: worker-nodepool-a1
replicas: 1
vmClass: myvm # 根據自己定義的名稱更換
storageClass: &amp;#39;vsan-default-storage-policy&amp;#39; # 根據自己定義的名稱更換
volumes:
- name: containerd
mountPath: /var/lib/containerd
capacity:
storage: 50Gi
tkr:
reference:
name: v1.32.3---vmware.1-fips-vkr.2
settings:
storage:
defaultClass: &amp;#39;vsan-default-storage-policy&amp;#39;
network:
cni:
name: calico
serviceDomain: cluster.local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;新版使用 cluster yaml 部署 TKG &lt;a
href="https://hackmd.io/@wu-andy/BJl0BkYEZl"target="_blank" rel="noopener"&gt;參考&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;部署 TKG&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl apply -f my-tkg-cluster.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;檢視 TKG 部署完成&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl -n tkg-workloads get tkc
Warning: run.tanzu.vmware.com/tanzukubernetescluster is deprecated. It is succeeded by cluster.x-k8s.io/cluster. Refer to documentation.
NAME CONTROL PLANE WORKER KUBERNETES RELEASE NAME AGE READY KUBERNETES RELEASE COMPATIBLE UPDATES AVAILABLE
tkgs-v2-cluster-default 1 1 v1.32.7---vmware.3-fips-vkr.1 80m True True&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyTfX51VWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;登入 TKG 叢集&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl vsphere login --server=10.200.2.31 \
--tanzu-kubernetes-cluster-name tkgs-v2-cluster-default \
--tanzu-kubernetes-cluster-namespace tkg-workloads \
--insecure-skip-tls-verify \
-u administrator@vsphere.local&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;檢視叢集狀態是否正常&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ kubectl get no
NAME STATUS ROLES AGE VERSION
tkgs-v2-cluster-default-ljb66-8jk74 Ready control-plane 18m v1.32.7&amp;#43;vmware.3-fips
tkgs-v2-cluster-default-worker-nodepool-a1-jh2cz-f65qq-9q5fl Ready &amp;lt;none&amp;gt; 9m1s v1.32.7&amp;#43;vmware.3-fips
$ kubectl get po -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system antrea-agent-9dqxv 2/2 Running 0 9m47s
kube-system antrea-agent-tjkn5 2/2 Running 0 17m
kube-system antrea-controller-798b767987-7hl8h 1/1 Running 0 17m
kube-system coredns-5958c95bcd-hvdrg 1/1 Running 0 18m
kube-system coredns-5958c95bcd-ms2qz 1/1 Running 0 15m
kube-system docker-registry-tkgs-v2-cluster-default-ljb66-8jk74 1/1 Running 0 19m
kube-system docker-registry-tkgs-v2-cluster-default-worker-nodepool-a1-jh2cz-f65qq-9q5fl 1/1 Running 0 9m47s
kube-system etcd-tkgs-v2-cluster-default-ljb66-8jk74 1/1 Running 0 19m
kube-system kube-apiserver-tkgs-v2-cluster-default-ljb66-8jk74 1/1 Running 0 19m
kube-system kube-controller-manager-tkgs-v2-cluster-default-ljb66-8jk74 1/1 Running 1 (17m ago) 19m
kube-system kube-proxy-lt8qd 1/1 Running 0 9m47s
kube-system kube-proxy-rfmtp 1/1 Running 0 18m
kube-system kube-scheduler-tkgs-v2-cluster-default-ljb66-8jk74 1/1 Running 1 (17m ago) 19m
kube-system metrics-server-54d7fc854c-5v4zn 1/1 Running 0 17m
kube-system snapshot-controller-fd845b8f8-fwxr2 1/1 Running 0 18m
secretgen-controller secretgen-controller-5dd46bbcfc-tljsr 1/1 Running 0 17m
tkg-system kapp-controller-7449dcf686-d2hnt 2/2 Running 0 18m
vmware-system-antrea antrea-pre-upgrade-job-klmv4 0/1 Completed 0 18m
vmware-system-auth guest-cluster-auth-svc-vz9zh 1/1 Running 0 16m
vmware-system-cloud-provider guest-cluster-cloud-provider-86466bf878-jp8t2 1/1 Running 1 (17m ago) 18m
vmware-system-csi vsphere-csi-controller-798c4f56b9-gcr69 7/7 Running 0 18m
vmware-system-csi vsphere-csi-node-fqs8t 3/3 Running 4 (15m ago) 18m
vmware-system-csi vsphere-csi-node-r6csv 3/3 Running 0 9m47s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;troubshooting&lt;span class="hx:absolute hx:-mt-20" id="troubshooting"&gt;&lt;/span&gt;
&lt;a href="#troubshooting" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;進到 VC&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;root@vc [ ~ ]# cd /usr/lib/vmware-wcp/
# 查看 supervisor 密碼
root@vc [ /usr/lib/vmware-wcp ]# ./decryptK8Pwd.py
Read key from file
Connected to PSQL
Cluster: domain-c17:16f96da8-eab0-4cb7-b70c-fdcb7737bb3a
IP: 10.200.0.60
PWD: (WV92wWtP{&amp;#43;7F^~1
------------------------------------------------------------&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;登入 supervisor 後查看 pod 是否異常&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;root@422f993f634f1e829e2340fa1d73b0eb [ ~ ]# k -n vmware-system-ako get po
NAME READY STATUS RESTARTS AGE
vmware-system-ako-ako-controller-manager-677ff55d9d-x5k94 1/1 Running 0 53m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;參考&lt;span class="hx:absolute hx:-mt-20" id="參考"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a
href="https://techdocs.broadcom.com/us/en/vmware-security-load-balancing/avi-load-balancer/avi-load-balancer-vmware-cloud-foundation/9-0/deploying-vsphere-supervisor-with-vds-and-avi-load-balancer.html"target="_blank" rel="noopener"&gt;https://techdocs.broadcom.com/us/en/vmware-security-load-balancing/avi-load-balancer/avi-load-balancer-vmware-cloud-foundation/9-0/deploying-vsphere-supervisor-with-vds-and-avi-load-balancer.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a
href="https://techdocs.broadcom.com/us/en/vmware-cis/vcf/vsphere-supervisor-services-and-standalone-components/latest/managing-vsphere-kubernetes-service/running-tkg-service-clusters/deploying-tkg-service-clusters.html"target="_blank" rel="noopener"&gt;https://techdocs.broadcom.com/us/en/vmware-cis/vcf/vsphere-supervisor-services-and-standalone-components/latest/managing-vsphere-kubernetes-service/running-tkg-service-clusters/deploying-tkg-service-clusters.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a
href="https://techdocs.broadcom.com/us/en/vmware-security-load-balancing/avi-load-balancer/avi-load-balancer/22-1/vmware-avi-load-balancer-administration-guide/access-settings/certificates/changing-the-nsx-advanced-load-balancer-controller-s-default-certificate.html"target="_blank" rel="noopener"&gt;https://techdocs.broadcom.com/us/en/vmware-security-load-balancing/avi-load-balancer/avi-load-balancer/22-1/vmware-avi-load-balancer-administration-guide/access-settings/certificates/changing-the-nsx-advanced-load-balancer-controller-s-default-certificate.html&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Quick Start Kube-ovn on Kubeadm K8s</title><link>https://blog.kubeantony.com/archive/kubernetes/quick-start-kube-ovn-on-kubeadm-k8s/</link><pubDate>Mon, 09 Feb 2026 01:50:20 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/quick-start-kube-ovn-on-kubeadm-k8s/</guid><description>
&lt;style&gt;
/* 如果你希望「第二層」維持數字或改為羅馬數字，可以這樣設定 */
ol ol {
list-style-type: lower-roman; /* 變成 i. ii. iii. */
}
&lt;/style&gt;
&lt;h1&gt;Quick Start Kube-ovn on HA Kubeadm K8s&lt;/h1&gt;&lt;h2&gt;1. 建置 K8s 前置作業&lt;span class="hx:absolute hx:-mt-20" id="1-建置-k8s-前置作業"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%bb%ba%e7%bd%ae-k8s-%e5%89%8d%e7%bd%ae%e4%bd%9c%e6%a5%ad" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;K8s 叢集中的每台節點需做以下設定&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;對於其他 Linux 發行版，請確保 &lt;code&gt;geneve&lt;/code&gt; 、 &lt;code&gt;openvswitch&lt;/code&gt; 、 &lt;code&gt;ip_tables&lt;/code&gt; 、 &lt;code&gt;iptable_nat&lt;/code&gt; 、 &lt;code&gt;overlay&lt;/code&gt; 和 &lt;code&gt;br_netfilter&lt;/code&gt; kernel module 存在。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;檢查 OS Kernel 是否有 geneve, openvswitch, ip_tables, iptable_nat 模組&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義需要檢查的模組
MODULES=&amp;#34;geneve|openvswitch|ip_tables|iptable_nat|overlay|br_netfilter&amp;#34;
# 執行檢查
sudo lsmod | grep -E &amp;#34;$MODULES&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ip_tables 32768 0
x_tables 65536 1 ip_tables
bridge 421888 1 br_netfilter
overlay 212992 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;永久添加&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/modules-load.d/kube-ovn.conf
geneve
openvswitch
ip_tables
iptable_nat
EOF
cat &amp;lt;&amp;lt;EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;現在立刻添加&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo modprobe geneve
sudo modprobe openvswitch
sudo modprobe ip_tables
sudo modprobe iptable_nat
sudo modprobe overlay
sudo modprobe br_netfilter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo lsmod | grep -E &amp;#34;$MODULES&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;iptable_nat 12288 0
openvswitch 217088 0
nsh 12288 1 openvswitch
nf_conncount 24576 1 openvswitch
nf_nat 61440 2 openvswitch,iptable_nat
nf_conntrack 196608 3 nf_nat,openvswitch,nf_conncount
geneve 49152 0
ip6_udp_tunnel 16384 1 geneve
udp_tunnel 32768 1 geneve
br_netfilter 32768 0
bridge 421888 1 br_netfilter
overlay 212992 0
ip_tables 32768 1 iptable_nat
x_tables 65536 2 ip_tables,iptable_nat
libcrc32c 12288 6 nf_conntrack,nf_nat,openvswitch,btrfs,nf_tables,raid456&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;核心啟動需要開啟 IPv6，如果核心啟動參數包含 &lt;code&gt;ipv6.disable=1&lt;/code&gt; 需要設定為 &lt;code&gt;0&lt;/code&gt;。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;檢查當前 kernel 參數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /proc/cmdline&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;BOOT_IMAGE=/vmlinuz-6.8.0-60-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv ro ipv6.disable=1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 &lt;code&gt;ipv6.disable=0&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/default/grub&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;需修改的檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
GRUB_CMDLINE_LINUX=&amp;#34;ipv6.disable=0&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;更新 Grub&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo update-grub&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重新開機&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認值為 &lt;code&gt;0&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /proc/sys/net/ipv6/conf/all/disable_ipv6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;kube-proxy 正常運作，Kube-OVN 可以透過 Service ClusterIP 存取 kube-apiserver。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 kubelet 設定參數開啟了 CNI，且配置在標準路徑下, kubelet 啟動時應包含下列參數：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--network-plugin=cni&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--cni-bin-dir=/opt/cni/bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--cni-conf-dir=/etc/cni/net.d&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認未安裝其他網路插件，或其他網路插件已被清除，檢查 &lt;code&gt;/etc/cni/net.d/&lt;/code&gt; 路徑下無其他網路插件設定檔。如果之前安裝過其他網路插件，建議刪除後重新啟動機器清理殘留網路資源。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 swap 是否關閉&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /proc/swaps&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果如下&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Filename Type Size Used Priority&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;永久添加必要 Kernel Parameters&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/sysctl.d/99-k8s-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;立即載入 Kernel Parameters&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sysctl --system&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 &lt;code&gt;net.bridge.bridge-nf-call-iptables&lt;/code&gt;, &lt;code&gt;net.bridge.bridge-nf-call-ip6tables&lt;/code&gt;, 和 &lt;code&gt;net.ipv4.ip_forward&lt;/code&gt; 的值都設成 &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;定義要安裝 K8s 軟體套件版本&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;KUBERNETES_VERSION=v1.35
CRIO_VERSION=v1.35&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝添加儲存庫的依賴項&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install -y software-properties-common curl&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加 Kubernetes 和 CRI-O 儲存庫&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/Release.key |
gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo &amp;#34;deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/ /&amp;#34; |
tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://download.opensuse.org/repositories/isv:/cri-o:/stable:/$CRIO_VERSION/deb/Release.key |
gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg
echo &amp;#34;deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://download.opensuse.org/repositories/isv:/cri-o:/stable:/$CRIO_VERSION/deb/ /&amp;#34; |
tee /etc/apt/sources.list.d/cri-o.list&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install -y cri-o kubelet kubeadm kubectl crun runc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;關閉 ufw Systemd Service&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl disable --now ufw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 kubelet service node ip&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INTERFACE=ens18
IPV4_IP=$(ip -4 a s $INTERFACE | awk &amp;#39;/inet / {print $2}&amp;#39; | cut -d&amp;#39;/&amp;#39; -f1)
sudo sed -i \
-e &amp;#39;/^KUBELET_EXTRA_ARGS=$/s/$/\&amp;#34;--node-ip=&amp;#39;&amp;#34;$IPV4_IP&amp;#34;&amp;#39;\&amp;#34;/&amp;#39; \
/etc/default/kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查是否正確修改&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /etc/default/kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;KUBELET_EXTRA_ARGS=&amp;#34;--node-ip=172.20.6.61&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟動 kubelet 服務&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now kubelet.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 chrony&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo apt-get install -y chrony&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 chronyd 服務開機自動啟動&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable chrony&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定跟 Google 校時&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/chrony/chrony.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修改內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;server time.google.com prefer&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;啟用 chronyd 服務&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl start chrony&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;手動確定已校時&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo chronyc sources&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* time4.google.com 1 6 377 22 &amp;#43;271us[ &amp;#43;332us] &amp;#43;/- 3178us&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SSH 連到其他節點做步驟 1 ~ 22 的設定&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;2. 透過 kubeadm 開始建立 HA K8s&lt;span class="hx:absolute hx:-mt-20" id="2-透過-kubeadm-開始建立-ha-k8s"&gt;&lt;/span&gt;
&lt;a href="#2-%e9%80%8f%e9%81%8e-kubeadm-%e9%96%8b%e5%a7%8b%e5%bb%ba%e7%ab%8b-ha-k8s" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ssh 連到第一台 Control-plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 kube-vip&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;export VIP=&amp;#34;172.20.6.60&amp;#34;
export VIPSUBSET=&amp;#34;16&amp;#34;
export INTERFACE=&amp;#34;ens18&amp;#34;
KVVERSION=&amp;#34;v1.0.1&amp;#34;
alias kube-vip=&amp;#34;sudo podman run --network host --rm ghcr.io/kube-vip/kube-vip:$KVVERSION&amp;#34;
sudo mkdir -p /etc/kubernetes/manifests/
kube-vip manifest pod \
--interface $INTERFACE \
--address $VIP \
--vipSubnet $VIPSUBSET \
--controlplane \
--arp \
--leaderElection | sudo tee /etc/kubernetes/manifests/kube-vip-static-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;拷貝到另外兩台 Control plane nodes&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@control_plane_node_2_node_hostname &amp;#39;sudo mkdir -p /etc/kubernetes/manifests/&amp;#39;
ssh sudo_user@control_plane_node_3_node_hostname &amp;#39;sudo mkdir -p /etc/kubernetes/manifests/&amp;#39;
scp /etc/kubernetes/manifests/kube-vip-static-pod.yaml sudo_user@control_plane_node_2_hostname:
scp /etc/kubernetes/manifests/kube-vip-static-pod.yaml sudo_user@control_plane_node_3_node_hostname:
ssh sudo_user@control_plane_node_3_node_hostname &amp;#39;sudo mv kube-vip-static-pod.yaml /etc/kubernetes/manifests/&amp;#39;
ssh sudo_user@control_plane_node_3_node_hostname &amp;#39;sudo mv kube-vip-static-pod.yaml /etc/kubernetes/manifests/&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 kube-vip 的 Service Account，只需在第一台 Control-plane 需要修改&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#39;s|path: /etc/kubernetes/admin.conf|path: /etc/kubernetes/super-admin.conf|g&amp;#39; \
/etc/kubernetes/manifests/kube-vip-static-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 kubeadm 初始化設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/config; \
nano &amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kubeadm.k8s.io/v1beta4
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 172.20.6.61
bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/crio/crio.sock
imagePullPolicy: IfNotPresent
imagePullSerial: true
name: taroko-m1.kubeantony.com
taints: []
timeouts:
controlPlaneComponentHealthCheck: 4m0s
discovery: 5m0s
etcdAPICall: 2m0s
kubeletHealthCheck: 4m0s
kubernetesAPICall: 1m0s
tlsBootstrap: 5m0s
upgradeManifests: 5m0s
---
apiServer:
certSANs:
- 127.0.0.1
- api-taroko.kubeantony.com
extraVolumes:
- name: tz-config
hostPath: /etc/localtime
mountPath: /etc/localtime
readOnly: true
apiVersion: kubeadm.k8s.io/v1beta4
caCertificateValidityPeriod: 87600h0m0s
certificateValidityPeriod: 8760h0m0s
certificatesDir: /etc/kubernetes/pki
clusterName: taroko-ovn
controllerManager:
extraArgs:
- name: bind-address
value: &amp;#34;0.0.0.0&amp;#34;
- name: secure-port
value: &amp;#34;10257&amp;#34;
extraVolumes:
- name: tz-config
hostPath: /etc/localtime
mountPath: /etc/localtime
readOnly: true
#dns:
# imageRepository: harbor.example.com/library/coredns
encryptionAlgorithm: RSA-2048
etcd:
local:
dataDir: /var/lib/etcd
extraArgs:
- name: listen-metrics-urls
value: http://0.0.0.0:2381
#imageRepository: harbor.example.com/library
kind: ClusterConfiguration
kubernetesVersion: 1.35.0
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/16
podSubnet: 10.244.0.0/16
#proxy:
# disabled: true
scheduler:
extraArgs:
- name: bind-address
value: &amp;#34;0.0.0.0&amp;#34;
- name: secure-port
value: &amp;#34;10259&amp;#34;
extraVolumes:
- name: tz-config
hostPath: /etc/localtime
mountPath: /etc/localtime
readOnly: true
#controlPlaneEndpoint: 172.20.6.60:6443
controlPlaneEndpoint: api-taroko.kubeantony.com:6443
---
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
containerRuntimeEndpoint: &amp;#34;&amp;#34;
cpuManagerReconcilePeriod: 0s
crashLoopBackOff: {}
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMaximumGCAge: &amp;#34;168h&amp;#34;
imageMinimumGCAge: &amp;#34;2m0s&amp;#34;
kind: KubeletConfiguration
logging:
flushFrequency: 0
options:
json:
infoBufferSize: &amp;#34;0&amp;#34;
text:
infoBufferSize: &amp;#34;0&amp;#34;
verbosity: 0
memorySwap: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
maxPods: 110
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
metricsBindAddress: &amp;#34;0.0.0.0:10249&amp;#34;
mode: &amp;#34;nftables&amp;#34;
nftables:
masqueradeAll: false
masqueradeBit: 14
minSyncPeriod: 1s
syncPeriod: 30s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Dry run set up the Kubernetes control plane，用以檢視是否設定檔有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm init \
--dry-run \
--upload-certs \
--config=&amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
[addons] Applied essential addon: kube-proxy
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/tmp/kubeadm-init-dryrun1288532023/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run &amp;#34;kubectl apply -f [podnetwork].yaml&amp;#34; with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of control-plane nodes running the following command on each as root:
kubeadm join api-taroko.kubeantony.com:6443 --token tvxdmf.8yjcy5j5wgi0tkk8 \
--discovery-token-ca-cert-hash sha256:7c7ff5930966bcb4e5ef89f4008fbc5a1578fceff088cd0dcf5b67ecb6ae4c07 \
--control-plane --certificate-key 962bae62c93cbd3f706b07014d837be78b7f120e0e75adb6f82ad942f18a092a
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
&amp;#34;kubeadm init phase upload-certs --upload-certs&amp;#34; to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join api-taroko.kubeantony.com:6443 --token tvxdmf.8yjcy5j5wgi0tkk8 \
--discovery-token-ca-cert-hash sha256:7c7ff5930966bcb4e5ef89f4008fbc5a1578fceff088cd0dcf5b67ecb6ae4c07&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set up the Kubernetes control plane&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm init \
--upload-certs \
--config=&amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[init] Using Kubernetes version: v1.35.0
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action beforehand using &amp;#39;kubeadm config images pull&amp;#39;
[certs] Using certificateDir folder &amp;#34;/etc/kubernetes/pki&amp;#34;
[certs] Generating &amp;#34;ca&amp;#34; certificate and key
[certs] Generating &amp;#34;apiserver&amp;#34; certificate and key
[certs] apiserver serving cert is signed for DNS names [api-taroko.kubeantony.com kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local taroko-m1.kubeantony.com] and IPs [10.96.0.1 172.20.6.61 127.0.0.1]
[certs] Generating &amp;#34;apiserver-kubelet-client&amp;#34; certificate and key
[certs] Generating &amp;#34;front-proxy-ca&amp;#34; certificate and key
[certs] Generating &amp;#34;front-proxy-client&amp;#34; certificate and key
[certs] Generating &amp;#34;etcd/ca&amp;#34; certificate and key
[certs] Generating &amp;#34;etcd/server&amp;#34; certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost taroko-m1.kubeantony.com] and IPs [172.20.6.61 127.0.0.1 ::1]
[certs] Generating &amp;#34;etcd/peer&amp;#34; certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost taroko-m1.kubeantony.com] and IPs [172.20.6.61 127.0.0.1 ::1]
[certs] Generating &amp;#34;etcd/healthcheck-client&amp;#34; certificate and key
[certs] Generating &amp;#34;apiserver-etcd-client&amp;#34; certificate and key
[certs] Generating &amp;#34;sa&amp;#34; key and public key
[kubeconfig] Using kubeconfig folder &amp;#34;/etc/kubernetes&amp;#34;
[kubeconfig] Writing &amp;#34;admin.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;super-admin.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;kubelet.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;controller-manager.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;scheduler.conf&amp;#34; kubeconfig file
[etcd] Creating static Pod manifest for local etcd in &amp;#34;/etc/kubernetes/manifests&amp;#34;
[control-plane] Using manifest folder &amp;#34;/etc/kubernetes/manifests&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-apiserver&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-controller-manager&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-scheduler&amp;#34;
[kubelet-start] Writing kubelet environment file with flags to file &amp;#34;/var/lib/kubelet/kubeadm-flags.env&amp;#34;
[kubelet-start] Writing kubelet configuration to file &amp;#34;/var/lib/kubelet/instance-config.yaml&amp;#34;
[patches] Applied patch of type &amp;#34;application/strategic-merge-patch&amp;#43;json&amp;#34; to target &amp;#34;kubeletconfiguration&amp;#34;
[kubelet-start] Writing kubelet configuration to file &amp;#34;/var/lib/kubelet/config.yaml&amp;#34;
[kubelet-start] Starting the kubelet
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory &amp;#34;/etc/kubernetes/manifests&amp;#34;
[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s
[kubelet-check] The kubelet is healthy after 501.521647ms
[control-plane-check] Waiting for healthy control plane components. This can take up to 4m0s
[control-plane-check] Checking kube-apiserver at https://172.20.6.61:6443/livez
[control-plane-check] Checking kube-controller-manager at https://0.0.0.0:10257/healthz
[control-plane-check] Checking kube-scheduler at https://0.0.0.0:10259/livez
[control-plane-check] kube-controller-manager is healthy after 505.527348ms
[control-plane-check] kube-scheduler is healthy after 1.008943332s
[control-plane-check] kube-apiserver is healthy after 3.001586313s
[upload-config] Storing the configuration used in ConfigMap &amp;#34;kubeadm-config&amp;#34; in the &amp;#34;kube-system&amp;#34; Namespace
[kubelet] Creating a ConfigMap &amp;#34;kubelet-config&amp;#34; in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Storing the certificates in Secret &amp;#34;kubeadm-certs&amp;#34; in the &amp;#34;kube-system&amp;#34; Namespace
[upload-certs] Using certificate key:
064ae9995157a471491e92d05c1498092c59b389d99878b87ad08eb5c5a1231f
[mark-control-plane] Marking the node taroko-m1.kubeantony.com as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[bootstrap-token] Using token: 2mjfj9.wluywejrou2isf9n
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the &amp;#34;cluster-info&amp;#34; ConfigMap in the &amp;#34;kube-public&amp;#34; namespace
[kubelet-finalize] Updating &amp;#34;/etc/kubernetes/kubelet.conf&amp;#34; to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run &amp;#34;kubectl apply -f [podnetwork].yaml&amp;#34; with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of control-plane nodes running the following command on each as root:
kubeadm join api-taroko.kubeantony.com:6443 --token 2mjfj9.wluywejrou2isf9n \
--discovery-token-ca-cert-hash sha256:a7b161d19a125ccc6efc5511a81ea5dfb4563667a8d5fd922aa5f31093609094 \
--control-plane --certificate-key 064ae9995157a471491e92d05c1498092c59b389d99878b87ad08eb5c5a1231f
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
&amp;#34;kubeadm init phase upload-certs --upload-certs&amp;#34; to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join api-taroko.kubeantony.com:6443 --token 2mjfj9.wluywejrou2isf9n \
--discovery-token-ca-cert-hash sha256:a7b161d19a125ccc6efc5511a81ea5dfb4563667a8d5fd922aa5f31093609094&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 kubeconfig&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
printf &amp;#34;\nsource &amp;lt;(kubectl completion bash)\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n&amp;#34; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;第一台 control plan 安裝好後再將 kube-vip 權限調整回來&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#39;s|path: /etc/kubernetes/super-admin.conf|path: /etc/kubernetes/admin.conf|g&amp;#39; /etc/kubernetes/manifests/kube-vip-static-pod.yaml
sudo systemctl daemon-reload
sudo systemctl restart kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 kube-system pods 運作正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;k -n kube-system get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
coredns-7d764666f9-5mnc5 1/1 Running 0 58s
coredns-7d764666f9-62cqv 1/1 Running 0 58s
etcd-taroko-m1.kubeantony.com 1/1 Running 0 65s
kube-apiserver-taroko-m1.kubeantony.com 1/1 Running 0 65s
kube-controller-manager-taroko-m1.kubeantony.com 1/1 Running 0 67s
kube-proxy-xww8m 1/1 Running 0 59s
kube-scheduler-taroko-m1.kubeantony.com 1/1 Running 0 66s
kube-vip-taroko-m1.kubeantony.com 1/1 Running 0 21s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 kube-ovn CNI 安裝腳本&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/addon/cni/kube-ovn
wget -P ${HOME}/k8s/addon/cni/kube-ovn \
https://raw.githubusercontent.com/kubeovn/kube-ovn/refs/tags/v1.15.2/dist/images/install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改設定參數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano ${HOME}/k8s/addon/cni/kube-ovn/install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;IFACE=ens18
POD_CIDR=&amp;#34;10.244.0.0/16&amp;#34; # Do NOT overlap with NODE/SVC/JOIN CIDR
POD_GATEWAY=&amp;#34;10.244.0.1&amp;#34;
SVC_CIDR=&amp;#34;10.96.0.0/16&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;執行安裝腳本&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/addon/cni/kube-ovn; \
sudo KUBECONFIG=&amp;#34;$HOME&amp;#34;/.kube/config bash install.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;-------------------------------
Kube-OVN Version: v1.15.2
Default Network Mode: geneve
Default Subnet CIDR: 10.244.0.0/16
Join Subnet CIDR: 100.64.0.0/16
Enable SVC LB: true
Enable Networkpolicy: true
Enable EIP and SNAT: true
Enable Mirror: false
-------------------------------
[Step 1/6] Label kube-ovn-master node and label datapath type
node/taroko-m1.kubeantony.com labeled
-------------------------------
[Step 2/6] Install OVN components
Install OVN DB in 172.20.6.61
customresourcedefinition.apiextensions.k8s.io/vpc-dnses.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/switch-lb-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/vpc-nat-gateways.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/vpc-egress-gateways.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/iptables-eips.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/iptables-fip-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/iptables-dnat-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/iptables-snat-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ovn-eips.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ovn-fips.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ovn-snat-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ovn-dnat-rules.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/vpcs.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ips.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/vips.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/subnets.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/ippools.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/vlans.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/provider-networks.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/security-groups.kubeovn.io created
customresourcedefinition.apiextensions.k8s.io/qos-policies.kubeovn.io created
serviceaccount/ovn-ovs created
clusterrole.rbac.authorization.k8s.io/system:ovn-ovs created
clusterrolebinding.rbac.authorization.k8s.io/ovn-ovs created
serviceaccount/ovn created
clusterrole.rbac.authorization.k8s.io/system:ovn created
clusterrolebinding.rbac.authorization.k8s.io/ovn created
rolebinding.rbac.authorization.k8s.io/ovn created
serviceaccount/kube-ovn-cni created
clusterrole.rbac.authorization.k8s.io/system:kube-ovn-cni created
role.rbac.authorization.k8s.io/secret-reader-ovn-ipsec created
clusterrolebinding.rbac.authorization.k8s.io/kube-ovn-cni created
rolebinding.rbac.authorization.k8s.io/kube-ovn-cni created
rolebinding.rbac.authorization.k8s.io/kube-ovn-cni-secret-reader created
serviceaccount/kube-ovn-app created
clusterrole.rbac.authorization.k8s.io/system:kube-ovn-app created
clusterrolebinding.rbac.authorization.k8s.io/kube-ovn-app created
rolebinding.rbac.authorization.k8s.io/kube-ovn-app created
service/ovn-nb created
service/ovn-sb created
service/ovn-northd created
deployment.apps/ovn-central created
daemonset.apps/ovs-ovn created
Waiting for deployment &amp;#34;ovn-central&amp;#34; rollout to finish: 0 of 1 updated replicas are available...
deployment &amp;#34;ovn-central&amp;#34; successfully rolled out
Waiting for daemon set &amp;#34;ovs-ovn&amp;#34; rollout to finish: 0 of 1 updated pods are available...
daemon set &amp;#34;ovs-ovn&amp;#34; successfully rolled out
-------------------------------
[Step 3/6] Install Kube-OVN
configmap/ovn-vpc-nat-config created
configmap/ovn-vpc-nat-gw-config created
deployment.apps/kube-ovn-controller created
daemonset.apps/kube-ovn-cni created
deployment.apps/kube-ovn-monitor created
service/kube-ovn-monitor created
service/kube-ovn-controller created
service/kube-ovn-cni created
Waiting for deployment &amp;#34;kube-ovn-controller&amp;#34; rollout to finish: 0 of 1 updated replicas are available...
deployment &amp;#34;kube-ovn-controller&amp;#34; successfully rolled out
Waiting for daemon set &amp;#34;kube-ovn-cni&amp;#34; rollout to finish: 0 of 1 updated pods are available...
daemon set &amp;#34;kube-ovn-cni&amp;#34; successfully rolled out
-------------------------------
Check to delete multus pods to reload CNI config
[Step 4/6] Delete pod that not in host network mode
pod &amp;#34;coredns-7d764666f9-bdk5d&amp;#34; deleted from kube-system namespace
pod &amp;#34;coredns-7d764666f9-r94v9&amp;#34; deleted from kube-system namespace
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 0 of 2 updated replicas are available...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 1 out of 2 new replicas have been updated...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 0 of 2 updated replicas are available...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 1 of 2 updated replicas are available...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 1 of 2 updated replicas are available...
Waiting for deployment &amp;#34;coredns&amp;#34; rollout to finish: 1 of 2 updated replicas are available...
deployment &amp;#34;coredns&amp;#34; successfully rolled out
Install Kube-ovn-pinger
service/kube-ovn-pinger created
daemonset.apps/kube-ovn-pinger created
Waiting for daemon set &amp;#34;kube-ovn-pinger&amp;#34; rollout to finish: 0 of 1 updated pods are available...
daemon set &amp;#34;kube-ovn-pinger&amp;#34; successfully rolled out
pod/kube-ovn-pinger-lgml7 condition met
-------------------------------
[Step 5/6] Add kubectl plugin PATH
[Step 6/6] Run network diagnose
Defaulted container &amp;#34;cni-server&amp;#34; out of: cni-server, hostpath-init (init), install-cni (init)
tar: Removing leading `/&amp;#39; from member names
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-7d764666f9-c66hz 1/1 Running 0 34s 10.244.0.5 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
coredns-7d764666f9-nj725 1/1 Running 0 35s 10.244.0.4 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
etcd-taroko-m1.kubeantony.com 1/1 Running 0 4m6s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-apiserver-taroko-m1.kubeantony.com 1/1 Running 0 4m4s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-controller-manager-taroko-m1.kubeantony.com 1/1 Running 0 4m4s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-ovn-cni-v8nl5 1/1 Running 0 46s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-ovn-controller-6bd89b7549-xj2l6 1/1 Running 0 46s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-ovn-monitor-5d9bf9858c-sw8lq 1/1 Running 0 46s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-ovn-pinger-lgml7 1/1 Running 0 19s 10.244.0.6 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-proxy-8qvlw 1/1 Running 0 3m59s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-scheduler-taroko-m1.kubeantony.com 1/1 Running 0 4m4s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-vip-taroko-m1.kubeantony.com 1/1 Running 0 3m22s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
ovn-central-55d8dfb46c-wqktr 1/1 Running 0 77s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
ovs-ovn-tctvd 1/1 Running 0 77s 172.20.6.61 taroko-m1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
NAME CREATED AT
vpcs.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
vpc-nat-gateways.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
vpc-egress-gateways.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
subnets.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ips.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
vlans.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
provider-networks.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
security-groups.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
vips.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
vpc-dnses.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
switch-lb-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ippools.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ovn-eips.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ovn-fips.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ovn-dnat-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
ovn-snat-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
iptables-eips.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
iptables-fip-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
iptables-snat-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME CREATED AT
iptables-dnat-rules.kubeovn.io 2026-02-05T10:23:16Z
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 &amp;lt;none&amp;gt; 53/UDP,53/TCP,9153/TCP 4m5s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 &amp;lt;none&amp;gt; 443/TCP 4m6s
NAME AGE
ovn 78s
NAME CREATED AT
system:ovn 2026-02-05T10:23:17Z
NAME ROLE AGE
ovn ClusterRole/system:ovn 78s
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
taroko-m1.kubeantony.com Ready control-plane 4m8s v1.35.0 172.20.6.61 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-90-generic cri-o://1.35.0
switch 7aeda674-777a-48ca-8f85-657035f13057 (ovn-default)
port coredns-7d764666f9-nj725.kube-system
addresses: [&amp;#34;52:93:cd:e8:0d:18 10.244.0.4&amp;#34;]
port coredns-7d764666f9-c66hz.kube-system
addresses: [&amp;#34;3a:e4:49:26:c4:51 10.244.0.5&amp;#34;]
port kube-ovn-pinger-lgml7.kube-system
addresses: [&amp;#34;ca:41:f2:66:e8:0b 10.244.0.6&amp;#34;]
port ovn-default-ovn-cluster
type: router
router-port: ovn-cluster-ovn-default
switch 7736cdb4-13b5-40d8-aa59-2f7682578e08 (join)
port join-ovn-cluster
type: router
router-port: ovn-cluster-join
port node-taroko-m1.kubeantony.com
addresses: [&amp;#34;ca:d5:9f:ca:6e:3e 100.64.0.2&amp;#34;]
router 0484e79c-fb16-403a-8feb-f9e9c1ca7578 (ovn-cluster)
port ovn-cluster-join
mac: &amp;#34;92:a1:79:05:14:a6&amp;#34;
ipv6-lla: &amp;#34;fe80::90a1:79ff:fe05:14a6&amp;#34;
networks: [&amp;#34;100.64.0.1/16&amp;#34;]
port ovn-cluster-ovn-default
mac: &amp;#34;96:27:4d:84:37:3b&amp;#34;
ipv6-lla: &amp;#34;fe80::9427:4dff:fe84:373b&amp;#34;
networks: [&amp;#34;10.244.0.1/16&amp;#34;]
Routing Policies
31000 ip4.dst == 10.244.0.0/16 allow
31000 ip4.dst == 100.64.0.0/16 allow
30000 ip4.dst == 172.20.6.61 reroute 100.64.0.2
29000 ip4.src == $ovn.default.taroko.m1.kubeantony.com_ip4 reroute 100.64.0.2
IPv4 Routes
Route Table &amp;lt;main&amp;gt;:
0.0.0.0/0 100.64.0.1 dst-ip
UUID LB PROTO VIP IPs
40a8ae8f-4e37-4ce6-aba2-2ad07cf5e062 cluster-tcp-load tcp 10.96.0.10:53 10.244.0.4:53,10.244.0.5:53
tcp 10.96.0.10:9153 10.244.0.4:9153,10.244.0.5:9153
tcp 10.96.0.1:443 172.20.6.61:6443
tcp 10.96.100.143:6641 172.20.6.61:6641
tcp 10.96.146.40:6643 172.20.6.61:6643
tcp 10.96.210.107:10665 172.20.6.61:10665
tcp 10.96.220.97:8080 10.244.0.6:8080
tcp 10.96.222.234:10661 172.20.6.61:10661
tcp 10.96.247.174:10660 172.20.6.61:10660
tcp 10.96.68.175:6642 172.20.6.61:6642
b298161a-2218-4447-a410-1c86548f3ba4 cluster-udp-load udp 10.96.0.10:53 10.244.0.4:53,10.244.0.5:53
_uuid : 26e09350-9f60-4dbd-a61b-b9448f3ab531
action : drop
direction : from-lport
external_ids : {parent=ovn.sg.kubeovn_deny_all, vendor=kube-ovn}
label : 0
log : false
match : &amp;#34;inport == @ovn.sg.kubeovn_deny_all &amp;amp;&amp;amp; ip&amp;#34;
meter : []
name : []
options : {}
priority : 2003
sample_est : []
sample_new : []
severity : []
tier : 2
_uuid : 193e7062-2a24-459b-a696-5806a78aab34
action : drop
direction : to-lport
external_ids : {parent=ovn.sg.kubeovn_deny_all, vendor=kube-ovn}
label : 0
log : false
match : &amp;#34;outport == @ovn.sg.kubeovn_deny_all &amp;amp;&amp;amp; ip&amp;#34;
meter : []
name : []
options : {}
priority : 2003
sample_est : []
sample_new : []
severity : []
tier : 2
Chassis &amp;#34;d4527da6-6748-420f-9839-646dbded1df7&amp;#34;
hostname: taroko-m1.kubeantony.com
Encap geneve
ip: &amp;#34;172.20.6.61&amp;#34;
options: {csum=&amp;#34;true&amp;#34;, is_default=&amp;#34;true&amp;#34;}
Port_Binding kube-ovn-pinger-lgml7.kube-system
Port_Binding node-taroko-m1.kubeantony.com
Port_Binding coredns-7d764666f9-c66hz.kube-system
Port_Binding coredns-7d764666f9-nj725.kube-system
54cf
Name: OVN_Southbound
Cluster ID: 218b (218b1cca-afbe-4670-94c0-18f16abb94e3)
Server ID: 54cf (54cf652c-99c9-431b-9bb3-d0dcdffa4bf3)
Address: tcp:[172.20.6.61]:6644
Status: cluster member
Role: leader
Term: 1
Leader: self
Vote: self
Last Election won: 64441 ms ago
Election timer: 5000
Log: [2, 84]
Entries not yet committed: 0
Entries not yet applied: 0
Connections:
Disconnections: 0
Servers:
54cf (54cf at tcp:[172.20.6.61]:6644) (self) next_index=2 match_index=83
status: ok
8f1c
Name: OVN_Northbound
Cluster ID: e5d5 (e5d5a2ef-3b2d-493b-8bff-96396e4d6461)
Server ID: 8f1c (8f1c7a0c-ef84-4d5f-b157-96c2f1ffd614)
Address: tcp:[172.20.6.61]:6643
Status: cluster member
Role: leader
Term: 1
Leader: self
Vote: self
Last Election won: 64879 ms ago
Election timer: 5000
Log: [2, 101]
Entries not yet committed: 0
Entries not yet applied: 0
Connections:
Disconnections: 12
Servers:
8f1c (8f1c at tcp:[172.20.6.61]:6643) (self) next_index=2 match_index=100
status: ok
ds kube-proxy ready
kube-proxy ready
deployment ovn-central ready
deployment kube-ovn-controller ready
ds kube-ovn-cni ready
ds ovs-ovn ready
deployment coredns ready
ovn-nb leader check ok
ovn-sb leader check ok
ovn-northd leader check ok
service/test-node-port created
### kube-ovn-controller recent log
Defaulted container &amp;#34;kube-ovn-controller&amp;#34; out of: kube-ovn-controller, hostpath-init (init)
### start to diagnose node taroko-m1.kubeantony.com
#### ovn-controller log:
Defaulted container &amp;#34;pinger&amp;#34; out of: pinger, hostpath-init (init)
2026-02-05T10:24:09.776Z|00073|binding|INFO|Claiming lport coredns-7d764666f9-c66hz.kube-system for this chassis.
2026-02-05T10:24:09.776Z|00074|binding|INFO|coredns-7d764666f9-c66hz.kube-system: Claiming 3a:e4:49:26:c4:51 10.244.0.5
2026-02-05T10:24:09.777Z|00075|binding|INFO|Setting lport coredns-7d764666f9-c66hz.kube-system ovn-installed in OVS
2026-02-05T10:24:09.784Z|00076|binding|INFO|Setting lport coredns-7d764666f9-c66hz.kube-system up in Southbound
2026-02-05T10:24:10.345Z|00077|binding|INFO|Releasing lport coredns-7d764666f9-r94v9.kube-system from this chassis (sb_readonly=0)
2026-02-05T10:24:10.345Z|00078|binding|INFO|Setting lport coredns-7d764666f9-r94v9.kube-system down in Southbound
2026-02-05T10:24:15.878Z|00079|binding|INFO|Claiming lport kube-ovn-pinger-lgml7.kube-system for this chassis.
2026-02-05T10:24:15.878Z|00080|binding|INFO|kube-ovn-pinger-lgml7.kube-system: Claiming ca:41:f2:66:e8:0b 10.244.0.6
2026-02-05T10:24:15.882Z|00081|binding|INFO|Setting lport kube-ovn-pinger-lgml7.kube-system ovn-installed in OVS
2026-02-05T10:24:15.889Z|00082|binding|INFO|Setting lport kube-ovn-pinger-lgml7.kube-system up in Southbound
#### ovs-vswitchd log:
Defaulted container &amp;#34;pinger&amp;#34; out of: pinger, hostpath-init (init)
2026-02-05T10:23:56.412Z|00041|bridge|INFO|bridge br-int: added interface ovn0 on port 2
2026-02-05T10:23:57.868Z|00042|bridge|INFO|bridge br-int: added interface 7a4d9583419a_h on port 3
2026-02-05T10:23:57.983Z|00043|bridge|INFO|bridge br-int: added interface 99fecbc31137_h on port 4
2026-02-05T10:24:00.369Z|00044|connmgr|INFO|br-int&amp;lt;-&amp;gt;unix#3: 657 flow_mods in the 9 s starting 10 s ago (634 adds, 23 deletes)
2026-02-05T10:24:00.463Z|00045|bridge|INFO|bridge br-int: added interface d10dda60b2bd_h on port 5
2026-02-05T10:24:09.337Z|00046|bridge|INFO|bridge br-int: deleted interface 7a4d9583419a_h on port 3
2026-02-05T10:24:09.775Z|00047|bridge|INFO|bridge br-int: added interface fc4fb4fc28e6_h on port 6
2026-02-05T10:24:10.345Z|00048|bridge|INFO|bridge br-int: deleted interface 99fecbc31137_h on port 4
2026-02-05T10:24:15.876Z|00049|bridge|INFO|bridge br-int: added interface 8ed870f01d82_h on port 7
2026-02-05T10:24:18.249Z|00002|ofproto_dpif_xlate(handler1)|WARN|dropping packet received on port mirror0, which is reserved exclusively for mirroring on bridge br-int while processing icmp6,in_port=1,vlan_tci=0x0000,dl_src=d6:f9:e3:fe:29:40,dl_dst=33:33:00:00:00:02,ipv6_src=fe80::d4f9:e3ff:fefe:2940,ipv6_dst=ff02::2,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,nw_frag=no,icmp_type=133,icmp_code=0
#### ovs-vsctl show results:
Defaulted container &amp;#34;pinger&amp;#34; out of: pinger, hostpath-init (init)
4dcba15a-02ed-4933-860e-d52da853027b
Bridge br-int
fail_mode: secure
datapath_type: system
Port d10dda60b2bd_h
Interface d10dda60b2bd_h
Port ovn0
Interface ovn0
type: internal
Port br-int
Interface br-int
type: internal
Port mirror0
Interface mirror0
type: internal
Port fc4fb4fc28e6_h
Interface fc4fb4fc28e6_h
Port &amp;#34;8ed870f01d82_h&amp;#34;
Interface &amp;#34;8ed870f01d82_h&amp;#34;
ovs_version: &amp;#34;3.5.3&amp;#34;
#### pinger diagnose results:
Defaulted container &amp;#34;pinger&amp;#34; out of: pinger, hostpath-init (init)
I0205 18:24:40.105197 53 pinger.go:21]
-------------------------------------------------------------------------------
Kube-OVN:
Version: v1.15.2
Build: 2026-01-29_08:13:34
Commit: git-0622723
Go Version: go1.25.6
Arch: amd64
-------------------------------------------------------------------------------
I0205 18:24:40.105233 53 pinger.go:24] current capabilities: cap_net_bind_service,cap_net_raw=ep
I0205 18:24:40.153647 53 config.go:202] pinger config is &amp;amp;{KubeConfigFile: KubeClient:0xc000637a40 Port:8080 Interval:5 Mode:job ExitCode:0 InternalDNS:kubernetes.default ExternalDNS: NodeName:taroko-m1.kubeantony.com HostIP:172.20.6.61 PodName:kube-ovn-pinger-lgml7 PodNamespace:kube-system PodIP:10.244.0.6 PodProtocols:[IPv4] LabelSelector:app=kube-ovn-pinger ExternalAddress:1.1.1.1,2606:4700:4700::1111 NetworkMode:kube-ovn EnableMetrics:true PollTimeout:2 PollInterval:15 SystemRunDir:/var/run/openvswitch DatabaseVswitchName:Open_vSwitch DatabaseVswitchSocketRemote:unix:/var/run/openvswitch/db.sock DatabaseVswitchFileDataPath:/etc/openvswitch/conf.db DatabaseVswitchFileLogPath:/var/log/openvswitch/ovsdb-server.log DatabaseVswitchFilePidPath:/var/run/openvswitch/ovsdb-server.pid DatabaseVswitchFileSystemIDPath:/etc/openvswitch/system-id.conf ServiceVswitchdFileLogPath:/var/log/openvswitch/ovs-vswitchd.log ServiceVswitchdFilePidPath:/var/run/openvswitch/ovs-vswitchd.pid ServiceOvnControllerFileLogPath:/var/log/ovn/ovn-controller.log ServiceOvnControllerFilePidPath:/var/run/ovn/ovn-controller.pid EnableVerboseConnCheck:false TCPConnCheckPort:8100 UDPConnCheckPort:8101 TargetIPPorts:tcp-172.20.6.61-31185 LogPerm:640}
I0205 18:24:40.157925 53 ovn.go:36] ovsdb-server and ovs-vswitchd are up
I0205 18:24:40.159364 53 ovn.go:52] ovn-controller is up
I0205 18:24:40.159374 53 ovn.go:60] start to check port binding
I0205 18:24:40.161788 53 ovn.go:66] ports in ovs: coredns-7d764666f9-c66hz.kube-system, coredns-7d764666f9-nj725.kube-system, kube-ovn-pinger-lgml7.kube-system, node-taroko-m1.kubeantony.com
I0205 18:24:40.165161 53 ovn.go:73] ports in sb: coredns-7d764666f9-c66hz.kube-system, coredns-7d764666f9-nj725.kube-system, kube-ovn-pinger-lgml7.kube-system, node-taroko-m1.kubeantony.com
I0205 18:24:40.165170 53 ovn.go:84] ovs and ovn-sb port binding check passed
I0205 18:24:40.165173 53 ping.go:383] start to check apiserver connectivity
I0205 18:24:40.165690 53 ping.go:394] connect to apiserver success in 0.51ms
I0205 18:24:40.165698 53 ping.go:174] start to check pod connectivity
I0205 18:24:40.489218 53 ping.go:220] ping pod: kube-ovn-pinger-lgml7 10.244.0.6, count: 3, loss count 0, average rtt 0.11ms
I0205 18:24:40.489239 53 ping.go:106] start to check node connectivity
I0205 18:24:40.752376 53 ping.go:151] ping node: taroko-m1.kubeantony.com 172.20.6.61, count: 3, loss count 0, average rtt 0.09ms
I0205 18:24:40.752395 53 ping.go:339] start to check dns connectivity
I0205 18:24:40.753552 53 ping.go:356] resolve dns kubernetes.default to [10.96.0.1] in 1.15ms
I0205 18:24:40.753563 53 ping.go:291] start to check Service or externalIPPort connectivity
I0205 18:24:40.753575 53 ping.go:298] checking targetIPPort tcp-172.20.6.61-31185
I0205 18:24:40.754269 53 ping.go:321] TCP connectivity to targetIPPort 172.20.6.61:31185 success
I0205 18:24:40.754281 53 ping.go:255] start to check ping external to 1.1.1.1
I0205 18:24:41.025593 53 ping.go:271] ping external address: 1.1.1.1, total count: 3, loss count 0, average rtt 3.43ms
### finish diagnose node taroko-m1.kubeantony.com
kubectl delete svc -l app=conn-check -n kube-system
service &amp;#34;test-node-port&amp;#34; deleted from kube-system namespace
-------------------------------
,,,,
,::,
,,::,,,,
,,,,,::::::::::::,,,,,
,,,::::::::::::::::::::::,,,
,,::::::::::::::::::::::::::::,,
,,::::::::::::::::::::::::::::::::,,
,::::::::::::::::::::::::::::::::::::,
,:::::::::::::,, ,,:::::,,,::::::::::,
,,:::::::::::::, ,::, ,:::::::::,
,:::::::::::::, :x, ,:: :, ,:::::::::,
,:::::::::::::::, ,,, ,::, ,, ,::::::::::,
,:::::::::::::::::,,,,,,:::::,,,,::::::::::::, ,:, ,:, ,xx, ,:::::, ,:, ,:: :::, ,x
,::::::::::::::::::::::::::::::::::::::::::::, :x: ,:xx: , :xx, :xxxxxxxxx, :xx, ,xx:,xxxx, :x
,::::::::::::::::::::::::::::::::::::::::::::, :xxxxx:, ,xx, :x: :xxx:x::, ::xxxx: :xx:, ,:xxx :xx, ,xx: ,xxxxx:, :x
,::::::::::::::::::::::::::::::::::::::::::::, :xxxxx, :xx, :x: :xxx,,:xx,:xx:,:xx, ,,,,,,,,,xxx, ,xx: :xx:xx: ,xxx,:xx::x
,::::::,,::::::::,,::::::::,,:::::::,,,::::::, :x:,xxx: ,xx, :xx :xx: ,xx,xxxxxx:, ,xxxxxxx:,xxx:, ,xxx, :xxx: ,xxx, :xxxx
,::::, ,::::, ,:::::, ,,::::, ,::::, :x: ,:xx,,:xx::xxxx,,xxx::xx: :xx::::x: ,,,,,, ,xxxxxxxxx, ,xx: ,xxx, :xxx
,::::, ,::::, ,::::, ,::::, ,::::, ,:, ,:, ,,::,,:, ,::::,, ,:::::, ,,:::::, ,, :x: ,::
,::::, ,::::, ,::::, ,::::, ,::::,
,,,,, ,::::, ,::::, ,::::, ,:::, ,,,,,,,,,,,,,
,::::, ,::::, ,::::, ,:::, ,,,:::::::::::::::,
,::::, ,::::, ,::::, ,::::, ,,,,:::::::::,,,,,,,:::,
,::::, ,::::, ,::::, ,::::::::::::,,,,,
,,,, ,::::, ,,,, ,,,::::,,,,
,::::,
,,::,
Thanks for choosing Kube-OVN!
For more advanced features, please read https://kubeovn.github.io/docs/stable/en/
If you have any question, please file an issue https://github.com/kubeovn/kube-ovn/issues/new/choose&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 kube-ovn 安裝成功&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;k -n kube-system get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
coredns-7d764666f9-c66hz 1/1 Running 0 2m47s
coredns-7d764666f9-nj725 1/1 Running 0 2m48s
etcd-taroko-m1.kubeantony.com 1/1 Running 0 6m19s
kube-apiserver-taroko-m1.kubeantony.com 1/1 Running 0 6m17s
kube-controller-manager-taroko-m1.kubeantony.com 1/1 Running 0 6m17s
kube-ovn-cni-v8nl5 1/1 Running 0 2m59s
kube-ovn-controller-6bd89b7549-xj2l6 1/1 Running 0 2m59s
kube-ovn-monitor-5d9bf9858c-sw8lq 1/1 Running 0 2m59s
kube-ovn-pinger-lgml7 1/1 Running 0 2m32s
kube-proxy-8qvlw 1/1 Running 0 6m12s
kube-scheduler-taroko-m1.kubeantony.com 1/1 Running 0 6m17s
kube-vip-taroko-m1.kubeantony.com 1/1 Running 0 5m35s
ovn-central-55d8dfb46c-wqktr 1/1 Running 0 3m30s
ovs-ovn-tctvd 1/1 Running 0 3m30s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;新增其他 Control-plane 節點進 K8s 叢集&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;獲得 Control-plane node Kubeadm Join Command&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubeadm_init_config_file=&amp;#34;${HOME}/k8s/config/kubeadm-init.yaml&amp;#34;
certificate_key=$(sudo kubeadm init phase upload-certs --upload-certs --config ${kubeadm_init_config_file} | tail -n 1)
join_cmd=$(sudo kubeadm token create --print-join-command)
join_cp_cmd=&amp;#34;sudo $join_cmd --control-plane --certificate-key $certificate_key&amp;#34;
echo $join_cp_cmd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token j1d0fh.3se96b07m4h4gst6 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6 --control-plane --certificate-key 1e2dd91966c34bbc34602c07415bc30cf58348e96275b72f475b6c0001986e47&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至其他 Control-plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Control-plane 2 節點加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token j1d0fh.3se96b07m4h4gst6 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6 --control-plane --certificate-key 1e2dd91966c34bbc34602c07415bc30cf58348e96275b72f475b6c0001986e47&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ssh 連到第三台 control plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Control-plane 3 節點加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token j1d0fh.3se96b07m4h4gst6 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6 --control-plane --certificate-key 1e2dd91966c34bbc34602c07415bc30cf58348e96275b72f475b6c0001986e47&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;新增 Worker 節點進 K8s 叢集&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在第一台 Controlplane 將 join worker node 指令 print 出來&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm token create --print-join-command&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubeadm join api-taroko.kubeantony.com:6443 --token q2djge.km9ms68fttqidlj7 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至 worker node 1&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 worker node 1 加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token q2djge.km9ms68fttqidlj7 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至 worker node 2&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 worker node 2 加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token q2djge.km9ms68fttqidlj7 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至 worker node 3&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 worker node 3 加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join api-taroko.kubeantony.com:6443 --token q2djge.km9ms68fttqidlj7 --discovery-token-ca-cert-hash sha256:8f41e3f883eed0f27055c5146da5c0de5a739ef2d4282417d2ea2bdc8c0ccaf6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;回到第一台 Control-plane 執行以下命令，將所有 worker nodes 都貼 label&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl label node taroko-w1.kubeantony.com node-role.kubernetes.io/worker=
kubectl label node taroko-w2.kubeantony.com node-role.kubernetes.io/worker=
kubectl label node taroko-w3.kubeantony.com node-role.kubernetes.io/worker=&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 K8s 狀態是否正常&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;檢視 K8s node 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
taroko-m1.kubeantony.com Ready control-plane 20m v1.35.0
taroko-m2.kubeantony.com Ready control-plane 7m35s v1.35.0
taroko-m3.kubeantony.com Ready control-plane 7m1s v1.35.0
taroko-w1.kubeantony.com Ready worker 105s v1.35.0
taroko-w2.kubeantony.com Ready worker 99s v1.35.0
taroko-w3.kubeantony.com Ready worker 94s v1.35.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 kube-system namespace 底下所有 pods 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
coredns-7d764666f9-c66hz 1/1 Running 0 18m
coredns-7d764666f9-nj725 1/1 Running 0 18m
etcd-taroko-m1.kubeantony.com 1/1 Running 0 21m
etcd-taroko-m2.kubeantony.com 1/1 Running 0 8m13s
etcd-taroko-m3.kubeantony.com 1/1 Running 0 7m40s
kube-apiserver-taroko-m1.kubeantony.com 1/1 Running 0 21m
kube-apiserver-taroko-m2.kubeantony.com 1/1 Running 0 8m13s
kube-apiserver-taroko-m3.kubeantony.com 1/1 Running 0 7m40s
kube-controller-manager-taroko-m1.kubeantony.com 1/1 Running 0 21m
kube-controller-manager-taroko-m2.kubeantony.com 1/1 Running 0 8m13s
kube-controller-manager-taroko-m3.kubeantony.com 1/1 Running 0 7m40s
kube-ovn-cni-qrx5m 1/1 Running 0 2m13s
kube-ovn-cni-r2bjz 1/1 Running 0 7m40s
kube-ovn-cni-v8nl5 1/1 Running 0 18m
kube-ovn-cni-wcqdd 1/1 Running 0 2m18s
kube-ovn-cni-xfgqv 1/1 Running 0 2m24s
kube-ovn-cni-zkwxj 1/1 Running 0 8m14s
kube-ovn-controller-6bd89b7549-xj2l6 1/1 Running 0 18m
kube-ovn-monitor-5d9bf9858c-sw8lq 1/1 Running 0 18m
kube-ovn-pinger-dtm8w 1/1 Running 0 112s
kube-ovn-pinger-h5sqd 1/1 Running 0 104s
kube-ovn-pinger-lbd48 1/1 Running 0 113s
kube-ovn-pinger-lgml7 1/1 Running 0 17m
kube-proxy-5kf45 1/1 Running 0 7m40s
kube-proxy-8qvlw 1/1 Running 0 21m
kube-proxy-c2vbq 1/1 Running 0 2m13s
kube-proxy-ct7jn 1/1 Running 0 8m14s
kube-proxy-nfb9w 1/1 Running 0 2m18s
kube-proxy-xnkwj 1/1 Running 0 2m24s
kube-scheduler-taroko-m1.kubeantony.com 1/1 Running 0 21m
kube-scheduler-taroko-m2.kubeantony.com 1/1 Running 0 8m13s
kube-scheduler-taroko-m3.kubeantony.com 1/1 Running 0 7m40s
kube-vip-taroko-m1.kubeantony.com 1/1 Running 0 20m
kube-vip-taroko-m2.kubeantony.com 1/1 Running 0 8m13s
kube-vip-taroko-m3.kubeantony.com 1/1 Running 0 7m40s
ovn-central-55d8dfb46c-wqktr 1/1 Running 0 18m
ovs-ovn-8rg8h 1/1 Running 0 2m18s
ovs-ovn-b2zmj 1/1 Running 0 2m24s
ovs-ovn-ch9jw 1/1 Running 0 7m40s
ovs-ovn-ft9m8 1/1 Running 0 2m13s
ovs-ovn-nq67b 1/1 Running 0 8m14s
ovs-ovn-tctvd 1/1 Running 0 18m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢測 K8s 網路延遲和吞吐量&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;安裝 cilium 指令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
CLI_ARCH=amd64
if [ &amp;#34;$(uname -m)&amp;#34; = &amp;#34;aarch64&amp;#34; ]; then CLI_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;透過 cilium 指令檢測 K8s 網路頻寬&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cilium connectivity perf \
--crr \
--host-to-pod \
--pod-to-host \
--node-selector-client kubernetes.io/hostname=taroko-w1.kubeantony.com \
--node-selector-server kubernetes.io/hostname=taroko-w2.kubeantony.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;🔥 [taroko-ovn] Deleting connectivity check deployments...
✨ [taroko-ovn] Creating namespace cilium-test-1 for connectivity check...
ℹ️ Nodes used for performance testing:
ℹ️ * Node name: taroko-w2.kubeantony.com, zone:
ℹ️ * Node name: taroko-w1.kubeantony.com, zone:
✨ [taroko-ovn] Deploying perf-client deployment...
✨ [taroko-ovn] Deploying perf-client-other-node deployment...
✨ [taroko-ovn] Deploying perf-server deployment...
✨ [taroko-ovn] Deploying perf-client-host-net deployment...
✨ [taroko-ovn] Deploying perf-client-other-node-host-net deployment...
✨ [taroko-ovn] Deploying perf-server-host-net deployment...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-client to become ready...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-client-other-node to become ready...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-server to become ready...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-client-host-net to become ready...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-client-other-node-host-net to become ready...
⌛ [taroko-ovn] Waiting for deployment cilium-test-1/perf-server-host-net to become ready...
ℹ️ Cilium version: 0.0.0
🏃[cilium-test-1] Running 1 tests ...
[=] [cilium-test-1] Test [network-perf] [1/1]
................................
🔥 Network Performance Test Summary [cilium-test-1]:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Min | Mean | Max | P50 | P90 | P99 | Transaction rate OP/s
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_CRR | 10s | 60µs | 85.91µs | 677µs | 82µs | 98µs | 125µs | 11615.84
📋 pod-to-pod | same-node | TCP_RR | 10s | 14µs | 29.22µs | 695µs | 28µs | 33µs | 48µs | 34070.14
📋 pod-to-host | same-node | TCP_CRR | 10s | 74µs | 88.54µs | 179µs | 86µs | 96µs | 120µs | 474.50
📋 pod-to-host | same-node | TCP_RR | 10s | 18µs | 29.87µs | 1.801ms | 29µs | 33µs | 49µs | 33340.49
📋 host-to-pod | same-node | TCP_CRR | 10s | 82µs | 96.1µs | 189µs | 92µs | 113µs | 137µs | 11.60
📋 host-to-pod | same-node | TCP_RR | 10s | 16µs | 29.97µs | 716µs | 29µs | 33µs | 48µs | 33217.61
📋 host-to-host | same-node | TCP_CRR | 10s | 59µs | 76.15µs | 683µs | 73µs | 84µs | 118µs | 13101.67
📋 host-to-host | same-node | TCP_RR | 10s | 15µs | 28.35µs | 700µs | 28µs | 31µs | 46µs | 35113.98
📋 pod-to-pod | other-node | TCP_CRR | 10s | 242µs | 293.67µs | 1.817ms | 290µs | 323µs | 381µs | 2641.99
📋 pod-to-pod | other-node | TCP_RR | 10s | 96µs | 121.1µs | 1.509ms | 118µs | 137µs | 167µs | 8245.27
📋 pod-to-host | other-node | TCP_CRR | 10s | 246µs | 1.07221ms | 3.071576s | 293µs | 329µs | 400µs | 926.89
📋 pod-to-host | other-node | TCP_RR | 10s | 93µs | 135.28µs | 1.03699s | 118µs | 137µs | 169µs | 7382.95
📋 host-to-pod | other-node | TCP_CRR | 10s | 246µs | 299.94µs | 2.051ms | 296µs | 325µs | 386µs | 3331.08
📋 host-to-pod | other-node | TCP_RR | 10s | 98µs | 121.49µs | 1.927ms | 118µs | 137µs | 168µs | 8218.90
📋 host-to-host | other-node | TCP_CRR | 10s | 190µs | 230.35µs | 1.95ms | 227µs | 255µs | 305µs | 4336.79
📋 host-to-host | other-node | TCP_RR | 10s | 85µs | 107.45µs | 3.69ms | 106µs | 120µs | 148µs | 9292.06
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Throughput Mb/s
----------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_STREAM | 10s | 11263.46
📋 pod-to-pod | same-node | TCP_STREAM_MULTI | 10s | 41560.29
📋 pod-to-host | same-node | TCP_STREAM | 10s | 10561.07
📋 pod-to-host | same-node | TCP_STREAM_MULTI | 10s | 40874.81
📋 host-to-pod | same-node | TCP_STREAM | 10s | 11463.51
📋 host-to-pod | same-node | TCP_STREAM_MULTI | 10s | 42231.56
📋 host-to-host | same-node | TCP_STREAM | 10s | 26166.77
📋 host-to-host | same-node | TCP_STREAM_MULTI | 10s | 96386.74
📋 pod-to-pod | other-node | TCP_STREAM | 10s | 2823.65
📋 pod-to-pod | other-node | TCP_STREAM_MULTI | 10s | 4573.82
📋 pod-to-host | other-node | TCP_STREAM | 10s | 2886.42
📋 pod-to-host | other-node | TCP_STREAM_MULTI | 10s | 4405.81
📋 host-to-pod | other-node | TCP_STREAM | 10s | 2828.99
📋 host-to-pod | other-node | TCP_STREAM_MULTI | 10s | 5137.81
📋 host-to-host | other-node | TCP_STREAM | 10s | 9404.16
📋 host-to-host | other-node | TCP_STREAM_MULTI | 10s | 9407.35
----------------------------------------------------------------------------------------
✅ [cilium-test-1] All 1 tests (32 actions) successful, 0 tests skipped, 0 scenarios skipped.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Podman build Multi-Arch Images</title><link>https://blog.kubeantony.com/archive/container/podman-build-multi-arch-images/</link><pubDate>Wed, 28 Jan 2026 06:36:54 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/podman-build-multi-arch-images/</guid><description>
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;撰寫 go 範例程式&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano hello.go&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;package main
import (
&amp;#34;fmt&amp;#34;
&amp;#34;net/http&amp;#34;
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, &amp;#34;Hello&amp;#34;)
}
func main() {
http.HandleFunc(&amp;#34;/&amp;#34;, handler)
http.ListenAndServe(&amp;#34;:8080&amp;#34;, nil)
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 Dockerfile&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano Dockerfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY . .
# 利用 Go 的環境變數進行交叉編譯
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /build/hello hello.go
# 最後階段
FROM scratch
COPY --from=builder /build/hello /usr/local/bin/hello
CMD [&amp;#34;/usr/local/bin/hello&amp;#34;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;初始化 image manifest&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman manifest create hello&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;413534f46ca55438f717d734a4e088af1a92b003c6c837cf5753b6808161b125&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;build image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman build --platform linux/amd64,linux/arm64 --manifest localhost/hello .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[linux/arm64] [1/2] STEP 1/6: FROM docker.io/library/golang:1.22 AS builder
[linux/arm64] [1/2] STEP 2/6: ARG TARGETOS
--&amp;gt; 6af98f118a47
[linux/arm64] [1/2] STEP 3/6: ARG TARGETARCH
--&amp;gt; de656f2a8f6b
[linux/arm64] [1/2] STEP 4/6: WORKDIR /app
--&amp;gt; 2e367870d334
[linux/arm64] [1/2] STEP 5/6: COPY . .
--&amp;gt; 6ad772c2ca91
[linux/arm64] [1/2] STEP 6/6: RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /build/hello hello.go
--&amp;gt; 30515c7aaf86
[linux/arm64] [2/2] STEP 1/3: FROM scratch
[linux/arm64] [2/2] STEP 2/3: COPY --from=builder /build/hello /usr/local/bin/hello
--&amp;gt; 4ac0f5942408
[linux/arm64] [2/2] STEP 3/3: CMD [&amp;#34;/usr/local/bin/hello&amp;#34;]
[linux/arm64] [2/2] COMMIT
--&amp;gt; 6251d8b5a1f3
[linux/amd64] [1/2] STEP 1/6: FROM docker.io/library/golang:1.22 AS builder
6251d8b5a1f392aed47bc124a0bd3f2b7c18f3d4ba9681ea153e853bf5d23370
[linux/amd64] [1/2] STEP 2/6: ARG TARGETOS
--&amp;gt; Using cache 6af98f118a47e4fbbcaff838816b73e31d7f5bd72e4b546baf82b026fe424662
--&amp;gt; 6af98f118a47
[linux/amd64] [1/2] STEP 3/6: ARG TARGETARCH
--&amp;gt; Using cache de656f2a8f6bc7fc0e3f97eaaff21df053837e3d0e1a97f659a8a0ca40e2bb4a
--&amp;gt; de656f2a8f6b
[linux/amd64] [1/2] STEP 4/6: WORKDIR /app
--&amp;gt; Using cache 2e367870d3341f7f57dbf1a1924281e277a645ecb29f031a979ea6f656ef2c07
--&amp;gt; 2e367870d334
[linux/amd64] [1/2] STEP 5/6: COPY . .
--&amp;gt; Using cache 6ad772c2ca9135caef7c1fbeb79c126b36638dccab3b8eac884642020f330b4a
--&amp;gt; 6ad772c2ca91
[linux/amd64] [1/2] STEP 6/6: RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /build/hello hello.go
--&amp;gt; afbe26b87b3c
[linux/amd64] [2/2] STEP 1/3: FROM scratch
[linux/amd64] [2/2] STEP 2/3: COPY --from=builder /build/hello /usr/local/bin/hello
--&amp;gt; 6dcdcf58bf83
[linux/amd64] [2/2] STEP 3/3: CMD [&amp;#34;/usr/local/bin/hello&amp;#34;]
[linux/amd64] [2/2] COMMIT
--&amp;gt; b6c0da75b480
b6c0da75b480acb9283ba0978937fe3668490c17bd39739a02211b1079227752&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman images localhost/hello:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;REPOSITORY TAG IMAGE ID CREATED SIZE
&amp;lt;none&amp;gt; &amp;lt;none&amp;gt; b6c0da75b480 20 minutes ago 7.07 MB
localhost/hello latest 413534f46ca5 25 minutes ago 1.04 kB&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 image manifest&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman manifest inspect localhost/hello:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{
&amp;#34;schemaVersion&amp;#34;: 2,
&amp;#34;mediaType&amp;#34;: &amp;#34;application/vnd.docker.distribution.manifest.list.v2&amp;#43;json&amp;#34;,
&amp;#34;manifests&amp;#34;: [
{
&amp;#34;mediaType&amp;#34;: &amp;#34;application/vnd.oci.image.manifest.v1&amp;#43;json&amp;#34;,
&amp;#34;size&amp;#34;: 498,
&amp;#34;digest&amp;#34;: &amp;#34;sha256:48c8c68bc197b35831750d260600d3eb6c127ac64463d8f26d4f369e801ec4dd&amp;#34;,
&amp;#34;platform&amp;#34;: {
&amp;#34;architecture&amp;#34;: &amp;#34;arm64&amp;#34;,
&amp;#34;os&amp;#34;: &amp;#34;linux&amp;#34;
}
},
{
&amp;#34;mediaType&amp;#34;: &amp;#34;application/vnd.oci.image.manifest.v1&amp;#43;json&amp;#34;,
&amp;#34;size&amp;#34;: 498,
&amp;#34;digest&amp;#34;: &amp;#34;sha256:27a5911345bd07fc3461092bb0b7c5fb52fed1e35f4dd27eaf0cf833e2c19860&amp;#34;,
&amp;#34;platform&amp;#34;: {
&amp;#34;architecture&amp;#34;: &amp;#34;amd64&amp;#34;,
&amp;#34;os&amp;#34;: &amp;#34;linux&amp;#34;
}
}
]
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Push the manifest and included images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman manifest push localhost/hello:latest docker://quay.io/myuser/image:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Step by step install HA Kubernetes with Kubeadm in Disconnected environment</title><link>https://blog.kubeantony.com/archive/kubernetes/step-by-step-install-ha-kubernetes-with-kubeadm-in-disconnected-environment/</link><pubDate>Fri, 23 Jan 2026 12:22:46 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/step-by-step-install-ha-kubernetes-with-kubeadm-in-disconnected-environment/</guid><description>
&lt;h2&gt;0. Preface&lt;span class="hx:absolute hx:-mt-20" id="0-preface"&gt;&lt;/span&gt;
&lt;a href="#0-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章會介紹，如何在全離線的環境下，在多台 VM 上使用 &lt;code&gt;kubeadm&lt;/code&gt; 安裝 3 台 Control-plane Node 和 3 台 Worker Node 架構的 Kubernetes Cluster&lt;/p&gt;
&lt;h3&gt;0.1. 環境架構規劃&lt;span class="hx:absolute hx:-mt-20" id="01-環境架構規劃"&gt;&lt;/span&gt;
&lt;a href="#01-%e7%92%b0%e5%a2%83%e6%9e%b6%e6%a7%8b%e8%a6%8f%e5%8a%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJVAgQ0aex.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;1. 準備 K8s 全離線安裝包&lt;span class="hx:absolute hx:-mt-20" id="1-準備-k8s-全離線安裝包"&gt;&lt;/span&gt;
&lt;a href="#1-%e6%ba%96%e5%82%99-k8s-%e5%85%a8%e9%9b%a2%e7%b7%9a%e5%ae%89%e8%a3%9d%e5%8c%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1.1. 準備 K8s 軟體套件&lt;span class="hx:absolute hx:-mt-20" id="11-準備-k8s-軟體套件"&gt;&lt;/span&gt;
&lt;a href="#11-%e6%ba%96%e5%82%99-k8s-%e8%bb%9f%e9%ab%94%e5%a5%97%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;連線到一台 Disk 空間 70G 或以上, 可以透過網路正常連線到公有網路的 RHEL 9 電腦&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;註冊 RHEL 9&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo rhc connect --activation-key $ACTIVATION-KEY --organization $ORGANIZATION&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 Kubernetes 和 CRI-O 版本&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;KUBERNETES_VERSION=v1.34
CRIO_VERSION=v1.34&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加 Kubernetes yum repository&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/rpm/repodata/repomd.xml.key
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加 CRI-O yum repository&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/yum.repos.d/cri-o.repo
[cri-o]
name=CRI-O
baseurl=https://download.opensuse.org/repositories/isv:/cri-o:/stable:/$CRIO_VERSION/rpm/
enabled=1
gpgcheck=1
gpgkey=https://download.opensuse.org/repositories/isv:/cri-o:/stable:/$CRIO_VERSION/rpm/repodata/repomd.xml.key
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p &amp;#34;$HOME&amp;#34;/k8s/{addon/{cni/cilium,csi/nfs-provisioner,ingress/ingress-nginx,metrics/metrics-server,logging/{fluentd,logging-operator},kube-vip/{ha-control-plane,k8s-lb-service}},img,pkg/{kubernetes,podman,skopeo},config}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;目錄結構如下&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tree &amp;#34;$HOME&amp;#34;/k8s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/home/bigred/k8s
├── addon
│   ├── cni
│   │   └── cilium
│   ├── csi
│   │   └── nfs-provisioner
│   ├── ingress
│   │   └── ingress-nginx
│   ├── kube-vip
│   │   ├── ha-control-plane
│   │   └── k8s-lb-service
│   ├── logging
│   │   ├── fluentd
│   │   └── logging-operator
│   └── metrics
│   └── metrics-server
├── config
├── img
└── pkg
├── kubernetes
├── podman
└── skopeo
21 directories, 0 files&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將必要套件載入指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum install --downloadonly --downloaddir=&amp;#34;$HOME&amp;#34;/k8s/pkg/kubernetes -y \
crun \
runc \
cri-o \
kubeadm \
kubectl \
kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視已載入的套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ls -lh &amp;#34;$HOME&amp;#34;/k8s/pkg/kubernetes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;total 78M
-rw-r--r--. 1 root root 240K Oct 16 16:28 conntrack-tools-1.4.7-4.el9_5.x86_64.rpm
-rw-r--r--. 1 root root 66K Oct 16 16:28 container-selinux-2.235.0-1.el9_6.noarch.rpm
-rw-r--r--. 1 root root 21M Oct 16 16:28 cri-o-1.34.1-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 7.3M Oct 16 16:28 cri-tools-1.34.0-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 563K Oct 16 16:28 criu-3.19-1.el9.x86_64.rpm
-rw-r--r--. 1 root root 33K Oct 16 16:28 criu-libs-3.19-1.el9.x86_64.rpm
-rw-r--r--. 1 root root 244K Oct 16 16:28 crun-1.23.1-2.el9_6.x86_64.rpm
-rw-r--r--. 1 root root 13M Oct 16 16:28 kubeadm-1.34.1-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 12M Oct 16 16:28 kubectl-1.34.1-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 13M Oct 16 16:28 kubelet-1.34.1-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 8.6M Oct 16 16:28 kubernetes-cni-1.7.1-150500.1.1.x86_64.rpm
-rw-r--r--. 1 root root 60K Oct 16 16:28 libnet-1.2-7.el9.x86_64.rpm
-rw-r--r--. 1 root root 26K Oct 16 16:28 libnetfilter_cthelper-1.0.0-22.el9.x86_64.rpm
-rw-r--r--. 1 root root 26K Oct 16 16:28 libnetfilter_cttimeout-1.0.0-19.el9.x86_64.rpm
-rw-r--r--. 1 root root 31K Oct 16 16:28 libnetfilter_queue-1.0.5-1.el9.x86_64.rpm
-rw-r--r--. 1 root root 38K Oct 16 16:28 protobuf-c-1.3.3-13.el9.x86_64.rpm
-rw-r--r--. 1 root root 3.6M Oct 16 16:28 runc-1.2.4-2.el9.x86_64.rpm
-rw-r--r--. 1 root root 42K Oct 16 16:28 yajl-2.1.0-25.el9.x86_64.rpm&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載並準備 podman pkg&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum install --downloadonly --downloaddir=&amp;#34;$HOME&amp;#34;/k8s/pkg/podman -y \
podman&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視已載入的套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ls -l &amp;#34;$HOME&amp;#34;/k8s/pkg/podman&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;total 24048
-rw-r--r--. 1 bigred bigred 902510 Oct 16 16:59 aardvark-dns-1.14.0-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 55519 Oct 16 16:59 conmon-2.1.12-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 158417 Oct 16 16:59 containers-common-1-117.el9_6.x86_64.rpm
-rw-r--r--. 1 bigred bigred 67105 Oct 16 16:59 container-selinux-2.235.0-1.el9_6.noarch.rpm
-rw-r--r--. 1 bigred bigred 576009 Oct 16 16:59 criu-3.19-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 33643 Oct 16 16:59 criu-libs-3.19-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 249255 Oct 16 16:59 crun-1.23.1-2.el9_6.x86_64.rpm
-rw-r--r--. 1 bigred bigred 58706 Oct 16 16:59 fuse3-3.10.2-9.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 95573 Oct 16 16:59 fuse3-libs-3.10.2-9.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 8750 Oct 16 16:59 fuse-common-3.10.2-9.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 71022 Oct 16 16:59 fuse-overlayfs-1.14-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 61278 Oct 16 16:59 libnet-1.2-7.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 71992 Oct 16 16:59 libslirp-4.4.0-8.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 3846970 Oct 16 16:59 netavark-1.14.1-1.el9_6.x86_64.rpm
-rw-r--r--. 1 bigred bigred 268131 Oct 16 16:59 &amp;#39;passt-0^20250217.ga1e48a0-10.el9_6.x86_64.rpm&amp;#39;
-rw-r--r--. 1 bigred bigred 27658 Oct 16 16:59 &amp;#39;passt-selinux-0^20250217.ga1e48a0-10.el9_6.noarch.rpm&amp;#39;
-rw-r--r--. 1 bigred bigred 17803252 Oct 16 16:59 podman-5.4.0-13.el9_6.x86_64.rpm
-rw-r--r--. 1 bigred bigred 38224 Oct 16 16:59 protobuf-c-1.3.3-13.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 90389 Oct 16 16:59 shadow-utils-subid-4.9-12.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 50387 Oct 16 16:59 slirp4netns-1.3.2-1.el9.x86_64.rpm
-rw-r--r--. 1 bigred bigred 42487 Oct 16 16:59 yajl-2.1.0-25.el9.x86_64.rpm&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載並準備 skopeo pkg&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum install --downloadonly --downloaddir=&amp;#34;$HOME&amp;#34;/k8s/pkg/skopeo -y \
skopeo&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視已載入的套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ls -l &amp;#34;$HOME&amp;#34;/k8s/pkg/skopeo&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;total 9308
-rw-r--r--. 1 root root 9530108 Oct 17 10:19 skopeo-1.18.1-2.el9_6.x86_64.rpm&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.2. 準備 kubeadm 要安裝 K8s 所需的 images&lt;span class="hx:absolute hx:-mt-20" id="12-準備-kubeadm-要安裝-k8s-所需的-images"&gt;&lt;/span&gt;
&lt;a href="#12-%e6%ba%96%e5%82%99-kubeadm-%e8%a6%81%e5%ae%89%e8%a3%9d-k8s-%e6%89%80%e9%9c%80%e7%9a%84-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;列出安裝 kubeadm 要安裝 K8s 所需的 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubeadm config images list | tee ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;registry.k8s.io/kube-apiserver:v1.34.1
registry.k8s.io/kube-controller-manager:v1.34.1
registry.k8s.io/kube-scheduler:v1.34.1
registry.k8s.io/kube-proxy:v1.34.1
registry.k8s.io/coredns/coredns:v1.12.1
registry.k8s.io/pause:3.10.1
registry.k8s.io/etcd:3.6.4-0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 K8s images 備份到指定目錄中&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(cat ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(cat ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/all-K8s-Components-v1.34.1.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;拷貝 K8s 所有 components 的 images 到 Harbor 的 library project 中&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(cat ${HOME}/k8s/img/img-list.txt); do skopeo copy docker://${i} docker://${i/registry.k8s.io/${HARBOR_FQDN}/library}; done&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;1.2.3. 準備 ingress-nginx &lt;code&gt;v1.13.3&lt;/code&gt; 所需之 images 和安裝 yaml&lt;span class="hx:absolute hx:-mt-20" id="123-準備-ingress-nginx-v1133-所需之-images-和安裝-yaml"&gt;&lt;/span&gt;
&lt;a href="#123-%e6%ba%96%e5%82%99-ingress-nginx-v1133-%e6%89%80%e9%9c%80%e4%b9%8b-images-%e5%92%8c%e5%ae%89%e8%a3%9d-yaml" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;找到 ingress-nginx &lt;code&gt;v1.13.3&lt;/code&gt; 所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INGRESS_NGINX_VERSION=&amp;#34;v1.13.3&amp;#34;
curl -s https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-${INGRESS_NGINX_VERSION}/deploy/static/provider/cloud/deploy.yaml | grep image: | sort -u | tr -s &amp;#34; &amp;#34; | cut -d &amp;#34; &amp;#34; -f 3 | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;registry.k8s.io/ingress-nginx/controller:v1.13.3@sha256:1b044f6dcac3afbb59e05d98463f1dec6f3d3fb99940bc12ca5d80270358e3bd
registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.3@sha256:3d671cf20a35cd94efc5dcd484970779eb21e7938c98fbc3673693b8a117cf39&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Ingress-nginx Controller image 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep ingress-nginx ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; podman tag ${i} ${i%@*};done
podman save -m $(grep ingress-nginx ${HOME}/k8s/img/img-list.txt | cut -d &amp;#34;@&amp;#34; -f 1) &amp;gt; ${HOME}/k8s/img/ingress-nginx-controller-v1.13.3.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將安裝 yaml 下載至指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -so ${HOME}/k8s/addon/ingress/ingress-nginx/deploy.yaml https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-${INGRESS_NGINX_VERSION}/deploy/static/provider/cloud/deploy.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.3. 準備 kube-vip &lt;code&gt;v1.0.1&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="13-準備-kube-vip-v101-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#13-%e6%ba%96%e5%82%99-kube-vip-v101-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定環境資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;export VIP=&amp;#34;172.20.6.110&amp;#34;
export VIPSUBSET=&amp;#34;16&amp;#34;
export INTERFACE=&amp;#34;ens18&amp;#34;
KVVERSION=&amp;#34;v1.0.1&amp;#34;
alias kube-vip=&amp;#34;sudo podman run --network host --rm ghcr.io/kube-vip/kube-vip:$KVVERSION&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;產生 kube-vip static pod yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kube-vip manifest pod \
--interface $INTERFACE \
--address $VIP \
--vipSubnet $VIPSUBSET \
--controlplane \
--arp \
--leaderElection | tee ${HOME}/k8s/addon/kube-vip/ha-control-plane/kube-vip-static-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;上述參數沒有 &lt;code&gt;--service&lt;/code&gt; 是因為 control-plane 的 static pod 不需要管理 loadbalancer type service&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;產生 kube-vip daemonset yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kube-vip manifest daemonset \
--interface $INTERFACE \
--vipSubnet $VIPSUBSET \
--services \
--arp \
--leaderElection \
--servicesElection | tee ${HOME}/k8s/addon/kube-vip/k8s-lb-service/kube-vip-ds.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 kube-vip Cloud Provider yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -so ${HOME}/k8s/addon/kube-vip/k8s-lb-service/kube-vip-cloud-controller.yaml https://raw.githubusercontent.com/kube-vip/kube-vip-cloud-provider/main/manifest/kube-vip-cloud-controller.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 kube-vip daemonset 所需之 rbac.yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -so ${HOME}/k8s/addon/kube-vip/k8s-lb-service/kube-vip-rbac.yaml https://kube-vip.io/manifests/rbac.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 Kubevip 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;find ${HOME}/k8s/addon/kube-vip -name &amp;#34;*.yaml&amp;#34; -type f -exec cat {} \; | grep image: | tr -s &amp;#34; &amp;#34; | uniq | cut -d &amp;#34; &amp;#34; -f 3 | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ghcr.io/kube-vip/kube-vip:v1.0.1
ghcr.io/kube-vip/kube-vip-cloud-provider:v0.0.12&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 kube-vip images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(tail -n 2 ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(tail -n 2 ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/kube-vip-v1.0.1.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.4. 準備 Metrics Server &lt;code&gt;v0.8.0&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="14-準備-metrics-server-v080-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#14-%e6%ba%96%e5%82%99-metrics-server-v080-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 Metrics Server 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;METRICS_SERVER_VERSION=&amp;#34;v0.8.0&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載安裝 yaml 到指定路徑&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sLo ${HOME}/k8s/addon/metrics/metrics-server/components.yaml https://github.com/kubernetes-sigs/metrics-server/releases/download/${METRICS_SERVER_VERSION}/components.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 Metrics Server 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;find ${HOME}/k8s/addon/metrics/metrics-server -name &amp;#34;*.yaml&amp;#34; -type f -exec cat {} \; | grep image: | tr -s &amp;#34; &amp;#34; | uniq | cut -d &amp;#34; &amp;#34; -f 3 | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;registry.k8s.io/metrics-server/metrics-server:v0.8.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Metrics Server image 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep metrics-server ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(grep metrics-server ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/metrics-server-${METRICS_SERVER_VERSION}.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.5. 準備 Fluentd &lt;code&gt;v1.19.0&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="15-準備-fluentd-v1190-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#15-%e6%ba%96%e5%82%99-fluentd-v1190-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 Fluentd 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;FLUENTED_VERSION=&amp;#34;v1.19.0-1.1&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載安裝 yaml 到指定路徑&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sLo ${HOME}/k8s/addon/logging/fluentd/fluentd-daemonset-syslog.yaml https://raw.githubusercontent.com/fluent/fluentd-kubernetes-daemonset/refs/tags/${FLUENTED_VERSION}/fluentd-daemonset-syslog.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sed -i &amp;#34;s|version: v1|version: ${FLUENTED_VERSION}|g&amp;#34; fluentd-daemonset-syslog.yaml
sed -i &amp;#34;s|v1-debian-syslog|v1.19.0-debian-syslog-amd64-1.1|g&amp;#34; fluentd-daemonset-syslog.yaml
sed -i &amp;#39;s|fluent/fluentd-kubernetes-daemonset|docker.io/fluent/fluentd-kubernetes-daemonset|g&amp;#39; fluentd-daemonset-syslog.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 fluentd 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;find ${HOME}/k8s/addon/logging/fluentd -name &amp;#34;*.yaml&amp;#34; -type f -exec cat {} \; | grep image: | tr -s &amp;#34; &amp;#34; | uniq | cut -d &amp;#34; &amp;#34; -f 3 | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;docker.io/fluent/fluentd-kubernetes-daemonset:v1.19.0-debian-syslog-amd64-1.1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 fluentd image 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep fluentd ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(grep fluentd ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/fluentd-kubernetes-daemonset-v1.19.0-debian-syslog-amd64-1.1.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.6. 準備 cilium &lt;code&gt;1.18.2&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="16-準備-cilium-1182-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#16-%e6%ba%96%e5%82%99-cilium-1182-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 helm 和 cilium 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HELM_VERSION=&amp;#34;v3.19.0&amp;#34;
CILIUM_VERSION=&amp;#34;1.18.2&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 helm Binary&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sLo ${HOME}/k8s/addon/cni/cilium/helm-${HELM_VERSION}-linux-amd64.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;添加 Cilium Helm repository&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm repo add cilium https://helm.cilium.io/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 cilium chart file&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm fetch cilium/cilium --version=${CILIUM_VERSION} -d ${HOME}/k8s/addon/cni/cilium/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 helm values yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;bpf:
masquerade: true
hubble:
relay:
enabled: true
ui:
enabled: true
service:
type: NodePort
ipam:
mode: kubernetes
ipv4NativeRoutingCIDR: 10.244.0.0/16
k8sServiceHost: 172.20.6.10
k8sServicePort: 6443
kubeProxyReplacement: true&amp;#39; &amp;gt; ${HOME}/k8s/addon/cni/cilium/custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 cilium 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm template ${HOME}/k8s/addon/cni/cilium/cilium-${CILIUM_VERSION}.tgz -f ${HOME}/k8s/addon/cni/cilium/custom-values.yaml | awk &amp;#39;$1 ~ /image:/ {print $2}&amp;#39; | sed -e &amp;#39;s/\&amp;#34;//g&amp;#39; | sort -u | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;quay.io/cilium/cilium-envoy:v1.34.7-1757592137-1a52bb680a956879722f48c591a2ca90f7791324@sha256:7932d656b63f6f866b6732099d33355184322123cfe1182e6f05175a3bc2e0e0
quay.io/cilium/cilium:v1.18.2@sha256:858f807ea4e20e85e3ea3240a762e1f4b29f1cb5bbd0463b8aa77e7b097c0667
quay.io/cilium/hubble-relay:v1.18.2@sha256:6079308ee15e44dff476fb522612732f7c5c4407a1017bc3470916242b0405ac
quay.io/cilium/hubble-ui-backend:v0.13.3@sha256:db1454e45dc39ca41fbf7cad31eec95d99e5b9949c39daaad0fa81ef29d56953
quay.io/cilium/hubble-ui:v0.13.3@sha256:661d5de7050182d495c6497ff0b007a7a1e379648e60830dd68c4d78ae21761d
quay.io/cilium/operator-generic:v1.18.2@sha256:cb4e4ffc5789fd5ff6a534e3b1460623df61cba00f5ea1c7b40153b5efb81805&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 cilium images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep &amp;#34;quay.io/cilium&amp;#34; ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; podman tag ${i} ${i%@*}; done
podman save -m $(grep &amp;#34;quay.io/cilium&amp;#34; ${HOME}/k8s/img/img-list.txt | cut -d &amp;#34;@&amp;#34; -f 1) &amp;gt; ${HOME}/k8s/img/cilium-${CILIUM_VERSION}.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 Cilium CLI&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)
CLI_ARCH=amd64
if [ &amp;#34;$(uname -m)&amp;#34; = &amp;#34;aarch64&amp;#34; ]; then CLI_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 Hubble Client&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HUBBLE_VERSION=&amp;#34;$(curl -s https://raw.githubusercontent.com/cilium/hubble/master/stable.txt)&amp;#34;
HUBBLE_ARCH=amd64
if [ &amp;#34;$(uname -m)&amp;#34; = &amp;#34;aarch64&amp;#34; ]; then HUBBLE_ARCH=arm64; fi
curl -L --fail --remote-name-all https://github.com/cilium/hubble/releases/download/$HUBBLE_VERSION/hubble-linux-${HUBBLE_ARCH}.tar.gz{,.sha256sum}
sha256sum --check hubble-linux-${HUBBLE_ARCH}.tar.gz.sha256sum&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;準備 cilium 測試網路效能 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin
cilium connectivity perf --print-image-artifacts | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;quay.io/cilium/network-perf:1751527436-c2462ae@sha256:0c491ed7ca63e6c526593b3a2d478f856410a50fbbce7fe2b64283c3015d752f&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 cilium 測試網路效能 images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep &amp;#34;network-perf&amp;#34; ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; podman tag ${i} ${i%@*}; done
podman save $(grep &amp;#34;network-perf&amp;#34; ${HOME}/k8s/img/img-list.txt | cut -d &amp;#34;@&amp;#34; -f 1) &amp;gt; ${HOME}/k8s/img/cilium-network-perf.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.7. 準備 NFS subdir external provisioner &lt;code&gt;v4.0.2&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="17-準備-nfs-subdir-external-provisioner-v402-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#17-%e6%ba%96%e5%82%99-nfs-subdir-external-provisioner-v402-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 NFS provisioner 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NFS_PROVISIONER_VERSION=&amp;#34;v4.0.2&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載安裝 yaml 到指定路徑&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;git clone --no-checkout --depth=1 --filter=tree:0 https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner.git ${HOME}/k8s/addon/csi/nfs-provisioner/nfs-subdir-external-provisioner
cd ${HOME}/k8s/addon/csi/nfs-provisioner/nfs-subdir-external-provisioner
git sparse-checkout set --no-cone /deploy
git checkout
mv ${HOME}/k8s/addon/csi/nfs-provisioner/nfs-subdir-external-provisioner/deploy/ ${HOME}/k8s/addon/csi/nfs-provisioner/
sudo rm -r ${HOME}/k8s/addon/csi/nfs-provisioner/nfs-subdir-external-provisioner
sed -i &amp;#34;s|busybox:stable|docker.io/library/busybox:stable|g&amp;#34; ${HOME}/k8s/addon/csi/nfs-provisioner/deploy/test-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 &lt;code&gt;kustomization.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;namespace: nfs-provisioner
bases:
- ./deploy
resources:
- namespace.yaml
patchesStrategicMerge:
- patch_nfs_details.yaml&amp;#39; &amp;gt; ${HOME}/k8s/addon/csi/nfs-provisioner/kustomization.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 &lt;code&gt;namespace.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;# namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: nfs-provisioner&amp;#39; &amp;gt; ${HOME}/k8s/addon/csi/nfs-provisioner/namespace.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 &lt;code&gt;patch_nfs_details.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nfs-client-provisioner
name: nfs-client-provisioner
spec:
template:
spec:
containers:
- name: nfs-client-provisioner
env:
- name: NFS_SERVER
value: 172.20.6.9
- name: NFS_PATH
value: /k8s
volumes:
- name: nfs-client-root
nfs:
server: 172.20.6.9
path: /k8s&amp;#39; &amp;gt; ${HOME}/k8s/addon/csi/nfs-provisioner/patch_nfs_details.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 nfs-provisioner 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;find ${HOME}/k8s/addon/csi/nfs-provisioner -name &amp;#34;*.yaml&amp;#34; -type f -exec cat {} \; | grep image: | tr -s &amp;#34; &amp;#34; | uniq | cut -d &amp;#34; &amp;#34; -f 3 | tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;registry.k8s.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
docker.io/library/busybox:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 nfs-provisioner images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep -E &amp;#34;nfs-subdir-external-provisioner|busybox&amp;#34; ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(grep -E &amp;#34;nfs-subdir-external-provisioner|busybox&amp;#34; ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/nfs-provisioner-${NFS_PROVISIONER_VERSION}.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.8. 準備 Ingress NGINX &lt;code&gt;v1.13.3&lt;/code&gt; 所需之 images 和 yaml 檔&lt;span class="hx:absolute hx:-mt-20" id="18-準備-ingress-nginx-v1133-所需之-images-和-yaml-檔"&gt;&lt;/span&gt;
&lt;a href="#18-%e6%ba%96%e5%82%99-ingress-nginx-v1133-%e6%89%80%e9%9c%80%e4%b9%8b-images-%e5%92%8c-yaml-%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 Ingress NGINX 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INGRESS_NGINX=&amp;#34;v1.13.3&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載部署 Ingress NGINX YAML&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sLo ${HOME}/k8s/addon/ingress/ingress-nginx/deployment.yaml \
https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-${INGRESS_NGINX}/deploy/static/provider/baremetal/deploy.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 deployment 轉成 daemonset&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano daemonSet.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
name: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx
namespace: ingress-nginx
rules:
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- namespaces
verbs:
- get
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- configmaps
- pods
- secrets
- endpoints
verbs:
- get
- list
- watch
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- coordination.k8s.io
resourceNames:
- ingress-nginx-leader
resources:
- leases
verbs:
- get
- update
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- events
verbs:
- create
- patch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
namespace: ingress-nginx
rules:
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- secrets
verbs:
- get
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx
rules:
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- configmaps
- endpoints
- nodes
- pods
- secrets
- namespaces
verbs:
- list
- watch
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- list
- watch
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- nodes
verbs:
- get
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- &amp;#34;&amp;#34;
resources:
- events
verbs:
- create
- patch
- apiGroups:
- networking.k8s.io
resources:
- ingresses/status
verbs:
- update
- apiGroups:
- networking.k8s.io
resources:
- ingressclasses
verbs:
- get
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
rules:
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
verbs:
- get
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx
namespace: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
namespace: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ingress-nginx-admission
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: ingress-nginx
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress-nginx-admission
subjects:
- kind: ServiceAccount
name: ingress-nginx-admission
namespace: ingress-nginx
---
apiVersion: v1
data: null
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-controller
namespace: ingress-nginx
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
externalTrafficPolicy: Local
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- appProtocol: http
name: http
port: 80
protocol: TCP
targetPort: http
- appProtocol: https
name: https
port: 443
protocol: TCP
targetPort: https
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-controller-admission
namespace: ingress-nginx
spec:
ports:
- appProtocol: https
name: https-webhook
port: 443
targetPort: webhook
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
type: ClusterIP
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
selector:
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
template:
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
spec:
automountServiceAccountToken: true
containers:
- args:
- /nginx-ingress-controller
- --election-id=ingress-nginx-leader
- --controller-class=k8s.io/ingress-nginx
- --ingress-class=nginx
- --configmap=$(POD_NAMESPACE)/ingress-nginx-controller
- --validating-webhook=:8443
- --validating-webhook-certificate=/usr/local/certificates/cert
- --validating-webhook-key=/usr/local/certificates/key
- --enable-metrics=false
- --report-node-internal-ip-address=true
- --watch-ingress-without-class=true
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: LD_PRELOAD
value: /usr/local/lib/libmimalloc.so
image: registry.k8s.io/ingress-nginx/controller:v1.13.3@sha256:1b044f6dcac3afbb59e05d98463f1dec6f3d3fb99940bc12ca5d80270358e3bd
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
livenessProbe:
failureThreshold: 5
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: controller
ports:
- containerPort: 80
name: http
protocol: TCP
hostPort: 80
- containerPort: 443
name: https
protocol: TCP
hostPort: 443
- containerPort: 8443
name: webhook
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
requests:
cpu: 100m
memory: 90Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
readOnlyRootFilesystem: false
runAsGroup: 82
runAsNonRoot: true
runAsUser: 101
seccompProfile:
type: RuntimeDefault
volumeMounts:
- mountPath: /usr/local/certificates/
name: webhook-cert
readOnly: true
dnsPolicy: ClusterFirst
nodeSelector:
kubernetes.io/os: linux
serviceAccountName: ingress-nginx
terminationGracePeriodSeconds: 300
volumes:
- name: webhook-cert
secret:
secretName: ingress-nginx-admission
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission-create
namespace: ingress-nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission-create
spec:
automountServiceAccountToken: true
containers:
- args:
- create
- --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name=ingress-nginx-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.3@sha256:3d671cf20a35cd94efc5dcd484970779eb21e7938c98fbc3673693b8a117cf39
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
ttlSecondsAfterFinished: 0
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission-patch
namespace: ingress-nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission-patch
spec:
automountServiceAccountToken: true
containers:
- args:
- patch
- --webhook-name=ingress-nginx-admission
- --namespace=$(POD_NAMESPACE)
- --patch-mutating=false
- --secret-name=ingress-nginx-admission
- --patch-failure-policy=Fail
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.3@sha256:3d671cf20a35cd94efc5dcd484970779eb21e7938c98fbc3673693b8a117cf39
imagePullPolicy: IfNotPresent
name: patch
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
ttlSecondsAfterFinished: 0
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: nginx
spec:
controller: k8s.io/ingress-nginx
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.13.3
name: ingress-nginx-admission
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: ingress-nginx-controller-admission
namespace: ingress-nginx
path: /networking/v1/ingresses
port: 443
failurePolicy: Fail
matchPolicy: Equivalent
name: validate.nginx.ingress.kubernetes.io
rules:
- apiGroups:
- networking.k8s.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- ingresses
sideEffects: None&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 ingress nginx 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;find ${HOME}/k8s/addon/ingress/ingress-nginx \
-name &amp;#34;daemonSet.yaml&amp;#34; \
-type f \
-exec grep image: {} &amp;#43; | \
tr -s &amp;#34; &amp;#34; | \
cut -d &amp;#34; &amp;#34; -f 3 | \
sort -u | \
uniq | \
tee -a ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;registry.k8s.io/ingress-nginx/controller:v1.13.3@sha256:1b044f6dcac3afbb59e05d98463f1dec6f3d3fb99940bc12ca5d80270358e3bd
registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.3@sha256:3d671cf20a35cd94efc5dcd484970779eb21e7938c98fbc3673693b8a117cf39&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 ingress nginx images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep &amp;#34;ingress-nginx&amp;#34; ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; podman tag ${i} ${i%@*}; done
podman save -m $(grep &amp;#34;ingress-nginx&amp;#34; ${HOME}/k8s/img/img-list.txt | cut -d &amp;#34;@&amp;#34; -f 1) &amp;gt; ${HOME}/k8s/img/ingress-nginx-controller-${INGRESS_NGINX}.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.9. 準備 logging operator &lt;code&gt;6.1.0&lt;/code&gt; 所需之 images&lt;span class="hx:absolute hx:-mt-20" id="19-準備-logging-operator-610-所需之-images"&gt;&lt;/span&gt;
&lt;a href="#19-%e6%ba%96%e5%82%99-logging-operator-610-%e6%89%80%e9%9c%80%e4%b9%8b-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 logging operator 版本變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;LOGGING_OPERATOR=&amp;#34;6.1.0&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 logging operator chart file&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm pull oci://ghcr.io/kube-logging/helm-charts/logging-operator \
--version ${LOGGING_OPERATOR} \
-d ${HOME}/k8s/addon/logging/logging-operator/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 logging operator 執行所需之 images&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;ghcr.io/kube-logging/logging-operator:6.1.0
ghcr.io/axoflow/axosyslog:4.18.1
ghcr.io/kube-logging/logging-operator/fluentd:6.1.0-full
ghcr.io/kube-logging/logging-operator/syslog-ng-reloader:6.1.0
ghcr.io/kube-logging/logging-operator/config-reloader:6.1.0
ghcr.io/kube-logging/logging-operator/fluentd-drain-watch:6.1.0
ghcr.io/kube-logging/logging-operator/node-exporter:6.1.0
ghcr.io/axoflow/axosyslog-metrics-exporter:0.0.13&amp;#39; &amp;gt;&amp;gt; ${HOME}/k8s/img/img-list.txt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 logging operator images 備份到指定目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in $(grep -E &amp;#34;kube-logging|axoflow&amp;#34; ${HOME}/k8s/img/img-list.txt); do podman pull ${i}; done
podman save -m $(grep -E &amp;#34;kube-logging|axoflow&amp;#34; ${HOME}/k8s/img/img-list.txt) &amp;gt; ${HOME}/k8s/img/kube-logging-${LOGGING_OPERATOR}.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.10. 將整個工作目錄打包並匯入全離線的主機&lt;span class="hx:absolute hx:-mt-20" id="110-將整個工作目錄打包並匯入全離線的主機"&gt;&lt;/span&gt;
&lt;a href="#110-%e5%b0%87%e6%95%b4%e5%80%8b%e5%b7%a5%e4%bd%9c%e7%9b%ae%e9%8c%84%e6%89%93%e5%8c%85%e4%b8%a6%e5%8c%af%e5%85%a5%e5%85%a8%e9%9b%a2%e7%b7%9a%e7%9a%84%e4%b8%bb%e6%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;壓縮出全離線安裝包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ~; tar -zcvf k8s-v1.34.1.tar.gz k8s/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視全離線安裝包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ls -lh ${HOME}/k8s-v1.34.1.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;-rw-r--r--. 1 bigred bigred 1.5G Oct 17 17:25 /home/bigred/k8s-v1.34.1.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將檔案上傳至所有全離線的 K8s 叢集主機，包含可上傳 image 至 Harbor 的主機&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;scp ${HOME}/k8s-v1.34.1.tar.gz user_name@vm_ipaddress:.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.11. 將離線安裝所需之 Container Images 匯入 Harbor&lt;span class="hx:absolute hx:-mt-20" id="111-將離線安裝所需之-container-images-匯入-harbor"&gt;&lt;/span&gt;
&lt;a href="#111-%e5%b0%87%e9%9b%a2%e7%b7%9a%e5%ae%89%e8%a3%9d%e6%89%80%e9%9c%80%e4%b9%8b-container-images-%e5%8c%af%e5%85%a5-harbor" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;先決條件：已安裝好 Harbor&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;連線到可將 image tar 檔上傳至 Harbor 的主機&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh user@ipaddress&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;定義 Harbor FQDN&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=harbor.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 Harbor CA 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo curl -k \
-o /etc/pki/ca-trust/source/anchors/harbor-ca.crt \
https://${HARBOR_FQDN}/api/v2.0/systeminfo/getcert&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;更新系統的 CA 信任清單，讓 HTTPS 連線時能信任此憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo update-ca-trust&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 podman 信任 Harbor 自簽 CA 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir /etc/containers/certs.d/${HARBOR_FQDN}
sudo curl -k \
-o /etc/containers/certs.d/${HARBOR_FQDN}/ca.crt \
https://${HARBOR_FQDN}/api/v2.0/systeminfo/getcert&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;登入 harbor&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman login ${HARBOR_FQDN}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Username: admin
Password:
Login Succeeded!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;上傳所有 container images 至 Harbor&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ~/k8s/img; ./imgctl.sh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Load All Images Successfully
Currnt: 1/29 harbor.example.com/library/kube-apiserver:v1.34.1 push ok
Currnt: 2/29 harbor.example.com/library/kube-controller-manager:v1.34.1 push ok
Currnt: 3/29 harbor.example.com/library/kube-scheduler:v1.34.1 push ok
Currnt: 4/29 harbor.example.com/library/kube-proxy:v1.34.1 push ok
Currnt: 5/29 harbor.example.com/library/coredns/coredns:v1.12.1 push ok
Currnt: 6/29 harbor.example.com/library/pause:3.10.1 push ok
Currnt: 7/29 harbor.example.com/library/etcd:3.6.4-0 push ok
Currnt: 8/29 harbor.example.com/library/ingress-nginx/controller:v1.13.3@sha256:1b044f6dcac3afbb59e05d98463f1dec6f3d3fb99940bc12ca5d80270358e3bd push ok
Currnt: 9/29 harbor.example.com/library/ingress-nginx/kube-webhook-certgen:v1.6.3@sha256:3d671cf20a35cd94efc5dcd484970779eb21e7938c98fbc3673693b8a117cf39 push ok
Currnt: 10/29 harbor.example.com/library/kube-vip/kube-vip:v1.0.1 push ok
Currnt: 11/29 harbor.example.com/library/kube-vip/kube-vip-cloud-provider:v0.0.12 push ok
Currnt: 12/29 harbor.example.com/library/metrics-server/metrics-server:v0.8.0 push ok
Currnt: 13/29 harbor.example.com/library/fluent/fluentd-kubernetes-daemonset:v1.19.0-debian-syslog-amd64-1.1 push ok
Currnt: 14/29 harbor.example.com/library/cilium/cilium-envoy:v1.34.7-1757592137-1a52bb680a956879722f48c591a2ca90f7791324@sha256:7932d656b63f6f866b6732099d33355184322123cfe1182e6f05175a3bc2e0e0 push ok
Currnt: 15/29 harbor.example.com/library/cilium/cilium:v1.18.2@sha256:858f807ea4e20e85e3ea3240a762e1f4b29f1cb5bbd0463b8aa77e7b097c0667 push ok
Currnt: 16/29 harbor.example.com/library/cilium/hubble-relay:v1.18.2@sha256:6079308ee15e44dff476fb522612732f7c5c4407a1017bc3470916242b0405ac push ok
Currnt: 17/29 harbor.example.com/library/cilium/hubble-ui-backend:v0.13.3@sha256:db1454e45dc39ca41fbf7cad31eec95d99e5b9949c39daaad0fa81ef29d56953 push ok
Currnt: 18/29 harbor.example.com/library/cilium/hubble-ui:v0.13.3@sha256:661d5de7050182d495c6497ff0b007a7a1e379648e60830dd68c4d78ae21761d push ok
Currnt: 19/29 harbor.example.com/library/cilium/operator-generic:v1.18.2@sha256:cb4e4ffc5789fd5ff6a534e3b1460623df61cba00f5ea1c7b40153b5efb81805 push ok
Currnt: 20/29 harbor.example.com/library/sig-storage/nfs-subdir-external-provisioner:v4.0.2 push ok
Currnt: 21/29 harbor.example.com/library/library/busybox:stable push ok
Currnt: 22/29 harbor.example.com/library/kube-logging/logging-operator:6.1.0 push ok
Currnt: 23/29 harbor.example.com/library/axoflow/axosyslog:4.18.1 push ok
Currnt: 24/29 harbor.example.com/library/kube-logging/logging-operator/fluentd:6.1.0-full push ok
Currnt: 25/29 harbor.example.com/library/kube-logging/logging-operator/syslog-ng-reloader:6.1.0 push ok
Currnt: 26/29 harbor.example.com/library/kube-logging/logging-operator/config-reloader:6.1.0 push ok
Currnt: 27/29 harbor.example.com/library/kube-logging/logging-operator/fluentd-drain-watch:6.1.0 push ok
Currnt: 28/29 harbor.example.com/library/kube-logging/logging-operator/node-exporter:6.1.0 push ok
Currnt: 29/29 harbor.example.com/library/axoflow/axosyslog-metrics-exporter:0.0.13 push ok&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2&gt;2. 建置 HA K8s 前置作業&lt;span class="hx:absolute hx:-mt-20" id="2-建置-ha-k8s-前置作業"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%bb%ba%e7%bd%ae-ha-k8s-%e5%89%8d%e7%bd%ae%e4%bd%9c%e6%a5%ad" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;2.1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="21-先決條件"&gt;&lt;/span&gt;
&lt;a href="#21-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;已將 K8s 全離線安裝包(檔名:&lt;code&gt;k8s-v1.34.1.tar.gz&lt;/code&gt;)匯入 K8s 叢集中的每一台主機&lt;/li&gt;
&lt;li&gt;已將 Harbor 自簽 root CA 憑證匯入匯入 K8s 叢集中的每一台 (Harbor 如果不是自簽 root CA 則不用做到此步驟)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.2. 連線至 K8s 的第一台 Control-plane 節點&lt;span class="hx:absolute hx:-mt-20" id="22-連線至-k8s-的第一台-control-plane-節點"&gt;&lt;/span&gt;
&lt;a href="#22-%e9%80%a3%e7%b7%9a%e8%87%b3-k8s-%e7%9a%84%e7%ac%ac%e4%b8%80%e5%8f%b0-control-plane-%e7%af%80%e9%bb%9e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;ssh 連線至第一台 Control-plane 節點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh user@ipaddress&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.3. 關閉 Firewalld Systemd Service&lt;span class="hx:absolute hx:-mt-20" id="23-關閉--firewalld-systemd-service"&gt;&lt;/span&gt;
&lt;a href="#23-%e9%97%9c%e9%96%89--firewalld-systemd-service" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;關閉 Firewalld Systemd Service&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl disable --now firewalld.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.4. 調整 SELinux 為 &lt;code&gt;permissive&lt;/code&gt; mode&lt;span class="hx:absolute hx:-mt-20" id="24-調整-selinux-為-permissive-mode"&gt;&lt;/span&gt;
&lt;a href="#24-%e8%aa%bf%e6%95%b4-selinux-%e7%82%ba-permissive-mode" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;調整 SELinux 為 &lt;code&gt;permissive&lt;/code&gt; mode&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# Set SELinux in permissive mode (effectively disabling it)
sudo setenforce 0
sudo sed -i &amp;#39;s/^SELINUX=enforcing$/SELINUX=permissive/&amp;#39; /etc/selinux/config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.5. 確認 SWAP 已關閉&lt;span class="hx:absolute hx:-mt-20" id="25-確認-swap-已關閉"&gt;&lt;/span&gt;
&lt;a href="#25-%e7%a2%ba%e8%aa%8d-swap-%e5%b7%b2%e9%97%9c%e9%96%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;確認 SWAP 已關閉&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;free -mh&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; total used free shared buff/cache available
Mem: 7.5Gi 530Mi 6.2Gi 8.0Mi 1.0Gi 7.0Gi
Swap: 0B 0B 0B&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;確認 swap 欄位的值都是 &lt;code&gt;0&lt;/code&gt; B&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.6. 確認 Kernel 版本 &amp;gt;= 5.10&lt;span class="hx:absolute hx:-mt-20" id="26-確認-kernel-版本--510"&gt;&lt;/span&gt;
&lt;a href="#26-%e7%a2%ba%e8%aa%8d-kernel-%e7%89%88%e6%9c%ac--510" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;確認 Kernel 版本 &amp;gt;= 5.10&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;uname -r&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;5.14.0-570.52.1.el9_6.x86_64&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.7. 添加必要 Kernel Modules&lt;span class="hx:absolute hx:-mt-20" id="27-添加必要-kernel-modules"&gt;&lt;/span&gt;
&lt;a href="#27-%e6%b7%bb%e5%8a%a0%e5%bf%85%e8%a6%81-kernel-modules" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;永久添加 &lt;code&gt;br_netfilter&lt;/code&gt; 和 &lt;code&gt;overlay&lt;/code&gt; Kernel Modules&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;立即啟用 &lt;code&gt;br_netfilter&lt;/code&gt; 和 &lt;code&gt;overlay&lt;/code&gt; Kernel Modules&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo modprobe overlay
sudo modprobe br_netfilter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證已載入 &lt;code&gt;br_netfilter&lt;/code&gt; 和 &lt;code&gt;overlay&lt;/code&gt; Kernel Modules&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo lsmod | grep -E &amp;#34;overlay|br_netfilter&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;br_netfilter 36864 0
bridge 417792 1 br_netfilter
overlay 229376 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.8. 添加必要 Kernel Parameters&lt;span class="hx:absolute hx:-mt-20" id="28-添加必要-kernel-parameters"&gt;&lt;/span&gt;
&lt;a href="#28-%e6%b7%bb%e5%8a%a0%e5%bf%85%e8%a6%81-kernel-parameters" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;永久添加必要 Kernel Parameters&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | sudo tee /etc/sysctl.d/99-k8s-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;立即載入 Kernel Parameters&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sysctl --system&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 &lt;code&gt;net.bridge.bridge-nf-call-iptables&lt;/code&gt;, &lt;code&gt;net.bridge.bridge-nf-call-ip6tables&lt;/code&gt;, 和 &lt;code&gt;net.ipv4.ip_forward&lt;/code&gt; 的值都設成 &lt;code&gt;1&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.9. 解壓縮 K8s 全離線安裝包&lt;span class="hx:absolute hx:-mt-20" id="29-解壓縮-k8s-全離線安裝包"&gt;&lt;/span&gt;
&lt;a href="#29-%e8%a7%a3%e5%a3%93%e7%b8%ae-k8s-%e5%85%a8%e9%9b%a2%e7%b7%9a%e5%ae%89%e8%a3%9d%e5%8c%85" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定 K8s 全離線安裝包所在的目錄變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;PREFIX=&amp;#34;$HOME&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;解壓縮 K8s 全離線安裝包&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf &amp;#34;$PREFIX&amp;#34;/k8s-v1.34.1.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
tar: k8s/img/ingress-nginx-controller-v1.13.3.tar: time stamp 2025-10-20 14:18:13 is 166476.992186816 s in the future
k8s/config/
tar: k8s/img: time stamp 2025-10-20 14:34:01 is 167424.992012128 s in the future&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.10. 安裝所有必要軟體套件&lt;span class="hx:absolute hx:-mt-20" id="210-安裝所有必要軟體套件"&gt;&lt;/span&gt;
&lt;a href="#210-%e5%ae%89%e8%a3%9d%e6%89%80%e6%9c%89%e5%bf%85%e8%a6%81%e8%bb%9f%e9%ab%94%e5%a5%97%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;安裝所有必要軟體套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum localinstall &amp;#34;$HOME&amp;#34;/k8s/pkg/kubernetes/*.rpm&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.11. 確認節點可以透過 DNS 解析到 harbor&lt;span class="hx:absolute hx:-mt-20" id="211-確認節點可以透過-dns-解析到-harbor"&gt;&lt;/span&gt;
&lt;a href="#211-%e7%a2%ba%e8%aa%8d%e7%af%80%e9%bb%9e%e5%8f%af%e4%bb%a5%e9%80%8f%e9%81%8e-dns-%e8%a7%a3%e6%9e%90%e5%88%b0-harbor" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;定義 Harbor FQDN 變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=harbor.example.com
DOMAIN_NAME_SYSTEM_SERVER=172.20.6.11&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認節點可以透過 DNS 解析到 harbor&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;dig @$DOMAIN_NAME_SYSTEM_SERVER $HARBOR_FQDN &amp;#43;short&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;172.20.7.32&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.12. 啟動 CRI-O Service 並設為開機自動啟動&lt;span class="hx:absolute hx:-mt-20" id="212-啟動-cri-o-service-並設為開機自動啟動"&gt;&lt;/span&gt;
&lt;a href="#212-%e5%95%9f%e5%8b%95-cri-o-service-%e4%b8%a6%e8%a8%ad%e7%82%ba%e9%96%8b%e6%a9%9f%e8%87%aa%e5%8b%95%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;啟動 CRI-O Service 並設為開機自動啟動&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now crio.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 CRI-O Service 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status crio.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● crio.service - Container Runtime Interface for OCI (CRI-O)
Loaded: loaded (/usr/lib/systemd/system/crio.service; enabled; preset: disabled)
Active: active (running) since Sat 2025-10-18 16:48:59 CST; 1min 18s ago
Docs: https://github.com/cri-o/cri-o
Main PID: 5734 (crio)
Tasks: 7
Memory: 20.0M
CPU: 126ms
CGroup: /system.slice/crio.service
└─5734 /usr/bin/crio
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314737723&amp;#43;08:00&amp;#34; le…cher&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314774402&amp;#43;08:00&amp;#34; le…face&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314808872&amp;#43;08:00&amp;#34; le…bled&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314814672&amp;#43;08:00&amp;#34; le…ated&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314820552&amp;#43;08:00&amp;#34; le… NRI&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314823302&amp;#43;08:00&amp;#34; le…p...&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314825973&amp;#43;08:00&amp;#34; le…s...&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314833213&amp;#43;08:00&amp;#34; le…tate&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com crio[5734]: time=&amp;#34;2025-10-18T16:48:59.314882773&amp;#43;08:00&amp;#34; le…bled&amp;#34;
Oct 18 16:48:59 topgun-c1.kubeantony.com systemd[1]: Started Container Runtime Interface for OCI (…I-O).
Hint: Some lines were ellipsized, use -l to show in full.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.13. 設定 private registry 驗證&lt;span class="hx:absolute hx:-mt-20" id="213-設定-private-registry-驗證"&gt;&lt;/span&gt;
&lt;a href="#213-%e8%a8%ad%e5%ae%9a-private-registry-%e9%a9%97%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;將 Harbor 自簽 ca 憑證上傳至主機家目錄&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 Harbor 自簽 ca 憑證所在的目錄和 CA 憑證檔名為變數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CA_PREFIX=&amp;#34;$HOME&amp;#34;
CA_FILE_NAME=&amp;#34;ca.pem&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;讓 RHEL 信任 Harbor 自簽 ca 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp &amp;#34;$CA_PREFIX&amp;#34;/&amp;#34;$CA_FILE_NAME&amp;#34; /etc/pki/ca-trust/source/anchors/harbor-ca.crt
sudo update-ca-trust&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 CRI-O 設定檔，告訴它去哪裡讀取全域的認證資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/crio/crio.conf.d/10-crio.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;新增 &lt;code&gt;global_auth_file&lt;/code&gt; 那一行：指定 CRI-O 讀取 Docker 格式的全域認證檔案路徑
還有 &lt;code&gt;pause_image&lt;/code&gt; 這行，如果沒指定這行預設還是會到 K8s 的 image repo 去拉
還有 &lt;code&gt;conmon_cgroup&lt;/code&gt; 和 &lt;code&gt;cgroup_manager&lt;/code&gt; 也要指定在 &lt;code&gt;crio.runtime&lt;/code&gt; 區塊底下&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[crio.image]
signature_policy = &amp;#34;/etc/crio/policy.json&amp;#34;
global_auth_file = &amp;#34;/etc/crio/registries.d/auth.json&amp;#34;
pause_image=&amp;#34;harbor.example.com/library/pause:3.10.1&amp;#34;
[crio.runtime]
default_runtime = &amp;#34;crun&amp;#34;
conmon_cgroup = &amp;#34;pod&amp;#34;
cgroup_manager = &amp;#34;systemd&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立存放認證檔案的目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/crio/registries.d/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 Harbor Registry 的 FQDN (網域名稱) 變數，方便後續使用&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=harbor.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 podman 登入 Harbor，並將產生的認證 token 儲存到 CRI-O 指定的 auth.json 檔案中&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman login $HARBOR_FQDN --authfile /etc/crio/registries.d/auth.json&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證認證檔案是否已成功建立&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cat /etc/crio/registries.d/auth.json&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{
&amp;#34;auths&amp;#34;: {
&amp;#34;harbor.example.com&amp;#34;: {
&amp;#34;auth&amp;#34;: &amp;#34;YWRtaW46SGFyYm9yMTIzNDU=&amp;#34;
}
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 system-wide 的 registry 設定檔，供 Podman, CRI-O, Skopeo 等工具共用&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/containers/registries.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;注意，Harbor FQDN 每個環境會不同。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[[registry]]
location = &amp;#34;harbor.example.com&amp;#34;
insecure = false &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重新啟動 CRI-O 服務，使其載入所有新的設定 (10-crio.conf 和 registries.conf)&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl restart crio&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用 crictl (CRI 的客戶端工具) 測試是否能成功從私有 Harbor 拉取映像檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo crictl pull ${HARBOR_FQDN}/library/library/busybox:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;成功執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Image is up to date for harbor.example.com/library/library/busybox@sha256:f0d4f96113b0ebc3bc741b49cc158254ddd91bbba8dba20281b2dacd2da4a45f&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;清理測試，移除剛剛拉取的映像檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo crictl rmi ${HARBOR_FQDN}/library/library/busybox:stable&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.14. 設定 kubelet service node ip&lt;span class="hx:absolute hx:-mt-20" id="214-設定-kubelet-service-node-ip"&gt;&lt;/span&gt;
&lt;a href="#214-%e8%a8%ad%e5%ae%9a-kubelet-service-node-ip" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;指定節點 internal ip&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INTERFACE=ens18
IPV4_IP=$(ip -4 a s $INTERFACE | awk &amp;#39;/inet / {print $2}&amp;#39; | cut -d&amp;#39;/&amp;#39; -f1)
sudo sed -i \
-e &amp;#39;/^KUBELET_EXTRA_ARGS=$/s/$/\&amp;#34;--node-ip=&amp;#39;&amp;#34;$IPV4_IP&amp;#34;&amp;#39;\&amp;#34;/&amp;#39; \
/etc/sysconfig/kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢查是否正確修改&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /etc/sysconfig/kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;KUBELET_EXTRA_ARGS=&amp;#34;--node-ip=172.20.6.111&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.15. 在執行 kubeadm 之前啟用 kubelet 服務&lt;span class="hx:absolute hx:-mt-20" id="215-在執行-kubeadm-之前啟用-kubelet-服務"&gt;&lt;/span&gt;
&lt;a href="#215-%e5%9c%a8%e5%9f%b7%e8%a1%8c-kubeadm-%e4%b9%8b%e5%89%8d%e5%95%9f%e7%94%a8-kubelet-%e6%9c%8d%e5%8b%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;啟動 kubelet 服務&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now kubelet.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.16. 設定 NTP 校時&lt;span class="hx:absolute hx:-mt-20" id="216-設定-ntp-校時"&gt;&lt;/span&gt;
&lt;a href="#216-%e8%a8%ad%e5%ae%9a-ntp-%e6%a0%a1%e6%99%82" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯 chrony 設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/chrony.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;#pool 2.rhel.pool.ntp.org iburst
server 172.20.6.249 iburst&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重啟 chronyd 服務&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl restart chronyd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認是否成功校時&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo chronyc sources&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.20.6.249 3 6 377 20 -64us[ -237us] &amp;#43;/- 19ms&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;2.16. 在其他所有 K8s 節點重複執行所有步驟 2.2. ~ 2.16.&lt;span class="hx:absolute hx:-mt-20" id="216-在其他所有-k8s-節點重複執行所有步驟-22--216"&gt;&lt;/span&gt;
&lt;a href="#216-%e5%9c%a8%e5%85%b6%e4%bb%96%e6%89%80%e6%9c%89-k8s-%e7%af%80%e9%bb%9e%e9%87%8d%e8%a4%87%e5%9f%b7%e8%a1%8c%e6%89%80%e6%9c%89%e6%ad%a5%e9%a9%9f-22--216" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;hr&gt;
&lt;h2&gt;3. 透過 kubeadm 開始建立 HA K8s&lt;span class="hx:absolute hx:-mt-20" id="3-透過-kubeadm-開始建立-ha-k8s"&gt;&lt;/span&gt;
&lt;a href="#3-%e9%80%8f%e9%81%8e-kubeadm-%e9%96%8b%e5%a7%8b%e5%bb%ba%e7%ab%8b-ha-k8s" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;3.1. 設定 kube-vip (單台 Control-plane 可跳過此步驟)&lt;span class="hx:absolute hx:-mt-20" id="31-設定-kube-vip-單台-control-plane-可跳過此步驟"&gt;&lt;/span&gt;
&lt;a href="#31-%e8%a8%ad%e5%ae%9a-kube-vip-%e5%96%ae%e5%8f%b0-control-plane-%e5%8f%af%e8%b7%b3%e9%81%8e%e6%ad%a4%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至第一台 Control-plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 kube-vip static pod 拷貝到 &lt;code&gt;/etc/kubernetes/manifests/&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp &amp;#34;$HOME&amp;#34;/k8s/addon/kube-vip/ha-control-plane/kube-vip-static-pod.yaml /etc/kubernetes/manifests/kube-vip.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 kube-vip 的 Service Account，只需在第一台 Control-plane 需要修改&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#39;s|path: /etc/kubernetes/admin.conf|path: /etc/kubernetes/super-admin.conf|g&amp;#39; \
/etc/kubernetes/manifests/kube-vip.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 harbor fqdn&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=harbor.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 kube-vip 的 image repo&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#34;s|image: ghcr.io|image: ${HARBOR_FQDN}/library|g&amp;#34; \
/etc/kubernetes/manifests/kube-vip.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo nano /etc/kubernetes/manifests/kube-vip.yaml
......
spec:
containers:
......
- name: vip_interface
value: ens18
- name: vip_subnet
value: &amp;#34;24&amp;#34;
......
- name: address
value: 10.10.7.31&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;3.2. 編輯 kubeadm 初始化設定檔&lt;span class="hx:absolute hx:-mt-20" id="32-編輯-kubeadm-初始化設定檔"&gt;&lt;/span&gt;
&lt;a href="#32-%e7%b7%a8%e8%bc%af-kubeadm-%e5%88%9d%e5%a7%8b%e5%8c%96%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定 kubeadm 初始化設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano &amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意每個環境需設定以下項目:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;localAPIEndpoint.advertiseAddress&lt;/code&gt;: API Server 宣告(Advertise)給叢集其他成員的 IP 位址。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nodeRegistration.criSocket&lt;/code&gt;: Kubelet 應使用的 CRI socket 路徑。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nodeRegistration.name&lt;/code&gt;: 此節點在 Kubernetes 叢集中的唯一識別名稱 (通常使用主機名稱)。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;clusterName&lt;/code&gt;: K8s 叢集的名稱。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;controllerManager.extraVolumes&lt;/code&gt;: 掛載額外的磁碟區 (Volume) 到 &lt;code&gt;kube-controller-manager&lt;/code&gt; Pod 中。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;imageRepository&lt;/code&gt;: 用於拉取 Kubernetes 核心組件 (如 API Server, etcd) images 的 Registry 位址。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubernetesVersion&lt;/code&gt;: 要部署的 Kubernetes 確切版本。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;networking.serviceSubnet&lt;/code&gt;: 分配給 Kubernetes Services 使用的虛擬 IP 位址範圍 (CIDR)。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;networking.podSubnet&lt;/code&gt;: 分配給叢集中所有 Pods 使用的 IP 位址範圍 (CIDR)。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;proxy.disabled&lt;/code&gt;: 停用節點上的 &lt;code&gt;kube-proxy&lt;/code&gt; 組件 。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;controlPlaneEndpoint&lt;/code&gt;: HA 架構的 K8s LoadBalance IP，供所有節點和使用者存取 Kubernetes API Server 的 IP 或 FQDN。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;imageMaximumGCAge&lt;/code&gt;: 節點上未使用 images 在被垃圾回收 (GC) 前可保留的 &lt;strong&gt;最長&lt;/strong&gt; 存留時間。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;imageMinimumGCAge&lt;/code&gt;: 節點上未使用 images 在被垃圾回收 (GC) 前必須保留的 &lt;strong&gt;最短&lt;/strong&gt; 存留時間。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shutdownGracePeriod&lt;/code&gt;: Kubelet 執行正常關機程序 (Node Shutdown) 的總寬限時間。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;shutdownGracePeriodCriticalPods&lt;/code&gt;: 在正常關機期間，Kubelet 等待「關鍵 Pods (Critical Pods)」優雅終止的專用寬限時間。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;systemReserved.memory&lt;/code&gt;: 為 OS 系統守護進程 (如 systemd, sshd) 保留的記憶體量，Kubelet 不會使用這部分。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kubeReserved.memory&lt;/code&gt;: 為 Kubernetes 系統組件 (如 kubelet, 容器執行階段) 保留的記憶體量，Pod 無法使用這部分。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kubeadm.k8s.io/v1beta4
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 172.20.6.111
bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/crio/crio.sock
imagePullPolicy: IfNotPresent
imagePullSerial: true
name: topgun-c1.kubeantony.com
taints: null
timeouts:
controlPlaneComponentHealthCheck: 4m0s
discovery: 5m0s
etcdAPICall: 2m0s
kubeletHealthCheck: 4m0s
kubernetesAPICall: 1m0s
tlsBootstrap: 5m0s
upgradeManifests: 5m0s
---
apiServer:
certSANs:
- 127.0.0.1
apiVersion: kubeadm.k8s.io/v1beta4
caCertificateValidityPeriod: 87600h0m0s
certificateValidityPeriod: 8760h0m0s
certificatesDir: /etc/kubernetes/pki
clusterName: topgun
controllerManager:
extraArgs:
- name: bind-address
value: &amp;#34;0.0.0.0&amp;#34;
- name: secure-port
value: &amp;#34;10257&amp;#34;
extraVolumes:
- name: tz-config
hostPath: /etc/localtime
mountPath: /etc/localtime
readOnly: true
dns:
imageRepository: harbor.example.com/library/coredns
encryptionAlgorithm: RSA-2048
etcd:
local:
dataDir: /var/lib/etcd
extraArgs:
- name: listen-metrics-urls
value: http://0.0.0.0:2381
imageRepository: harbor.example.com/library
kind: ClusterConfiguration
kubernetesVersion: 1.34.1
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/16
podSubnet: 10.244.0.0/16
proxy:
disabled: true
scheduler:
extraArgs:
- name: bind-address
value: &amp;#34;0.0.0.0&amp;#34;
- name: secure-port
value: &amp;#34;10259&amp;#34;
controlPlaneEndpoint: 172.20.6.110:6443
---
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/pki/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 0s
cacheUnauthorizedTTL: 0s
cgroupDriver: systemd
clusterDNS:
- 10.96.0.10
clusterDomain: cluster.local
containerRuntimeEndpoint: &amp;#34;&amp;#34;
cpuManagerReconcilePeriod: 0s
crashLoopBackOff: {}
evictionPressureTransitionPeriod: 0s
fileCheckFrequency: 0s
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 0s
imageMaximumGCAge: &amp;#34;168h&amp;#34;
imageMinimumGCAge: &amp;#34;2m0s&amp;#34;
kind: KubeletConfiguration
logging:
flushFrequency: 0
options:
json:
infoBufferSize: &amp;#34;0&amp;#34;
text:
infoBufferSize: &amp;#34;0&amp;#34;
verbosity: 0
memorySwap: {}
nodeStatusReportFrequency: 0s
nodeStatusUpdateFrequency: 0s
rotateCertificates: true
runtimeRequestTimeout: 0s
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 0s
syncFrequency: 0s
volumeStatsAggPeriod: 0s
maxPods: 110
systemReserved:
memory: &amp;#34;1Gi&amp;#34;
kubeReserved:
memory: &amp;#34;2Gi&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.3. 初始化第一台 Kubernetes control plane&lt;span class="hx:absolute hx:-mt-20" id="33-初始化第一台-kubernetes-control-plane"&gt;&lt;/span&gt;
&lt;a href="#33-%e5%88%9d%e5%a7%8b%e5%8c%96%e7%ac%ac%e4%b8%80%e5%8f%b0-kubernetes-control-plane" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Dry run set up the Kubernetes control plane，用以檢視是否設定檔有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm init \
--dry-run \
--upload-certs \
--config=&amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.20.6.110:6443 --token 0n2iwr.ugdsni61mrtuqv4l \
--discovery-token-ca-cert-hash sha256:0e9dd65a4b3ba662a1a9b9f448cc1a632b808f863dd892d46fa4005b731da5bb&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set up the Kubernetes control plane&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm init \
--upload-certs \
--config=&amp;#34;$HOME&amp;#34;/k8s/config/kubeadm-init.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;W1018 22:31:59.203382 8373 initconfiguration.go:332] error unmarshaling configuration schema.GroupVersionKind{Group:&amp;#34;kubeadm.k8s.io&amp;#34;, Version:&amp;#34;v1beta4&amp;#34;, Kind:&amp;#34;ClusterConfiguration&amp;#34;}: strict decoding error: unknown field &amp;#34;apiServer.timeoutForControlPlane&amp;#34;
[init] Using Kubernetes version: v1.34.1
[preflight] Running pre-flight checks
[WARNING SystemVerification]: kernel release 5.14.0-570.52.1.el9_6.x86_64 is unsupported. Supported LTS versions from the 5.x series are 5.4, 5.10 and 5.15. Any 6.x version is also supported. For cgroups v2 support, the recommended version is 5.10 or newer
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action beforehand using &amp;#39;kubeadm config images pull&amp;#39;
[certs] Using certificateDir folder &amp;#34;/etc/kubernetes/pki&amp;#34;
[certs] Generating &amp;#34;ca&amp;#34; certificate and key
[certs] Generating &amp;#34;apiserver&amp;#34; certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local topgun-c1.kubeantony.com] and IPs [10.96.0.1 172.20.6.111 172.20.6.110 127.0.0.1]
[certs] Generating &amp;#34;apiserver-kubelet-client&amp;#34; certificate and key
[certs] Generating &amp;#34;front-proxy-ca&amp;#34; certificate and key
[certs] Generating &amp;#34;front-proxy-client&amp;#34; certificate and key
[certs] Generating &amp;#34;etcd/ca&amp;#34; certificate and key
[certs] Generating &amp;#34;etcd/server&amp;#34; certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost topgun-c1.kubeantony.com] and IPs [172.20.6.111 127.0.0.1 ::1]
[certs] Generating &amp;#34;etcd/peer&amp;#34; certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost topgun-c1.kubeantony.com] and IPs [172.20.6.111 127.0.0.1 ::1]
[certs] Generating &amp;#34;etcd/healthcheck-client&amp;#34; certificate and key
[certs] Generating &amp;#34;apiserver-etcd-client&amp;#34; certificate and key
[certs] Generating &amp;#34;sa&amp;#34; key and public key
[kubeconfig] Using kubeconfig folder &amp;#34;/etc/kubernetes&amp;#34;
[kubeconfig] Writing &amp;#34;admin.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;super-admin.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;kubelet.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;controller-manager.conf&amp;#34; kubeconfig file
[kubeconfig] Writing &amp;#34;scheduler.conf&amp;#34; kubeconfig file
[etcd] Creating static Pod manifest for local etcd in &amp;#34;/etc/kubernetes/manifests&amp;#34;
[control-plane] Using manifest folder &amp;#34;/etc/kubernetes/manifests&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-apiserver&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-controller-manager&amp;#34;
[control-plane] Creating static Pod manifest for &amp;#34;kube-scheduler&amp;#34;
[kubelet-start] Writing kubelet environment file with flags to file &amp;#34;/var/lib/kubelet/kubeadm-flags.env&amp;#34;
[kubelet-start] Writing kubelet configuration to file &amp;#34;/var/lib/kubelet/instance-config.yaml&amp;#34;
[patches] Applied patch of type &amp;#34;application/strategic-merge-patch&amp;#43;json&amp;#34; to target &amp;#34;kubeletconfiguration&amp;#34;
[kubelet-start] Writing kubelet configuration to file &amp;#34;/var/lib/kubelet/config.yaml&amp;#34;
[kubelet-start] Starting the kubelet
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory &amp;#34;/etc/kubernetes/manifests&amp;#34;
[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s
[kubelet-check] The kubelet is healthy after 501.238442ms
[control-plane-check] Waiting for healthy control plane components. This can take up to 4m0s
[control-plane-check] Checking kube-apiserver at https://172.20.6.111:6443/livez
[control-plane-check] Checking kube-controller-manager at https://0.0.0.0:10257/healthz
[control-plane-check] Checking kube-scheduler at https://0.0.0.0:10259/livez
[control-plane-check] kube-controller-manager is healthy after 1.860780055s
[control-plane-check] kube-scheduler is healthy after 2.364803775s
[control-plane-check] kube-apiserver is healthy after 4.00165287s
[upload-config] Storing the configuration used in ConfigMap &amp;#34;kubeadm-config&amp;#34; in the &amp;#34;kube-system&amp;#34; Namespace
[kubelet] Creating a ConfigMap &amp;#34;kubelet-config&amp;#34; in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Storing the certificates in Secret &amp;#34;kubeadm-certs&amp;#34; in the &amp;#34;kube-system&amp;#34; Namespace
[upload-certs] Using certificate key:
681423a365cee2a5ff5b612831e42a97ff941c0c6ad0595298a6ff603b0fae5d
[mark-control-plane] Marking the node topgun-c1.kubeantony.com as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node topgun-c1.kubeantony.com as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: z6kmo1.qp9d9u4xcb85xmjl
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the &amp;#34;cluster-info&amp;#34; ConfigMap in the &amp;#34;kube-public&amp;#34; namespace
[kubelet-finalize] Updating &amp;#34;/etc/kubernetes/kubelet.conf&amp;#34; to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run &amp;#34;kubectl apply -f [podnetwork].yaml&amp;#34; with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of control-plane nodes running the following command on each as root:
kubeadm join 172.20.6.110:6443 --token z6kmo1.qp9d9u4xcb85xmjl \
--discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50 \
--control-plane --certificate-key 681423a365cee2a5ff5b612831e42a97ff941c0c6ad0595298a6ff603b0fae5d
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
&amp;#34;kubeadm init phase upload-certs --upload-certs&amp;#34; to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 172.20.6.110:6443 --token z6kmo1.qp9d9u4xcb85xmjl \
--discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.4. 設定 kubeConfig&lt;span class="hx:absolute hx:-mt-20" id="34-設定-kubeconfig"&gt;&lt;/span&gt;
&lt;a href="#34-%e8%a8%ad%e5%ae%9a-kubeconfig" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定 kubeconfig&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
printf &amp;#34;\nsource &amp;lt;(kubectl completion bash)\nalias k=kubectl\ncomplete -o default -F __start_kubectl k\n&amp;#34; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;第一台 control plan 安裝好後再將 &lt;code&gt;kube-vip&lt;/code&gt; 權限調整回來&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo sed -i &amp;#39;s|path: /etc/kubernetes/super-admin.conf|path: /etc/kubernetes/admin.conf|g&amp;#39; /etc/kubernetes/manifests/kube-vip.yaml
$ sudo systemctl daemon-reload
$ sudo systemctl restart kubelet&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.5. 安裝 Cilium CNI&lt;span class="hx:absolute hx:-mt-20" id="35-安裝-cilium-cni"&gt;&lt;/span&gt;
&lt;a href="#35-%e5%ae%89%e8%a3%9d-cilium-cni" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;安裝 helm 指令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/addon/cni/cilium/
tar -zxvf helm-v3.19.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 cilium 與 hubble client 指令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf cilium-linux-amd64.tar.gz -C /tmp
tar -zxvf hubble-linux-amd64.tar.gz -C /tmp
sudo mv /tmp/cilium /usr/bin/
sudo mv /tmp/hubble /usr/bin/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 cilium 設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;operator:
image:
repository: harbor.example.com/library/cilium/operator
tag: v1.18.2
useDigest: false
image:
repository: harbor.example.com/library/cilium/cilium
tag: v1.18.2
useDigest: false
envoy:
image:
repository: harbor.example.com/library/cilium/cilium-envoy
tag: v1.34.7-1757592137-1a52bb680a956879722f48c591a2ca90f7791324
useDigest: false
bpf:
masquerade: true
hubble:
relay:
enabled: true
image:
repository: harbor.example.com/library/cilium/hubble-relay
tag: v1.18.2
useDigest: false
ui:
enabled: true
service:
type: NodePort
frontend:
image:
repository: harbor.example.com/library/cilium/hubble-ui
tag: v0.13.3
useDigest: false
backend:
image:
repository: harbor.example.com/library/cilium/hubble-ui-backend
tag: v0.13.3
useDigest: false
ipam:
mode: kubernetes
ipv4NativeRoutingCIDR: 10.244.0.0/16
k8sServiceHost: 172.20.6.110
k8sServicePort: 6443
kubeProxyReplacement: true
autoDirectNodeRoutes: true
routingMode: native
devices: ens18&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 cilium&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm -n kube-system install cilium ./cilium-1.18.2.tgz -f custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 cilium 已安裝成功&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cilium status&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; /¯¯\
/¯¯\__/¯¯\ Cilium: OK
\__/¯¯\__/ Operator: OK
/¯¯\__/¯¯\ Envoy DaemonSet: OK
\__/¯¯\__/ Hubble Relay: OK
\__/ ClusterMesh: disabled
DaemonSet cilium Desired: 6, Ready: 6/6, Available: 6/6
DaemonSet cilium-envoy Desired: 6, Ready: 6/6, Available: 6/6
Deployment cilium-operator Desired: 2, Ready: 2/2, Available: 2/2
Deployment hubble-relay Desired: 1, Ready: 1/1, Available: 1/1
Deployment hubble-ui Desired: 1, Ready: 1/1, Available: 1/1
Containers: cilium Running: 6
cilium-envoy Running: 6
cilium-operator Running: 2
clustermesh-apiserver
hubble-relay Running: 1
hubble-ui Running: 1
Cluster Pods: 9/9 managed by Cilium
Helm chart version:
Image versions cilium harbor.example.com/library/cilium/cilium:v1.18.2: 6
cilium-envoy harbor.example.com/library/cilium/cilium-envoy:v1.34.7-1757592137-1a52bb680a956879722f48c591a2ca90f7791324: 6
cilium-operator harbor.example.com/library/cilium/operator-generic:v1.18.2: 2
hubble-relay harbor.example.com/library/cilium/hubble-relay:v1.18.2: 1
hubble-ui harbor.example.com/library/cilium/hubble-ui-backend:v0.13.3: 1
hubble-ui harbor.example.com/library/cilium/hubble-ui:v0.13.3: 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 cilium 有啟用 eBPF host routing&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cilium_pod=$(kubectl -n kube-system get pods --field-selector status.phase=Running -l k8s-app=cilium -o name | tail -n 1 | cut -d &amp;#34;/&amp;#34; -f 2)
kubectl -n kube-system exec -it ${cilium_pod} -- cilium-dbg status&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;KubeProxyReplacement: True [ens18 172.20.6.115 172.20.6.117 fe80::be24:11ff:fe2e:cc62 (Direct Routing)]
Host firewall: Disabled
SRv6: Disabled
CNI Chaining: none
CNI Config file: successfully wrote CNI configuration file to /host/etc/cni/net.d/05-cilium.conflist
Cilium: Ok 1.18.2 (v1.18.2-5bd307a8)
NodeMonitor: Listening for events on 2 CPUs with 64x4096 of shared memory
Cilium health daemon: Ok
IPAM: IPv4: 7/254 allocated from 10.244.5.0/24,
IPv4 BIG TCP: Disabled
IPv6 BIG TCP: Disabled
BandwidthManager: Disabled
Routing: Network: Native Host: BPF
Attach Mode: TCX
Device Mode: veth
Masquerading: BPF [ens18] 10.244.0.0/16 [IPv4: Enabled, IPv6: Disabled]
Controller Status: 47/47 healthy
Proxy Status: OK, ip 10.244.5.177, 0 redirects active on ports 10000-20000, Envoy: external
Global Identity Range: min 256, max 65535
Hubble: Ok Current/Max Flows: 2491/4095 (60.83%), Flows/s: 3.51 Metrics: Disabled
Encryption: Disabled
Cluster health: 6/6 reachable (2025-10-23T08:51:12Z) (Probe interval: 2m33.896961447s)
Name IP Node Endpoints
Modules Health: Stopped(12) Degraded(0) OK(78)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.6. 新增其他 Control-plane 節點進 K8s 叢集 (單台 Control-plane 可跳過此步驟)&lt;span class="hx:absolute hx:-mt-20" id="36-新增其他-control-plane-節點進-k8s-叢集-單台-control-plane-可跳過此步驟"&gt;&lt;/span&gt;
&lt;a href="#36-%e6%96%b0%e5%a2%9e%e5%85%b6%e4%bb%96-control-plane-%e7%af%80%e9%bb%9e%e9%80%b2-k8s-%e5%8f%a2%e9%9b%86-%e5%96%ae%e5%8f%b0-control-plane-%e5%8f%af%e8%b7%b3%e9%81%8e%e6%ad%a4%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至其他 Control-plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 kube-vip static pod 拷貝到 &lt;code&gt;/etc/kubernetes/manifests/&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp &amp;#34;$HOME&amp;#34;/k8s/addon/kube-vip/ha-control-plane/kube-vip-static-pod.yaml /etc/kubernetes/manifests/kube-vip.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 harbor fqdn&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HARBOR_FQDN=harbor.example.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 kube-vip 的 image repo&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo sed -i &amp;#34;s|image: ghcr.io|image: ${HARBOR_FQDN}/library|g&amp;#34; \
/etc/kubernetes/manifests/kube-vip.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲得 Control-plane node Kubeadm Join Command
請在第一台 Control-plane node 執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubeadm_init_config_file=&amp;#34;${HOME}/k8s/config/kubeadm-init.yaml&amp;#34;
certificate_key=$(sudo kubeadm init phase upload-certs --upload-certs --config ${kubeadm_init_config_file} | tail -n 1)
join_cmd=$(sudo kubeadm token create --print-join-command)
join_cp_cmd=&amp;#34;sudo $join_cmd --control-plane --certificate-key $certificate_key&amp;#34;
echo $join_cp_cmd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join 172.20.6.110:6443 --token rl5cdl.8552g1j3ezrvxk21 --discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50 --control-plane --certificate-key d52af404ed5765485f28e0c5e7e886ae244a8861a78dc3b1ce1a0487194e8a1a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Control-plane 節點加入 K8s 叢集
請在要加入 K8s 的 Control-plane node 執行以下命令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join 172.20.6.110:6443 --token rl5cdl.8552g1j3ezrvxk21 --discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50 --control-plane --certificate-key d52af404ed5765485f28e0c5e7e886ae244a8861a78dc3b1ce1a0487194e8a1a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;join node 使用的 token 會在 24 小時後自動過期&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;重複以上 1. ~ 6. 步驟將其他 Control-plane node 加到 K8s Cluster&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.7. 新增 Worker 節點進 K8s 叢集&lt;span class="hx:absolute hx:-mt-20" id="37-新增-worker-節點進-k8s-叢集"&gt;&lt;/span&gt;
&lt;a href="#37-%e6%96%b0%e5%a2%9e-worker-%e7%af%80%e9%bb%9e%e9%80%b2-k8s-%e5%8f%a2%e9%9b%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;在第一台 Controlplane&lt;/strong&gt; 將 join worker node 指令 print 出來&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm token create --print-join-command&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubeadm join 172.20.6.110:6443 --token inyh77.qp4dqe6wto9uhk8m --discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;以可以執行 sudo 的 user 透過 ssh 連線至 worker node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh sudo_user@ipaddderss&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 worker node 加入 K8s 叢集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo kubeadm join 172.20.6.110:6443 \
--token inyh77.qp4dqe6wto9uhk8m \
--discovery-token-ca-cert-hash sha256:4ea08e749828d599c6e3aefb69be7bbfbfe47bdab702907464fe033f22547e50&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ssh 連線到其他 worker node，重複執行步驟 3，將其他 worker node 也加入 K8s 叢集&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;回到第一台 Control-plane 執行以下命令，將所有 worker nodes 都貼 label&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl label node topgun-w1.kubeantony.com node-role.kubernetes.io/worker=
kubectl label node topgun-w2.kubeantony.com node-role.kubernetes.io/worker=
kubectl label node topgun-w3.kubeantony.com node-role.kubernetes.io/worker=&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.8. 檢視 K8s 狀態是否正常&lt;span class="hx:absolute hx:-mt-20" id="38-檢視-k8s-狀態是否正常"&gt;&lt;/span&gt;
&lt;a href="#38-%e6%aa%a2%e8%a6%96-k8s-%e7%8b%80%e6%85%8b%e6%98%af%e5%90%a6%e6%ad%a3%e5%b8%b8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;檢視 K8s node 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
topgun-c1.kubeantony.com Ready control-plane 3d15h v1.34.1
topgun-c2.kubeantony.com Ready control-plane 26h v1.34.1
topgun-c3.kubeantony.com Ready control-plane 3h24m v1.34.1
topgun-w1.kubeantony.com Ready worker 3d6h v1.34.1
topgun-w2.kubeantony.com Ready worker 17m v1.34.1
topgun-w3.kubeantony.com Ready worker 16m v1.34.1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 kube-system namespace 底下所有 pods 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cilium-b74sh 1/1 Running 0 26h
cilium-btg2h 1/1 Running 0 26h
cilium-envoy-24skx 1/1 Running 0 26h
cilium-envoy-llwv7 1/1 Running 0 17m
cilium-envoy-nb5l2 1/1 Running 0 3h24m
cilium-envoy-nvkz9 1/1 Running 0 26h
cilium-envoy-vz6kj 1/1 Running 0 16m
cilium-envoy-wm4xw 1/1 Running 0 26h
cilium-gp9v9 1/1 Running 0 17m
cilium-operator-794b864946-8j8j5 1/1 Running 1 (10h ago) 26h
cilium-operator-794b864946-9whct 1/1 Running 0 26h
cilium-vqp5v 1/1 Running 0 26h
cilium-xgcch 1/1 Running 0 16m
cilium-zj2xj 1/1 Running 0 3h24m
coredns-f74588c75-86h95 1/1 Running 0 26h
coredns-f74588c75-9992t 1/1 Running 0 26h
etcd-topgun-c1.kubeantony.com 1/1 Running 0 3d15h
etcd-topgun-c2.kubeantony.com 1/1 Running 0 26h
etcd-topgun-c3.kubeantony.com 1/1 Running 0 3h24m
hubble-relay-7d6865bf7b-7wvhl 1/1 Running 0 26h
hubble-ui-c6998f8ff-6m4cn 2/2 Running 0 26h
kube-apiserver-topgun-c1.kubeantony.com 1/1 Running 0 3d15h
kube-apiserver-topgun-c2.kubeantony.com 1/1 Running 0 26h
kube-apiserver-topgun-c3.kubeantony.com 1/1 Running 0 3h24m
kube-controller-manager-topgun-c1.kubeantony.com 1/1 Running 1 (10h ago) 3d15h
kube-controller-manager-topgun-c2.kubeantony.com 1/1 Running 0 26h
kube-controller-manager-topgun-c3.kubeantony.com 1/1 Running 0 3h24m
kube-scheduler-topgun-c1.kubeantony.com 1/1 Running 1 (10h ago) 3d15h
kube-scheduler-topgun-c2.kubeantony.com 1/1 Running 0 26h
kube-scheduler-topgun-c3.kubeantony.com 1/1 Running 0 3h24m
kube-vip-topgun-c1.kubeantony.com 1/1 Running 1 (10h ago) 3d15h
kube-vip-topgun-c3.kubeantony.com 1/1 Running 0 3h24m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;3.9. 檢測 K8s 網路延遲和吞吐量&lt;span class="hx:absolute hx:-mt-20" id="39-檢測-k8s-網路延遲和吞吐量"&gt;&lt;/span&gt;
&lt;a href="#39-%e6%aa%a2%e6%b8%ac-k8s-%e7%b6%b2%e8%b7%af%e5%bb%b6%e9%81%b2%e5%92%8c%e5%90%9e%e5%90%90%e9%87%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;主要測試以下項目&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;吞吐量 - TCP Throughput (TCP_STREAM)&lt;/strong&gt;：有助於了解在特定配置下可達到的最大吞吐量。
&lt;ul&gt;
&lt;li&gt;此測試代表大量資料傳輸的應用程式，例如串流服務或執行資料上傳/下載的服務。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;請求/回應速率 - Request/Response Rate (TCP_RR)&lt;/strong&gt;：主要測量處理單一網路封包來回轉發的延遲與效率。這項基準測試將在線路上產生每秒可能的最大封包數（packets per second），並著重測試處理單一網路封包的成本（資源消耗）。
&lt;ul&gt;
&lt;li&gt;此測試代表了那些維持持續性連線（persistent connections）、並與其他服務交換請求/回應類型互動的服務。這對於使用 REST 或 gRPC API 的服務來說很常見。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;連線速率 - Connection Rate (TCP_CRR)&lt;/strong&gt;：它類似於 Request/Response Rate 測試，但會為每一次來回建立一個新的 TCP 連線。
&lt;ul&gt;
&lt;li&gt;此測試代表暴露於公網的服務，它會接收來自許多客戶端的連線。L4 代理或對外部端點開啟許多連線的服務，都是很好的例子。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;透過 cilium 指令檢測 K8s 網路頻寬&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cilium connectivity perf \
--crr \
--host-to-pod \
--pod-to-host \
--performance-image quay.io/cilium/network-perf:1751527436-c2462ae \
--node-selector-client kubernetes.io/hostname=topgun-w1.kubeantony.com \
--node-selector-server kubernetes.io/hostname=topgun-w2.kubeantony.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;🏃[cilium-test-1] Running 1 tests ...
[=] [cilium-test-1] Test [network-perf] [1/1]
................................
🔥 Network Performance Test Summary [cilium-test-1]:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Min | Mean | Max | P50 | P90 | P99 | Transaction rate OP/s
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_CRR | 10s | 50µs | 84.48µs | 11.99ms | 77µs | 96µs | 144µs | 11787.95
📋 pod-to-pod | same-node | TCP_RR | 10s | 11µs | 30.74µs | 4.659ms | 31µs | 35µs | 46µs | 32197.86
📋 pod-to-host | same-node | TCP_CRR | 10s | 61µs | 98.57µs | 21.094ms | 90µs | 109µs | 155µs | 10104.54
📋 pod-to-host | same-node | TCP_RR | 10s | 12µs | 31.86µs | 1.091ms | 32µs | 37µs | 49µs | 31071.90
📋 host-to-pod | same-node | TCP_CRR | 10s | 60µs | 100.33µs | 14.059ms | 90µs | 109µs | 160µs | 9930.36
📋 host-to-pod | same-node | TCP_RR | 10s | 12µs | 31.94µs | 892µs | 32µs | 36µs | 48µs | 30996.63
📋 host-to-host | same-node | TCP_CRR | 10s | 52µs | 76.41µs | 1.924ms | 73µs | 89µs | 127µs | 13016.02
📋 host-to-host | same-node | TCP_RR | 10s | 12µs | 31.89µs | 1.281ms | 32µs | 36µs | 48µs | 31043.05
📋 pod-to-pod | other-node | TCP_CRR | 10s | 242µs | 330.04µs | 13.257ms | 301µs | 342µs | 790µs | 3027.08
📋 pod-to-pod | other-node | TCP_RR | 10s | 87µs | 112.64µs | 4.085ms | 112µs | 124µs | 146µs | 8867.04
📋 pod-to-host | other-node | TCP_CRR | 10s | 243µs | 321.36µs | 15.197ms | 302µs | 340µs | 483µs | 3108.95
📋 pod-to-host | other-node | TCP_RR | 10s | 89µs | 113.52µs | 3.172ms | 113µs | 125µs | 147µs | 8797.96
📋 host-to-pod | other-node | TCP_CRR | 10s | 230µs | 311.48µs | 13.035ms | 287µs | 334µs | 635µs | 3207.10
📋 host-to-pod | other-node | TCP_RR | 10s | 88µs | 115.57µs | 4.126ms | 114µs | 128µs | 153µs | 8641.95
📋 host-to-host | other-node | TCP_CRR | 10s | 229µs | 303.13µs | 21.099ms | 285µs | 322µs | 417µs | 2739.19
📋 host-to-host | other-node | TCP_RR | 10s | 89µs | 114.78µs | 4.428ms | 114µs | 126µs | 148µs | 8702.07
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Throughput Mb/s
----------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_STREAM | 10s | 18952.05
📋 pod-to-pod | same-node | TCP_STREAM_MULTI | 10s | 45634.84
📋 pod-to-host | same-node | TCP_STREAM | 10s | 16338.34
📋 pod-to-host | same-node | TCP_STREAM_MULTI | 10s | 41785.81
📋 host-to-pod | same-node | TCP_STREAM | 10s | 15643.64
📋 host-to-pod | same-node | TCP_STREAM_MULTI | 10s | 40812.09
📋 host-to-host | same-node | TCP_STREAM | 10s | 36117.05
📋 host-to-host | same-node | TCP_STREAM_MULTI | 10s | 82274.99
📋 pod-to-pod | other-node | TCP_STREAM | 10s | 9407.21
📋 pod-to-pod | other-node | TCP_STREAM_MULTI | 10s | 9417.40
📋 pod-to-host | other-node | TCP_STREAM | 10s | 9411.27
📋 pod-to-host | other-node | TCP_STREAM_MULTI | 10s | 9411.89
📋 host-to-pod | other-node | TCP_STREAM | 10s | 9409.00
📋 host-to-pod | other-node | TCP_STREAM_MULTI | 10s | 9398.15
📋 host-to-host | other-node | TCP_STREAM | 10s | 9408.12
📋 host-to-host | other-node | TCP_STREAM_MULTI | 10s | 9416.04
----------------------------------------------------------------------------------------
✅ [cilium-test-1] All 1 tests (32 actions) successful, 0 tests skipped, 0 scenarios skipped.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;未開 ebpf host routing 的數值：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
🏃[cilium-test-1] Running 1 tests ...
[=] [cilium-test-1] Test [network-perf] [1/1]
................................
🔥 Network Performance Test Summary [cilium-test-1]:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Min | Mean | Max | P50 | P90 | P99 | Transaction rate OP/s
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_CRR | 10s | 50µs | 82.85µs | 10.656ms | 78µs | 94µs | 124µs | 12017.63
📋 pod-to-pod | same-node | TCP_RR | 10s | 10µs | 30.71µs | 828µs | 30µs | 35µs | 46µs | 32231.92
📋 pod-to-host | same-node | TCP_CRR | 10s | 59µs | 94.56µs | 12.326ms | 91µs | 108µs | 137µs | 10532.25
📋 pod-to-host | same-node | TCP_RR | 10s | 12µs | 31.94µs | 2.572ms | 32µs | 37µs | 48µs | 30996.44
📋 host-to-pod | same-node | TCP_CRR | 10s | 56µs | 93.13µs | 15.588ms | 90µs | 107µs | 136µs | 10694.60
📋 host-to-pod | same-node | TCP_RR | 10s | 12µs | 31.27µs | 1.842ms | 31µs | 36µs | 48µs | 31651.76
📋 host-to-host | same-node | TCP_CRR | 10s | 53µs | 75µs | 1.479ms | 72µs | 88µs | 123µs | 13261.02
📋 host-to-host | same-node | TCP_RR | 10s | 12µs | 31.87µs | 583µs | 32µs | 36µs | 47µs | 31059.78
📋 pod-to-pod | other-node | TCP_CRR | 10s | 278µs | 368.98µs | 9.809ms | 339µs | 382µs | 965µs | 2707.98
📋 pod-to-pod | other-node | TCP_RR | 10s | 95µs | 123.71µs | 4.119ms | 122µs | 137µs | 163µs | 8073.77
📋 pod-to-host | other-node | TCP_CRR | 10s | 248µs | 371.53µs | 1.052362s | 298µs | 335µs | 500µs | 2006.19
📋 pod-to-host | other-node | TCP_RR | 10s | 90µs | 114.49µs | 2.982ms | 114µs | 126µs | 147µs | 8723.87
📋 host-to-pod | other-node | TCP_CRR | 10s | 279µs | 366.76µs | 12.3ms | 338µs | 375µs | 850µs | 2724.34
📋 host-to-pod | other-node | TCP_RR | 10s | 105µs | 135.79µs | 15.723ms | 133µs | 148µs | 176µs | 7355.48
📋 host-to-host | other-node | TCP_CRR | 10s | 229µs | 301.42µs | 15.967ms | 284µs | 314µs | 415µs | 2739.19
📋 host-to-host | other-node | TCP_RR | 10s | 88µs | 114.62µs | 4.249ms | 114µs | 127µs | 148µs | 8713.25
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
📋 Scenario | Node | Test | Duration | Throughput Mb/s
----------------------------------------------------------------------------------------
📋 pod-to-pod | same-node | TCP_STREAM | 10s | 19819.33
📋 pod-to-pod | same-node | TCP_STREAM_MULTI | 10s | 44767.93
📋 pod-to-host | same-node | TCP_STREAM | 10s | 17519.15
📋 pod-to-host | same-node | TCP_STREAM_MULTI | 10s | 41288.42
📋 host-to-pod | same-node | TCP_STREAM | 10s | 15667.62
📋 host-to-pod | same-node | TCP_STREAM_MULTI | 10s | 40686.99
📋 host-to-host | same-node | TCP_STREAM | 10s | 36663.82
📋 host-to-host | same-node | TCP_STREAM_MULTI | 10s | 83454.15
📋 pod-to-pod | other-node | TCP_STREAM | 10s | 5515.69
📋 pod-to-pod | other-node | TCP_STREAM_MULTI | 10s | 5462.09
📋 pod-to-host | other-node | TCP_STREAM | 10s | 9393.23
📋 pod-to-host | other-node | TCP_STREAM_MULTI | 10s | 9399.02
📋 host-to-pod | other-node | TCP_STREAM | 10s | 5456.02
📋 host-to-pod | other-node | TCP_STREAM_MULTI | 10s | 5423.52
📋 host-to-host | other-node | TCP_STREAM | 10s | 9410.65
📋 host-to-host | other-node | TCP_STREAM_MULTI | 10s | 9416.39
----------------------------------------------------------------------------------------
✅ [cilium-test-1] All 1 tests (32 actions) successful, 0 tests skipped, 0 scenarios skipped.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;通用欄位
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Scenario&lt;/code&gt; (情境):
描述流量的來源和目的地。
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pod-to-pod&lt;/code&gt;: 從一個 Pod 到另一個 Pod。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pod-to-host&lt;/code&gt;: 從一個 Pod 到其運行的節點 (Host)。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host-to-pod&lt;/code&gt;: 從一個節點 (Host) 到一個 Pod。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host-to-host&lt;/code&gt;: 從一個節點 (Host) 到另一個節點 (Host)。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Node&lt;/code&gt; (節點):&lt;/strong&gt;
描述來源和目的地的相對位置。
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;same-node&lt;/code&gt;: 來源和目的地在&lt;strong&gt;同一個&lt;/strong&gt; Kubernetes 節點上。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;other-node&lt;/code&gt;: 來源和目的地在&lt;strong&gt;不同的&lt;/strong&gt; Kubernetes 節點上。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;表 1
這張表格專注於延遲（完成一個操作需要多長時間）和事務處理速率（每秒可以完成多少操作），主要用於 &lt;code&gt;TCP_CRR&lt;/code&gt; 和 &lt;code&gt;TCP_RR&lt;/code&gt; 測試。時間單位是微秒 (&lt;code&gt;µs&lt;/code&gt;) 或毫秒 (&lt;code&gt;ms&lt;/code&gt;)。
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Min&lt;/code&gt; (最小延遲): 在測試期間觀察到的最快的單次事務（請求/回應或連接/關閉）延遲。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Mean&lt;/code&gt; (平均延遲): 所有事務延遲的算術平均值。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Max&lt;/code&gt; (最大延遲): 在測試期間觀察到的最慢的單次事務延遲。高 &lt;code&gt;Max&lt;/code&gt; 值可能表示網路抖動或偶發性的效能瓶頸。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;P50&lt;/code&gt; (50百分位延遲): 也稱為中位數。50% 的事務延遲低於此值。與 &lt;code&gt;Mean&lt;/code&gt; 相比，&lt;code&gt;P50&lt;/code&gt; 受極端異常值的影響較小。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;P90&lt;/code&gt; (90百分位延遲): 90% 的事務延遲低於此值。這是一個常見的服務水平指標 (SLI)，用於衡量絕大多數用戶的體驗。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;P99&lt;/code&gt; (99百分位延遲): 99% 的事務延遲低於此值。這有助於識別「長尾延遲」(long-tail latency)，即影響少數請求的嚴重效能問題。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Transaction rate OP/s&lt;/code&gt; (每秒事務處理速率): 每秒操作數 (Operations Per Second)。
&lt;ul&gt;
&lt;li&gt;這個值越高越好，表示處理事務的效率越高。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;表 2
這張表格專注於頻寬（每秒可以傳輸多少數據），主要用於 &lt;code&gt;TCP_STREAM&lt;/code&gt; 和 &lt;code&gt;TCP_STREAM_MULTI&lt;/code&gt; 測試。
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Throughput Mb/s&lt;/code&gt; (吞吐量 Mb/s):
&lt;ul&gt;
&lt;li&gt;每秒百萬位元 (Megabits per second)。這個值顯示了在測試期間，來源和目的地之間數據傳輸的平均速率。值越高，表示網路頻寬越大。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP_STREAM&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;使用單個 TCP 連接測量最大數據傳輸吞吐量（頻寬）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP_STREAM_MULTI&lt;/code&gt;:
&lt;ul&gt;
&lt;li&gt;使用 32 個並行 TCP 連接測量最大數據傳輸吞吐量。這通常能更好地佔滿網路鏈路，顯示系統的總頻寬上限。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2&gt;4. 安裝 K8s Addon&lt;span class="hx:absolute hx:-mt-20" id="4-安裝-k8s-addon"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%ae%89%e8%a3%9d-k8s-addon" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;4.1. 安裝 Metrics server&lt;span class="hx:absolute hx:-mt-20" id="41-安裝-metrics-server"&gt;&lt;/span&gt;
&lt;a href="#41-%e5%ae%89%e8%a3%9d-metrics-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/addon/metrics/metrics-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 Kustomization File&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano kustomization.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./components.yaml
images:
- name: registry.k8s.io/metrics-server/metrics-server
newName: harbor.example.com/library/metrics-server/metrics-server
newTag: v0.8.0
patches:
- target:
kind: Deployment
name: metrics-server
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --kubelet-insecure-tls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 yaml 設定檔是否有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k . --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;serviceaccount/metrics-server created (server dry run)
clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created (server dry run)
clusterrole.rbac.authorization.k8s.io/system:metrics-server created (server dry run)
rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created (server dry run)
service/metrics-server created (server dry run)
deployment.apps/metrics-server created (server dry run)
apiservice.apiregistration.k8s.io/v1beta1.metrics.k8s.io created (server dry run)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 Metrics Server&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 Metrics Server pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods -l k8s-app=metrics-server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
metrics-server-69779649f-frvqz 1/1 Running 0 43s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 K8s 所有 nodes 的 cpu 記憶體使用狀況&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl top nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CPU(cores) CPU(%) MEMORY(bytes) MEMORY(%)
topgun-c1.kubeantony.com 41m 2% 1705Mi 37%
topgun-c2.kubeantony.com 34m 1% 1175Mi 26%
topgun-c3.kubeantony.com 28m 1% 1057Mi 23%
topgun-w1.kubeantony.com 12m 0% 1066Mi 23%
topgun-w2.kubeantony.com 10m 0% 947Mi 21%
topgun-w3.kubeantony.com 9m 0% 778Mi 17%&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;4.2. 安裝 kube-vip On-Premises Cloud Controller&lt;span class="hx:absolute hx:-mt-20" id="42-安裝-kube-vip-on-premises-cloud-controller"&gt;&lt;/span&gt;
&lt;a href="#42-%e5%ae%89%e8%a3%9d-kube-vip-on-premises-cloud-controller" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/addon/kube-vip/k8s-lb-service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將可分配的 IP Range 寫入 configmap&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system create configmap kubevip \
--from-literal range-global=172.20.6.117-172.20.6.120 \
--dry-run=client -o yaml &amp;gt; kube-vip-cm.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 Kustomization File&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano kustomization.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./kube-vip-rbac.yaml
- ./kube-vip-ds.yaml
- ./kube-vip-cloud-controller.yaml
- ./kube-vip-cm.yaml
images:
- name: ghcr.io/kube-vip/kube-vip
newName: harbor.example.com/library/kube-vip/kube-vip
newTag: v1.0.1
- name: ghcr.io/kube-vip/kube-vip-cloud-provider
newName: harbor.example.com/library/kube-vip/kube-vip-cloud-provider
newTag: v0.0.12
patches:
- target:
kind: DaemonSet
name: kube-vip-ds
namespace: kube-system
patch: |-
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: kube-vip-ds
spec:
template:
spec:
serviceAccountName: kube-vip
nodeSelector:
node-role.kubernetes.io/worker: &amp;#34;&amp;#34;
containers:
- name: kube-vip
env:
- name: vip_interface
value: &amp;#34;ens18&amp;#34;
- name: vip_subnet
value: &amp;#34;16&amp;#34;
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
$patch: delete
volumes:
- name: kubeconfig
$patch: delete
- target:
kind: ConfigMap
name: kubevip
namespace: kube-system
patch: |-
- op: add
path: /data/range-global
value: &amp;#34;172.20.6.117-172.20.6.120&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 yaml 設定檔是否有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k . --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;serviceaccount/kube-vip created (server dry run)
serviceaccount/kube-vip-cloud-controller created (server dry run)
clusterrole.rbac.authorization.k8s.io/system:kube-vip-cloud-controller-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/system:kube-vip-role created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/system:kube-vip-binding created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/system:kube-vip-cloud-controller-binding created (server dry run)
configmap/kubevip created (server dry run)
Warning: spec.template.spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution[1].preference.matchExpressions[0].key: node-role.kubernetes.io/master is use &amp;#34;node-role.kubernetes.io/control-plane&amp;#34; instead
deployment.apps/kube-vip-cloud-provider created (server dry run)
daemonset.apps/kube-vip-ds created (server dry run)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 kube-vip On-Premises Cloud Controller&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 kube-vip On-Premises Cloud Controller pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods -l component=kube-vip-cloud-provider&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
kube-vip-cloud-provider-d9b9446b9-6ll6t 1/1 Running 0 45s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 kube-vip ds pods 運作狀態，並確認 pods 只跑在 worker nodes 上&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods -l app.kubernetes.io/name=kube-vip-ds -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-vip-ds-kglmc 1/1 Running 0 59s 172.20.6.114 topgun-w1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-vip-ds-krst5 1/1 Running 0 59s 172.20.6.115 topgun-w2.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
kube-vip-ds-r8cmc 1/1 Running 0 59s 172.20.6.116 topgun-w3.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;4.3. 安裝 Ingress NGINX Controller&lt;span class="hx:absolute hx:-mt-20" id="43-安裝-ingress-nginx-controller"&gt;&lt;/span&gt;
&lt;a href="#43-%e5%ae%89%e8%a3%9d-ingress-nginx-controller" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/addon/ingress/ingress-nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 Kustomization File&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano kustomization.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
#- ./deployment.yaml
- ./daemonSet.yaml
images:
- name: registry.k8s.io/ingress-nginx/controller
newName: harbor.example.com/library/ingress-nginx/controller
newTag: v1.13.3
- name: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.6.3
newName: harbor.example.com/library/ingress-nginx/kube-webhook-certgen
newTag: v1.6.3
patches:
- target:
kind: DaemonSet
name: ingress-nginx-controller
patch: |-
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ingress-nginx-controller
spec:
template:
spec:
nodeSelector:
node-role.kubernetes.io/worker: &amp;#34;&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 yaml 設定檔是否有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k . --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/ingress-nginx created (server dry run)
clusterrole.rbac.authorization.k8s.io/ingress-nginx created (server dry run)
clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created (server dry run)
ingressclass.networking.k8s.io/nginx created (server dry run)
validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission created (server dry run)
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;.&amp;#34;: namespaces &amp;#34;ingress-nginx&amp;#34; not found&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 Ingress NGINX Controller&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 Ingress NGINX Controller pods 運作狀態，並確認是否只在 woker nodes 上執行&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n ingress-nginx get pods -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
ingress-nginx-controller-4tgxs 1/1 Running 0 90s 10.244.5.109 topgun-w2.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
ingress-nginx-controller-n9t75 1/1 Running 0 67s 10.244.6.115 topgun-w3.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
ingress-nginx-controller-thkd4 1/1 Running 0 44s 10.244.1.190 topgun-w1.kubeantony.com &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立測試目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir test&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯測試用 deployment&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano test/test-deployment&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: httpd
name: httpd
spec:
replicas: 3
selector:
matchLabels:
app: httpd
strategy: {}
template:
metadata:
labels:
app: httpd
spec:
containers:
- image: harbor.example.com/library/library/busybox:stable
name: busybox
command: [&amp;#34;/bin/sh&amp;#34;, &amp;#34;-c&amp;#34;]
args:
- echo haha &amp;gt; /tmp/index.html;
httpd -p 888 -h /tmp -f&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 K8s service yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano test/test-svc.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
labels:
app: httpd
name: test-svc
spec:
ports:
- port: 80
protocol: TCP
targetPort: 888
selector:
app: httpd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 K8s ingress yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano test/test-ing.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
spec:
ingressClassName: nginx
rules:
- host: test.k8s.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: test-svc
port:
number: 80&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署測試 deployment, service 和 ingress&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f test/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 pods 狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
httpd-77c9cfcf7d-2tqks 1/1 Running 0 70m
httpd-77c9cfcf7d-4g9fl 1/1 Running 0 70m
httpd-77c9cfcf7d-6w2l2 1/1 Running 0 70m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 ingress 有拿到節點的 ip&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get ing&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CLASS HOSTS ADDRESS PORTS AGE
minimal-ingress nginx test.k8s.io 172.20.6.114,172.20.6.115,172.20.6.116 80 66m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證可以存取網站服務&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;for i in {114..116}; do time curl -H &amp;#34;Host: test.k8s.io&amp;#34; http://172.20.6.${i};echo ;done&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;haha
real 0m0.006s
user 0m0.003s
sys 0m0.002s
haha
real 0m0.005s
user 0m0.002s
sys 0m0.002s
haha
real 0m0.005s
user 0m0.002s
sys 0m0.001s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Learning and Practicing Harvester</title><link>https://blog.kubeantony.com/archive/rancher/learning-and-practicing-harvester/</link><pubDate>Thu, 15 Jan 2026 08:11:28 +0800</pubDate><guid>https://blog.kubeantony.com/archive/rancher/learning-and-practicing-harvester/</guid><description>
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;
&lt;h2&gt;Preface&lt;span class="hx:absolute hx:-mt-20" id="preface"&gt;&lt;/span&gt;
&lt;a href="#preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;本篇文章會主要會介紹以下主題 :&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Harvester 的架構&lt;/li&gt;
&lt;li&gt;如何安裝 Harvester，並將額外的節點加入 Harveter Cluster&lt;/li&gt;
&lt;li&gt;將 Harvester 與 Rancher 整合，做出 Nested Kubernetes Clusters 以及 Node Pool&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;可以透過點擊以下目錄，選擇想看的內容，跳轉至特定章節&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;Harvester Architecture&lt;span class="hx:absolute hx:-mt-20" id="harvester-architecture"&gt;&lt;/span&gt;
&lt;a href="#harvester-architecture" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SySzSf0qT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Harvester 架構由以下開源技術組成：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Linux 作業系統 : Elemental for SLE-Micro 5.3 是 Harvester 的核心，它是一個不可變的 Linux 發行版，旨在盡可能消除 Kubernetes 叢集中的作業系統維護工作。&lt;/li&gt;
&lt;li&gt;建構於 Kubernetes(RKE2) 之上 : Kubernetes 已成為所有形式因素中最主要的基礎架構語言，而 Harvester 就是一個在引擎蓋下裝有 Kubernetes 的 HCI 解決方案。&lt;/li&gt;
&lt;li&gt;利用 Kubevirt 進行虛擬化管理 : Kubevirt 在 Kubernetes 的基礎上使用 KVM 提供虛擬化管理。&lt;/li&gt;
&lt;li&gt;利用 Longhorn 進行儲存管理 : Longhorn 提供分散式區塊儲存。&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h2&gt;Harvester Features&lt;span class="hx:absolute hx:-mt-20" id="harvester-features"&gt;&lt;/span&gt;
&lt;a href="#harvester-features" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;Harvester 是一個 enterprise-ready、易於使用的基礎架構平台，它利用本地直接連接的 Storage，而不是複雜的外部 SAN。 它利用 Kubernetes API 作為跨 Container 和 虛擬機器 workloads 的統一自動化語言。 Harvester 的一些主要功能包括 :&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;易於上手 : 由於 Harvester 是以可啟動裝置鏡像的形式提供的，因此您可以使用 ISO 映像直接將其安裝到裸機伺服器上，也可以使用 iPXE 腳本自動安裝。&lt;/li&gt;
&lt;li&gt;虛擬機器生命週期管理 : 輕鬆建立、編輯、複製和刪除虛擬機，包括 SSH 金鑰注入、Cloud Init 以及圖形化界面 (VNC) 和 serial port (22 port) 控制台。&lt;/li&gt;
&lt;li&gt;虛擬機器即時遷移 : 零停機時間將虛擬機器遷移到不同的主機或節點。&lt;/li&gt;
&lt;li&gt;虛擬機器備份、快照和還原 : 從 NFS、S3 伺服器或 NAS 設備備份虛擬機器。 使用備份好的虛擬硬碟檔還原故障的虛擬機，或在不同的叢集上建立新的虛擬機。&lt;/li&gt;
&lt;li&gt;儲存管理 : Harvester 支援分散式區塊的儲存和 tiering (分層)。 Volumes 代表 storage；你可以輕鬆建立、編輯、複製或匯出磁碟區。&lt;/li&gt;
&lt;li&gt;網路管理 : 支援使用虛擬 IP（VIP）和多個網路介面卡（NIC）。 如果虛擬機器需要連接外部網絡，可建立 VLAN 或 untagged (無標記) 網路。&lt;/li&gt;
&lt;li&gt;與 Rancher 整合 : 透過 Rancher 的虛擬化管理頁面直接存取 Rancher 中的 Harvester，並與 Kubernetes 叢集一起管理 VM workloads (虛擬機器工作負載)，實現 Node Pool 的功能。&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h2&gt;PreRequest&lt;span class="hx:absolute hx:-mt-20" id="prerequest"&gt;&lt;/span&gt;
&lt;a href="#prerequest" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Hardware and Network Requirements&lt;span class="hx:absolute hx:-mt-20" id="hardware-and-network-requirements"&gt;&lt;/span&gt;
&lt;a href="#hardware-and-network-requirements" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkCXYmAqp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;詳細資訊，請以下參考 Harvester 官網 Docs :
&lt;a
href="https://docs.harvesterhci.io/v1.2/install/requirements/"target="_blank" rel="noopener"&gt;Hardware and Network Requirements&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h2&gt;Install Single-Node Harvester Clusters with USB&lt;span class="hx:absolute hx:-mt-20" id="install-single-node-harvester-clusters-with-usb"&gt;&lt;/span&gt;
&lt;a href="#install-single-node-harvester-clusters-with-usb" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 下載 ISO 並透過 Rufus 將 USB 做成可開機裝置&lt;span class="hx:absolute hx:-mt-20" id="1-下載-iso-並透過-rufus-將-usb-做成可開機裝置"&gt;&lt;/span&gt;
&lt;a href="#1-%e4%b8%8b%e8%bc%89-iso-%e4%b8%a6%e9%80%8f%e9%81%8e-rufus-%e5%b0%87-usb-%e5%81%9a%e6%88%90%e5%8f%af%e9%96%8b%e6%a9%9f%e8%a3%9d%e7%bd%ae" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;1.1. 下載 ISO&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;可以使用 ISO 鏡像直接將 Harvester 安裝到裸機伺服器上，若要取得 ISO 映像，請從 &lt;a
href="https://github.com/harvester/harvester/releases"target="_blank" rel="noopener"&gt;Harvester releases 頁面&lt;/a&gt;下載 💿 &lt;code&gt;harvester-v1.x.x-amd64.iso&lt;/code&gt;。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ wget --show-progress https://releases.rancher.com/harvester/v1.2.1/harvester-v1.2.1-amd64.iso&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;--2024-02-16 10:59:20-- https://releases.rancher.com/harvester/v1.2.1/harvester-v1.2.1-amd64.iso
Resolving releases.rancher.com (releases.rancher.com)... 13.35.35.42, 13.35.35.123, 13.35.35.33, ...
Connecting to releases.rancher.com (releases.rancher.com)|13.35.35.42|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5497749504 (5.1G) [application/octet-stream]
Saving to: ‘harvester-v1.2.1-amd64.iso’
harvester-v1.2.1-amd64.iso 100%[===========================================================&amp;gt;] 5.12G 35.8MB/s in 4m 14s
2024-02-16 11:03:34 (20.6 MB/s) - ‘harvester-v1.2.1-amd64.iso’ saved [5497749504/5497749504]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;1.2. 開啟 Rufus，將乾淨的 USB 碟插入電腦，Rufus 會自動偵測 USB。 從 &amp;ldquo;裝置 &amp;ldquo;下拉式選單中選擇要使用的 USB 裝置，在 &amp;ldquo;啟動選擇 &amp;ldquo;中選擇 &amp;ldquo;選擇&amp;rdquo;，然後找到要燒錄到 USB 上的 Harvester 安裝 ISO 映像。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJq32Ynsa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;2. 安裝步驟&lt;span class="hx:absolute hx:-mt-20" id="2-安裝步驟"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%ae%89%e8%a3%9d%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.1. 使用 USB 開機，並透過選擇 Harvester Installer 選項啟動伺服器。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJiMSL2iT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;使用預設選項，直接按 Enter 按鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.2. 選擇建立一個新的 Harvester Cluster&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S17TBIhsa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;使用預設選項，直接按 Enter 按鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.3. 選擇要安裝的 Harvester 系統碟和要儲存虛擬機器資料的資料碟。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyvFI83sT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;按 Tab 鍵可展開下拉式選單，按 Enter 鍵儲存設定值。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.4. 設定主機的 Hostname&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkByPU2sT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;輸入 &lt;code&gt;h1&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.5. 設定管理網路&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ9RDLhs6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;網路卡的部分，按 Tab 展開下拉式選單，按空白鍵選擇網路卡，確定之後按 Enter 鍵
IPv4 Address 欄位，輸入 : &lt;code&gt;172.20.0.34/24&lt;/code&gt;
Gateway 欄位，輸入 : &lt;code&gt;172.20.0.254&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.6. 設定 DNS Server&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkK3uLnip.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;DNS Server 欄位 : &lt;code&gt;172.20.0.254&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.7. 設定 VIP&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1im_wnsp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;按 Tab 展開下拉式選單，按向下方向鍵選擇 &lt;code&gt;Static&lt;/code&gt;，確認後按 Enter 鍵。
VIP 欄位 : &lt;code&gt;172.20.0.36&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.8. 設定 Cluster Token&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryxCdvno6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Cluster token 欄位 : &lt;code&gt;lab&lt;/code&gt;
Cluster token 用於將其他節點新增至 Harvester 叢集。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.9. 設定使用者密碼&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkGStD3ja.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;預設的使用者是 &lt;code&gt;rancher&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.10. 設定 NTP Server&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJBFYv3jT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;NTP Server 欄位 : &lt;code&gt;time.google.com&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.11. 設定 HTTP Proxy Server ( 此步驟不一定要設定，取決於當下的環境 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyJ-qDhsT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.12. 匯入 SSH Keys ( 此步驟不一定要設定 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkjwqPnia.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.13. 設定 Harvester 設定檔自訂主機 ( 此步驟不一定要設定 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJbMjwhjp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.14. 查看並確認安裝選項&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryFujwhja.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;確認安裝選項沒問題後，按 Enter 鍵，Harvester 將會安裝到主機上。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.15. 安裝完成後，節點將重新啟動，以下是啟動完成畫面&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B13ey_nip.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;重新啟動後，Harvester 控制台會顯示管理 URL 和狀態。網路介面的預設 URL 是 &lt;code&gt;https://your-virtual-ip&lt;/code&gt;。 可以使用 F12 按鍵從 Harvester 控制台切換到 Shell，然後鍵入 exit 返回 Harvester 控制台。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.16. 第一次登入的時候，系統會提示您設定預設管理員使用者的密碼。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJPjyunsa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;使用者預設是 &lt;code&gt;admin&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Update Harvester Configuration After Installation&lt;span class="hx:absolute hx:-mt-20" id="update-harvester-configuration-after-installation"&gt;&lt;/span&gt;
&lt;a href="#update-harvester-configuration-after-installation" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;DNS servers&lt;span class="hx:absolute hx:-mt-20" id="dns-servers"&gt;&lt;/span&gt;
&lt;a href="#dns-servers" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;SSH 連線至 Harvester Node&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ ssh rancher@172.20.0.36&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;備份基本的 cloud-init 檔案 &lt;code&gt;/oem/90_custom.yaml&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo cp /oem/90_custom.yaml /oem/install/90_custom.yaml.$(date --iso-8601=minutes)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;修改 &lt;code&gt;/oem/90_custom.yaml&lt;/code&gt; 檔案，並且更新以下 Yaml 檔中路徑的值 &lt;code&gt;stages.initramfs[0].commands&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo vim /oem/90_custom.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;修改範例內容如下 :&lt;/p&gt;
&lt;pre&gt;
name: Harvester Configuration
stages:
initramfs:
- commands:
- modprobe kvm
- modprobe vhost_net
- sed -i 's/^NETCONFIG_DNS_STATIC_SERVERS.*/NETCONFIG_DNS_STATIC_SERVERS="&lt;font color=red&gt;172.20.0.37&lt;/font&gt;"/'
/etc/sysconfig/network/config
&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;將原本的 &lt;code&gt;172.20.0.254&lt;/code&gt; 改成 &lt;code&gt;172.20.0.37&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;重新開機&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;確認 DNS Server 修改正確&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ cat /etc/resolv.conf | grep -v &amp;#39;#&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nameserver 172.20.0.37&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;設定 Storage Class&lt;span class="hx:absolute hx:-mt-20" id="設定-storage-class"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-storage-class" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;預設的 StorageClass 他的 Replicas 會被設為 3 ，但因為只有單一台 Node，所以要額外新增一個 StorageClass 並將 Replicas 設為 1，否則 VM 會無法建立。&lt;/li&gt;
&lt;li&gt;點選左側選單 Advanced -&amp;gt; Storage Classes -&amp;gt; Create&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJRn6Onop.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;輸入以下資訊 :&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;new-sc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Number of Replicas 設為 &lt;code&gt;1&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;確認資訊輸入正確後，點選 Create&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rk0qR_nsT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;設成 Default&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkYfkKnoT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;透過 URL 下載 Cloud Images&lt;span class="hx:absolute hx:-mt-20" id="透過-url-下載-cloud-images"&gt;&lt;/span&gt;
&lt;a href="#%e9%80%8f%e9%81%8e-url-%e4%b8%8b%e8%bc%89-cloud-images" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;左側選單選擇 Images -&amp;gt; Create&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1Jaud2oT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;透過 URL 下載 OpenSUSE Leap 15.5 的 Cloud Images&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkxNtdnop.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;URL 如下 :
&lt;code&gt;https://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.5/images/openSUSE-Leap-15.5.x86_64-NoCloud.qcow2&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;確認下載完成&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJkPjdhi6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;新增 Cloud Config Templates&lt;span class="hx:absolute hx:-mt-20" id="新增-cloud-config-templates"&gt;&lt;/span&gt;
&lt;a href="#%e6%96%b0%e5%a2%9e-cloud-config-templates" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;User Data&lt;span class="hx:absolute hx:-mt-20" id="user-data"&gt;&lt;/span&gt;
&lt;a href="#user-data" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 Cloud Config Templates -&amp;gt; Create&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1lWeK2ia.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;輸入以下資訊 :&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;opensuse&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;#cloud-config
package_update: true
packages:
- qemu-guest-agent
write_files:
- path: /etc/sysctl.conf
permissions: 0644
owner: root
content: |
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
runcmd:
- - systemctl
- enable
- &amp;#39;--now&amp;#39;
- qemu-guest-agent.service
- yast dns edit nameserver1=172.20.0.37
- timedatectl set-timezone Asia/Taipei
- systemctl restart network
- sysctl -p
ssh_pwauth: true
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC2Km26Z03nqLOmoHgd4F1MEApHF2Vdib8sk86SwaxVAqaFXliaC/a6VRFBiQRuog8zYsjg51HMzmXc9zPaUMEbJ7mD23AfqOv&amp;#43;DoQc8KjYhr2bWPz33fqYBAz76XpDi6R8g8XEfWekUi&amp;#43;YV28O3QJOfNT6W8PNPfYVCvXmhVe0QIB9w5wyMUvwOdlpBdcCke6w1Wwg0OSBulJBT&amp;#43;p2qJ1HZBiIUsb7KYLyiwPfmiYakFo&amp;#43;L90DfXJhzuFMYUtOa7zw&amp;#43;zjWy9BDTF6xXlHKhvv4yylPsLl5DfA/aSztpzMTMsrXefGJjCcaAQMueikGRORZ7KDb2QJvj0U2iYw/GFivv3cOpgAxRzIo6pDROpfJAc8Xt59gQeDsRzF3JSY6gXJ&amp;#43;/xgEWSIMffKnF3VRk20zb/m&amp;#43;jWuCnKzj9GH9ribAJ5yWSA7zeWexSd0ZACvvb&amp;#43;ydW9RgnlecdUXarohWXbvH2CK3euxCjFVuMsaKqJvF2c2XfiIm8ZtgzF3WpRhbFOc= rancher@rancher
users:
- default
- name: rancher
gecos: rancher
groups: users
lock_passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
plain_text_passwd: &amp;#39;rancher&amp;#39;
shell: /bin/bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;package_update&lt;/code&gt;，會先更新系統的套件&lt;/li&gt;
&lt;li&gt;&lt;code&gt;packages&lt;/code&gt;，代表要安裝的套件&lt;/li&gt;
&lt;li&gt;&lt;code&gt;write_files&lt;/code&gt;，針對特定檔案寫入特定內容，這邊的範例是關 ipv6&lt;/li&gt;
&lt;li&gt;&lt;code&gt;runcmd&lt;/code&gt;，系統開機以後要執行的命令，這邊有設定啟動 qemu-guest-agent 服務，並設為開機自動啟動，還有設定 DNS Server 的位置，還有設定時區，特別設定 DNS Server 的原因是因為要可以跟 Rancher 溝通&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ssh_authorized_keys&lt;/code&gt;，讓跳板機可以免密碼登入使用這個 Cloud init config 做出來的 VM&lt;/li&gt;
&lt;li&gt;&lt;code&gt;users&lt;/code&gt;，新增使用者，並設定使用者的群組、sudo 權限和密碼。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;確認資訊輸入正確後，點選 Create&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByChxtnja.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;Network Data&lt;span class="hx:absolute hx:-mt-20" id="network-data"&gt;&lt;/span&gt;
&lt;a href="#network-data" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;Static&lt;span class="hx:absolute hx:-mt-20" id="static"&gt;&lt;/span&gt;
&lt;a href="#static" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;network:
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
address: 172.20.0.43/24
gateway: 172.20.0.253
- type: nameserver
address:
- 172.20.0.40&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;DHCP&lt;span class="hx:absolute hx:-mt-20" id="dhcp"&gt;&lt;/span&gt;
&lt;a href="#dhcp" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;network:
version: 1
config:
- type: physical
name: eth0
subnets:
- type: dhcp&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;建立 VM Network&lt;span class="hx:absolute hx:-mt-20" id="建立-vm-network"&gt;&lt;/span&gt;
&lt;a href="#%e5%bb%ba%e7%ab%8b-vm-network" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 Networks -&amp;gt; VM Networks -&amp;gt; Create&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryzy3Fajp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;編輯以下設定資訊&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;vlan&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Vlan ID: &lt;code&gt;100&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Cluster Netwrok: &lt;code&gt;mgmt&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;確認沒問題後，點選 Create&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJzJ6F6o6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;確認是否建立成功&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;State 和 Route Connectivity 的狀態都要顯示 Active&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hkm2ptTja.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;將其他節點加入 Harvester 叢集&lt;span class="hx:absolute hx:-mt-20" id="將其他節點加入-harvester-叢集"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%87%e5%85%b6%e4%bb%96%e7%af%80%e9%bb%9e%e5%8a%a0%e5%85%a5-harvester-%e5%8f%a2%e9%9b%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 將燒有 Harvester ISO 的 USB 可開機裝置插入伺服器，並使用 USB 開機。&lt;span class="hx:absolute hx:-mt-20" id="1-將燒有-harvester-iso-的-usb-可開機裝置插入伺服器並使用-usb-開機"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%b0%87%e7%87%92%e6%9c%89-harvester-iso-%e7%9a%84-usb-%e5%8f%af%e9%96%8b%e6%a9%9f%e8%a3%9d%e7%bd%ae%e6%8f%92%e5%85%a5%e4%bc%ba%e6%9c%8d%e5%99%a8%e4%b8%a6%e4%bd%bf%e7%94%a8-usb-%e9%96%8b%e6%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h3&gt;2. 安裝步驟&lt;span class="hx:absolute hx:-mt-20" id="2-安裝步驟-1"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%ae%89%e8%a3%9d%e6%ad%a5%e9%a9%9f-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.1. 使用 USB 開機，並透過選擇 Harvester Installer 選項啟動伺服器。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJiMSL2iT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;使用預設選項，直接按 Enter 按鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.2. 選擇加入一個已經存在的 Harvester Cluster&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Sk1v9Khip.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;選擇 &lt;code&gt;Join an existing Harvester cluster&lt;/code&gt; 後，按 Enter 按鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.3. 選擇要安裝的 Harvester 系統碟和要儲存虛擬機器資料的資料碟。&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJwppt2sT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;按 Tab 鍵可展開下拉式選單，按 Enter 鍵儲存設定值。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.4. 設定主機的 Hostname&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hypj6F2jT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;輸入 &lt;code&gt;h2&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.5. 設定網路&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByffCY2j6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;網路卡的部分，按 Tab 展開下拉式選單，按空白鍵選擇網路卡，確定之後按 Enter 鍵
IPv4 Address 欄位，輸入 : &lt;code&gt;172.20.0.35/24&lt;/code&gt;
Gateway 欄位，輸入 : &lt;code&gt;172.20.0.254&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.6. 設定 DNS Server&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkCXCtnsp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;DNS Server 欄位 : &lt;code&gt;172.20.0.37&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.7. 設定 管理 IP Address&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SymvRY2op.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Management address 欄位 : &lt;code&gt;172.20.0.36&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.8. 設定 Cluster Token&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryxCdvno6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Cluster token 欄位 : &lt;code&gt;lab&lt;/code&gt;
Cluster token 用於將其他節點新增至 Harvester 叢集。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.9. 設定使用者密碼&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkGStD3ja.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;預設的使用者是 &lt;code&gt;rancher&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.10. 設定 NTP Server&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryY4ec3ia.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;NTP Server 欄位 : &lt;code&gt;time.google.com&lt;/code&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.11. 設定 HTTP Proxy Server ( 此步驟不一定要設定，取決於當下的環境 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyJ-qDhsT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.12. 匯入 SSH Keys ( 此步驟不一定要設定 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkjwqPnia.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.13. 設定 Harvester 設定檔自訂主機 ( 此步驟不一定要設定 )&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJbMjwhjp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;如果不設定就空白，直接按 Enter 鍵。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.14. 查看並確認安裝選項&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1_Ue9ho6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;確認安裝選項沒問題後，按 Enter 鍵，Harvester 將會安裝到主機上。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.15. 安裝完成後，節點將重新啟動，以下是啟動完成畫面&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJVvH5nop.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;2.16. 打開 Harvester 網站，檢查 Node 是否變 2 台&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選左側選單 Hosts&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S112rcniT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;使用者預設是 &lt;code&gt;admin&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;與 Rancher 整合&lt;span class="hx:absolute hx:-mt-20" id="與-rancher-整合"&gt;&lt;/span&gt;
&lt;a href="#%e8%88%87-rancher-%e6%95%b4%e5%90%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;PreRequest&lt;span class="hx:absolute hx:-mt-20" id="prerequest-1"&gt;&lt;/span&gt;
&lt;a href="#prerequest-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;Harvester v1.2.1 肚子裡面的 Rancher 無法啟動虛擬化管理，所以需額外再安裝並啟動 Rancher Server 2.7.9，或是在 Harvester 啟動 &lt;a
href="https://docs.harvesterhci.io/v1.2/advanced/addons/rancher-vcluster"target="_blank" rel="noopener"&gt;rancher-vcluster&lt;/a&gt; (正在開發的功能)。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rancher 的安裝請參考我的另一篇筆記 &lt;a
href="https://hackmd.io/@QI-AN/RKE2-Rancher-Prime-Installation"target="_blank" rel="noopener"&gt;RKE2 &amp;amp; Rancher Prime Installation&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h3&gt;Rancher 啟動 Virtualization management&lt;span class="hx:absolute hx:-mt-20" id="rancher-啟動-virtualization-management"&gt;&lt;/span&gt;
&lt;a href="#rancher-%e5%95%9f%e5%8b%95-virtualization-management" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;打開虛擬化管理介面&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選左側選單 Virtualization Management&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryT5uc2jT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Import Harvester Cluster&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選 Import Existing&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Skog953oT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;填入叢集資訊&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;ul&gt;
&lt;li&gt;Cluster Name: &lt;code&gt;harvester&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1nw553j6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;填入叢集資訊&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;ul&gt;
&lt;li&gt;Cluster Name: &lt;code&gt;harvester&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1nw553j6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;複製讓 Harvester 與 Rancher 註冊的 URL&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hkugjc3o6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;回到 Harvester 的網站，與 Rancher 註冊 (1/2)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選左側選單 Settings -&amp;gt; 找到 cluster-registration-url -&amp;gt; 點選 Edit Setting&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1j3T9hjT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;回到 Harvester 的網站，與 Rancher 註冊 (2/2)&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;將註冊 URL 貼上 -&amp;gt; 點選 Save&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkIOAchj6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;到 Rancher UI 確認&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkrS1j2sp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;Creating an K3s Kubernetes Cluster&lt;span class="hx:absolute hx:-mt-20" id="creating-an-k3s-kubernetes-cluster"&gt;&lt;/span&gt;
&lt;a href="#creating-an-k3s-kubernetes-cluster" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;在 Home Page 點選 Create&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJc2yi2j6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;Node Driver 選擇 Harvester&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJuJgo3op.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;建立 Cloud Credential&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;ul&gt;
&lt;li&gt;Credential Name: &lt;code&gt;harvester&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Imported Harvester Cluster 選擇 harvester&lt;/li&gt;
&lt;li&gt;點選 Continue&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HkRIwo3ip.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;編輯 Machine Pools&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;VM 必須要能透過 DNS Server 解析 Rancher 的 FQDN，否則 K3S 將無法建立。&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Cluster Name: &lt;code&gt;bobo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;CPU: &lt;code&gt;4&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Memory: &lt;code&gt;8&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Namespace: &lt;code&gt;default&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;SSH User: &lt;code&gt;Opensuse&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Volumes:
&lt;ul&gt;
&lt;li&gt;Image Volume: &lt;code&gt;openSUSE-Leap-15.5.x86_64-NoCloud.qcow2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Disk: &lt;code&gt;100&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ5aIFasa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Networks:
&lt;ul&gt;
&lt;li&gt;Network Name: &lt;code&gt;default/vlan (vlanId=100)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Show Advanced&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1Jzx5TjT.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;User Data:
&lt;ul&gt;
&lt;li&gt;User Data Template: &lt;code&gt;opensuse&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJwCJ9Tsp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;編輯 Cluster Configuration&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;ul&gt;
&lt;li&gt;選擇 Kubernetes 版本 : k3s v1.26.13+k3s2&lt;/li&gt;
&lt;li&gt;點選 Create&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJKV-qpjp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;檢查 K3S 是否建立成功&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選 Provisioning Log&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1ARl6pj6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;要 Troubleshooting 的話，可以 ssh 連線到 VM 中，看以下兩個檔案 :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/var/log/cloud-init.log&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/var/log/cloud-init-output.log&lt;/code&gt;，這檔案裡面紀錄 cloud init 命令執行的結果，包含透過 Rancher 安裝 K3S 的過程都會記在這個檔案中。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h3&gt;K3s node Scale up to 2&lt;span class="hx:absolute hx:-mt-20" id="k3s-node-scale-up-to-2"&gt;&lt;/span&gt;
&lt;a href="#k3s-node-scale-up-to-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Scale up node&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選 Machine Pools -&amp;gt; +&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJdI7ppoa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;檢查是否符合預期&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryfIV6Ti6.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;K3s node Scale down to 1&lt;span class="hx:absolute hx:-mt-20" id="k3s-node-scale-down-to-1"&gt;&lt;/span&gt;
&lt;a href="#k3s-node-scale-down-to-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Scale down node&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;點選 Machine Pools -&amp;gt; -&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SyS1BT6sp.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;檢查是否符合預期&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1gCBapsa.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;Add Additional Disks&lt;span class="hx:absolute hx:-mt-20" id="add-additional-disks"&gt;&lt;/span&gt;
&lt;a href="#add-additional-disks" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;再新增一顆硬碟後，要先 Format 成 ext4 檔案系統，並重啟節點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo -i
mkfs.ext4 /dev/sdb
sudo reboot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go to the &lt;strong&gt;&lt;code&gt;Hosts&lt;/code&gt;&lt;/strong&gt; page.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On the node you want to modify, click &lt;strong&gt;&lt;code&gt;⋮&lt;/code&gt;&lt;/strong&gt; &amp;gt; &lt;strong&gt;&lt;code&gt;Edit Config&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the &lt;strong&gt;&lt;code&gt;Storage&lt;/code&gt;&lt;/strong&gt; tab and click &lt;strong&gt;&lt;code&gt;Add Disk&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkXCHb8SZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select an additional raw block device to add as an additional data volume.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;Force Formatted&lt;/code&gt; option is required if the block device has never been force-formatted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Last, you can click &lt;strong&gt;⋮&lt;/strong&gt; &amp;gt; &lt;strong&gt;Edit Config&lt;/strong&gt; again to check the newly added disk.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Resize Disk (虛擬化環境)&lt;span class="hx:absolute hx:-mt-20" id="resize-disk-虛擬化環境"&gt;&lt;/span&gt;
&lt;a href="#resize-disk-%e8%99%9b%e6%93%ac%e5%8c%96%e7%92%b0%e5%a2%83" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;先在虛擬化那層擴硬碟空間&lt;/li&gt;
&lt;li&gt;SSH 連線進那台 node，並切換成 root 使用者&lt;/li&gt;
&lt;li&gt;Resize Partitaion 大小&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 確認 /var/lib/harvester/defaultdisk 在哪顆硬碟
$ df -h /var/lib/harvester/defaultdisk
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 330G 30G 283G 10% /var/lib/harvester/defaultdisk
$ fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 712 GiB, 764504178688 bytes, 1493172224 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C1C6588D-E0EB-42EB-A68B-3676181AED1E
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 106495 102400 50M Linux filesystem
/dev/sda3 106496 16883711 16777216 8G Linux filesystem
/dev/sda4 16883712 48340991 31457280 15G Linux filesystem
/dev/sda5 48340992 369205247 320864256 153G Linux filesystem
/dev/sda6 369205248 1073739775 704534528 335.9G Linux filesystem
Command (m for help): d
Partition number (1-6, default 6):
Partition 6 has been deleted.
Command (m for help): n
Partition number (6-128, default 6):
First sector (369205248-1493172190, default 369205248):
Last sector, &amp;#43;/-sectors or &amp;#43;/-size{K,M,G,T,P} (369205248-1493172190, default 1493172190):
Created a new partition 6 of type &amp;#39;Linux filesystem&amp;#39; and of size 535.9 GiB.
Partition #6 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): p
Disk /dev/sda: 712 GiB, 764504178688 bytes, 1493172224 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C1C6588D-E0EB-42EB-A68B-3676181AED1E
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 106495 102400 50M Linux filesystem
/dev/sda3 106496 16883711 16777216 8G Linux filesystem
/dev/sda4 16883712 48340991 31457280 15G Linux filesystem
/dev/sda5 48340992 369205247 320864256 153G Linux filesystem
/dev/sda6 369205248 1493172190 1123966943 535.9G Linux filesystem
Command (m for help): w
The partition table has been altered.
Syncing disks.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;執行以下命令 Resize Longhorn 的 Filesystem&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ resize2fs -p /dev/sda6
$ df -h /var/lib/harvester/defaultdisk
Filesystem Size Used Avail Use% Mounted on
/dev/sda6 527G 30G 472G 6% /var/lib/harvester/defaultdisk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;再進 Longhorn UI 看就會發現空間擴出來了&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Stop VM with cli&lt;span class="hx:absolute hx:-mt-20" id="stop-vm-with-cli"&gt;&lt;/span&gt;
&lt;a href="#stop-vm-with-cli" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 1. SSH into harvester node
$ ssh rancher@x.x.x.x
# 2. Get VVirtual Machine Instance
$ kubectl get vmi
NAME AGE PHASE IP NODENAME READY
harbor 12m Running hh False
hehe 6m41s Running 10.52.0.180 hh True
k3-pool1-2d0bd15b-4fv96 14h Running 172.20.0.42 hh True
rancher 14h Running 172.20.0.41 hh True
# 3. Stop VM
$ virtctl stop harbor
VM harbor was scheduled to stop&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;參考文章&lt;span class="hx:absolute hx:-mt-20" id="參考文章"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e6%96%87%e7%ab%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://docs.harvesterhci.io/v1.2/install/requirements"target="_blank" rel="noopener"&gt;Hardware and Network Requirements - Harvester Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://docs.harvesterhci.io/v1.2/install/usb-install"target="_blank" rel="noopener"&gt;USB Installation - Harvester Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>透過 VMware Aria Operations 監控 openshift</title><link>https://blog.kubeantony.com/archive/openshift/%E9%80%8F%E9%81%8E-vmware-aria-operations-%E7%9B%A3%E6%8E%A7-openshift/</link><pubDate>Tue, 13 Jan 2026 02:13:56 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/%E9%80%8F%E9%81%8E-vmware-aria-operations-%E7%9B%A3%E6%8E%A7-openshift/</guid><description>
&lt;h2&gt;1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="1-先決條件"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在使用 VMware Aria Operations Management Pack for Kubernetes 來監控 Kubernetes 叢集之前，您必須先準備好您的 VMware Aria Operations 環境。您必須確保 VMware Aria Operations 符合下列一般需求。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;確保您已安裝 &lt;strong&gt;VMware Aria Operations (SaaS)&lt;/strong&gt; 或 &lt;strong&gt;VMware Aria Operations 8.1&lt;/strong&gt; 或更高版本。&lt;/li&gt;
&lt;li&gt;確認您已安裝 &lt;strong&gt;VMware Aria Operations Management Pack for Kubernetes&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;確保您的環境中已部署一個 &lt;strong&gt;Openshift 叢集&lt;/strong&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 環境準備&lt;span class="hx:absolute hx:-mt-20" id="2-環境準備"&gt;&lt;/span&gt;
&lt;a href="#2-%e7%92%b0%e5%a2%83%e6%ba%96%e5%82%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;2.1. 在 Kubernetes 中安裝 VMware Aria Operations Management Pack&lt;span class="hx:absolute hx:-mt-20" id="21-在-kubernetes-中安裝-vmware-aria-operations-management-pack"&gt;&lt;/span&gt;
&lt;a href="#21-%e5%9c%a8-kubernetes-%e4%b8%ad%e5%ae%89%e8%a3%9d-vmware-aria-operations-management-pack" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;h4&gt;2.1.1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="211-先決條件"&gt;&lt;/span&gt;
&lt;a href="#211-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 已安裝 Kubernetes&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 已安裝 VMware Aria Operations&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 確認擁有最新版本的管理套件，且該管理套件與您的 VMware Aria Operations 版本相容。&lt;/li&gt;
&lt;li&gt;&lt;input checked="" disabled="" type="checkbox"&gt; 確保擁有安裝管理套件的權限。&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;2.1.2. 開始安裝&lt;span class="hx:absolute hx:-mt-20" id="212-開始安裝"&gt;&lt;/span&gt;
&lt;a href="#212-%e9%96%8b%e5%a7%8b%e5%ae%89%e8%a3%9d" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;從 VMware Marketplace 下載該管理套件的 PAK 檔案。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;使用管理員權限登入 VMware Aria Operations。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;從左側選單中，點擊 &lt;strong&gt;Data Sources&lt;/strong&gt; &amp;gt; &lt;strong&gt;Integrations&lt;/strong&gt;。前往右側窗格中的 &lt;strong&gt;Repository&lt;/strong&gt; 索引標籤。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 &lt;strong&gt;Repository&lt;/strong&gt; 索引標籤上，點擊 &lt;strong&gt;Add&lt;/strong&gt;。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1dlNJZ3le.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;此時會出現「Add Solutions Wizard Options」(新增解決方案精靈選項)。該精靈包含三個頁面，您可以在此尋找並上傳 PAK 檔案、接受 EULA (使用者授權合約) 並進行安裝，以及檢視安裝過程。點擊 &lt;strong&gt;Browse&lt;/strong&gt; (瀏覽) 以找到您的暫存資料夾並選取 PAK 檔案。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;在升級至最新版本時，您可以勾選 &lt;strong&gt;Install the PAK file even if it is already installed&lt;/strong&gt; (即使已安裝也要安裝 PAK 檔案) 和 &lt;strong&gt;Reset Default Content&lt;/strong&gt; (重設預設內容) 這兩個選項。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;點擊 &lt;strong&gt;Upload&lt;/strong&gt; (上傳)。上傳過程可能需要幾分鐘。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S15FV1W3xl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;閱讀並接受 EULA，然後點擊 &lt;strong&gt;Next&lt;/strong&gt; (下一步)。
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By46Nybhll.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;當 VMware Aria Operations Management Pack for Kubernetes 安裝完成後，點擊 &lt;strong&gt;Finish&lt;/strong&gt; (完成)。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;從 Data Sources -&amp;gt; Integrations -&amp;gt; ADD → Kubernetes 索引標籤設定此項整合。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;先在 openshift 建立一個 read only 的 serviceAccount&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 建立 ServiceAccount
oc create serviceaccount vrops-mp-read-only-user -n openshift-logging
# 賦予必要讀取權限
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z vrops-mp-read-only-user -n openshift-logging
oc adm policy add-cluster-role-to-user cluster-reader -z vrops-mp-read-only-user -n openshift-logging
# 建立長期 Token (Secret)
cat &amp;lt;&amp;lt;EOF | oc apply -f -
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: vrops-mp-read-only-user-token
namespace: openshift-logging
annotations:
kubernetes.io/service-account.name: &amp;#34;vrops-mp-read-only-user&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲取 sa 的 token&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo $(oc get secret vrops-mp-read-only-user-token -n openshift-logging -o jsonpath=&amp;#39;{.data.token}&amp;#39; | base64 -d)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;eyJhbGciOiJSUzI1NiIsImtpZCI6Ijk5Vi1DZlc5M1Y0eUh5UEtBYTA4bG9OaC1jMFFTT0s1cElCa0lOZ3NuaTAifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6InZyb3BzLW1wLXJlYWQtb25seS11c2VyLXRva2VuIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6InZyb3BzLW1wLXJlYWQtb25seS11c2VyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiNDI2MmJmNTctMzA5OC00ZjYxLWFlMDAtNDE3M2UzMmYzZGJjIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6dnJvcHMtbXAtcmVhZC1vbmx5LXVzZXIifQ.lpM7IEWiiB4sbrCLYB-Re_R4d7-g3sELisU4npjJyp_pwzJB0LehOo-pwnlwWH33FtTOqrsD26hYlYO5POmEpGjAUt49DoL9-SkoOfCjcQy82lGKbj_F6kMVqyddVEcHBIUWIuHAckvekSerLxH1M4dIztBnTFXulKJ_GIY72VA6aQOt0kGX35-dCH8GK-nHUJIu5cKcbrWV1NAfkzLBpFqlkVnjcOgHpf2jXJ3-3ozGQ4wMvCeZlG9YA86rY8Xn1XrlbztQx2klURLuy4b2RgEt7sfZuilrZScrFoPI68a7Av5prb8EQeRnzEZSsagNP5RfH5PG1qmRW64R_BrAlg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;依序輸入以下欄位內容：&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Cloud Account Information
&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;openshift&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Connection Information
&lt;ul&gt;
&lt;li&gt;Control Plane URL: &lt;code&gt;https://api.topgun.kubeantony.com:6443&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;執行 &lt;code&gt;oc config view&lt;/code&gt; 找到 &lt;code&gt;clusters.cluster.server&lt;/code&gt; 的值&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Collector Service: &lt;code&gt;Prometheus Server&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Credential: &lt;code&gt;&amp;lt;點選右邊的 + 按鈕&amp;gt;&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Credential Kind: &lt;code&gt;Token Auth&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Credential name: &lt;code&gt;ocp-prometheus&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Bearer Token: &lt;code&gt;將步驟 11 得到的 token 複製貼上&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Prometheus Server: &lt;code&gt;https://prometheus-k8s-openshift-monitoring.apps.topgun.kubeantony.com/&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;執行以下命令獲取：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo https://$(oc get routes -n openshift-monitoring prometheus-k8s -o jsonpath=&amp;#39;{.status.ingress[0].host}&amp;#39;)/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
命令執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://prometheus-k8s-openshift-monitoring.apps.topgun.kubeantony.com/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Prometheus endpoint token:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;執行以下命令獲取：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc create sa monitor-reader -n default
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z monitor-reader -n default
oc adm policy add-cluster-role-to-user cluster-reader -z monitor-reader -n default
# 建立長期 Token (Secret)
cat &amp;lt;&amp;lt;EOF | oc apply -f -
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: monitor-reader-token
namespace: default
annotations:
kubernetes.io/service-account.name: &amp;#34;monitor-reader&amp;#34;
EOF
echo $(oc get secret monitor-reader-token -n default -o jsonpath=&amp;#39;{.data.token}&amp;#39; | base64 -d)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;命令執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;eyJhbGciOiJSUzI1NiIsImtpZCI6Ild2Y3ZIRzk4cEhGSlJFeGt0dk1lS1hQQzlldDNIQkdnbXhFd0NLTmRLNVEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im1vbml0b3ItcmVhZGVyLXRva2VuIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Im1vbml0b3ItcmVhZGVyIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiYTE2ZTNhYTYtOWI3NC00NjQ3LTlkZjctZDE5MWJjM2RiNTcxIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6bW9uaXRvci1yZWFkZXIifQ.wo6tD4uW-4dXgJ2hy92MnIim0V2ZLu2Yzt9ZyCZ3Y9qcZ29brh9JV6fNgNarK1eY7qIcDQKNr5IFxOHL3dZzZUI5ZlfW-rI9HYpZHbbUKDqr1b7yf6_ZtW-kTAiSdehn0DGXynPCNDpfW7MpwrsD_HUGzuYmXB2U3uTZe2soeI4zQsFSgWNjmna12oXsQ59k7uvXevjcyC4_SVI3g5BryDUhrdeAKBcZpYs5udOPgw1-j0Th0BS25xOOG4sQO3weP2CiRtYwm2RLXpct_zJXTlAMyxo05UG7vwpHOfh8nsSP0TdXuRNA4Z4-A6WmI9VGCQdohsC6kOQgeVTcZ7yL0KMrz8TE3i6_V9Uo9tiH0Mc-fBM68Tb6r6VlNgGfHM4iGeuC4gBrYM2Nn0EC2GqOlRcZ_odifGZbkIpe0LO07kAF-OwEVRra2qlcPdvD5dEOnXYf3Nh2LyuupNKAspZ1sORw3pfix8C6lwBIFqo3OdmkNZCJHfr4BaDqBaA5Gl4Z8uSCUn5Gn2_F1kcq9iECZheQNhD4pFyMebNZyrKDbu1s67N8rjDR79urOzuIriB1FbElVoG1AHP2aNcX1bDOcNgtOptpRGdxgB1gkdgRpkVbq8PAu-W6dwU2NPEjljUaIe4Myf8vzhhJVq_DzYKOOhFTMKAPAyEzrFC3jABcXYQ&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ58eZ7Wbx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Collector / Group: 選 &lt;code&gt;CloudProxy-xx-xx-xx-xx-xxx&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJ7_QZXWWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Advanced Settings
&lt;ul&gt;
&lt;li&gt;Java Process Monitoring: &lt;code&gt;Activatied&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Delete nonexistent object older than: &lt;code&gt;2 hours&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;cAdvisor Install Check: &lt;code&gt;Deactivated&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;點選左下角 SAVE 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByopWvNxWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ol start="13"&gt;
&lt;li&gt;確認連接成功
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ryWSm-XZbx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>How to Authenticate Users in Kubernetes with Keycloak OIDC Provider for Secure Cluster Access</title><link>https://blog.kubeantony.com/archive/kubernetes/how-to-authenticate-users-in-kubernetes-with-keycloak-oidc-provider-for-secure-cluster-access/</link><pubDate>Sun, 11 Jan 2026 06:54:20 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/how-to-authenticate-users-in-kubernetes-with-keycloak-oidc-provider-for-secure-cluster-access/</guid><description>
&lt;h2&gt;1. Preface&lt;span class="hx:absolute hx:-mt-20" id="1-preface"&gt;&lt;/span&gt;
&lt;a href="#1-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章會介紹如何用 keycloak 作為 OIDC provider 來保護 Kubernetes API Server，並搭配 Kubrenetes RBAC 控制來自 keycloak users 或 group 的訪問。&lt;/p&gt;
&lt;h2&gt;2. 痛點和解決方案&lt;span class="hx:absolute hx:-mt-20" id="2-痛點和解決方案"&gt;&lt;/span&gt;
&lt;a href="#2-%e7%97%9b%e9%bb%9e%e5%92%8c%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;靜態 Kubeconfig 檔案不僅拖慢團隊效率，更會導致資安漏洞。&lt;/p&gt;
&lt;p&gt;對於 AI 開發人員、研究人員和 Kubernetes 管理員而言，存取叢集往往意味著必須費心管理散落在多台機器與使用者之間的長期憑證。這不僅效率低落、難以稽核，更是反覆出現且令人頭痛的合規難題。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;解決方案： 利用 OpenID Connect (OIDC) 將 Kubernetes 連接至現有的身分提供者 (Identity Provider)&lt;/strong&gt;。&lt;/p&gt;
&lt;h2&gt;2. 什麼是 OpenID Connect (OIDC)&lt;span class="hx:absolute hx:-mt-20" id="2-什麼是-openid-connect-oidc"&gt;&lt;/span&gt;
&lt;a href="#2-%e4%bb%80%e9%ba%bc%e6%98%af-openid-connect-oidc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;OpenID Connect (OIDC) 是建構於 OAuth 2.0 之上的一種身分認證層 (Identity Layer)。&lt;strong&gt;它允許客戶端（例如 Kubernetes）透過外部身分提供者 (IdP) 來驗證使用者身分，並以標準化、符合 REST 風格的方式取得基本的使用者資料。&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;OAuth（Open Authorization）是一個關於授權（authorization）的開放網路標準，允許使用者授權第三方應用程式存取他們儲存在其他服務提供者上的信息，而不需要將使用者名稱和密碼提供給第三方應用。 OAuth 在全世界得到了廣泛的應用，目前的版本是 2.0 。&lt;/p&gt;
&lt;p&gt;OpenID Connect (OIDC) 是一種身分驗證協議，基於 OAuth 2.0 系列規格。 OAuth2 提供了&lt;code&gt;access_token&lt;/code&gt; 來解決授權第三方用戶端存取受保護資源的問題，OpenID Connect 在這個基礎上提供了 &lt;code&gt;id_token&lt;/code&gt; 來解決第三方用戶端標識使用者身分的問題。&lt;/p&gt;
&lt;p&gt;OpenID Connect 的核心在於，在 OAuth2 的授權流程中，同時提供使用者的身份資訊（id_token）給到第三方用戶端。&lt;code&gt;id_token&lt;/code&gt; 使用 JWT（JSON Web Token）格式進行封裝，得益於 JWT 的自包含性，緊湊性以及防篡改機制等特點，使得 &lt;code&gt;id_token&lt;/code&gt; 可以安全地傳遞給第三方客戶端程序並且易於驗證。&lt;/p&gt;
&lt;p&gt;JSON Web Token（JWT）是一個開放的行業標準（RFC 7519），它定義了一種簡潔的、自包含的協議格式，用於在通信雙方間傳遞 JSON 對象，傳遞的信息經過數字簽名可以被驗證和信任。想要了解 JWT 的詳細內容請參考 &lt;a
href="https://mp.weixin.qq.com/s?__biz=MzkxOTIwMDgxMg==&amp;amp;mid=2247484310&amp;amp;idx=1&amp;amp;sn=fea9b5bb11623fd447847e35b4057a56&amp;amp;scene=21&amp;amp;poc_token=HIlpYGmj5mtklXk6OiegATPG-sz_tRGy6aaPyfpt"target="_blank" rel="noopener"&gt;JWT（JSON Web Token）&lt;/a&gt;。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;在 Kubernetes 環境中，OIDC 取代了靜態且由本地管理的憑證，轉而信任組織現有的認證系統。這能實現：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;強化安全性&lt;/strong&gt;：以短效 Token (Short-lived tokens) 取代靜態的 kubeconfig 檔案。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;加速人員異動流程&lt;/strong&gt;：透過統一的身分生命週期管理，加快人員到職啟用 (Onboarding) 與離職停用 (Deprovisioning) 的速度。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;內建合規性&lt;/strong&gt;：具備集中式認證與可稽核性 (Auditability)。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;3. 靜態 Kubeconfig 檔案的問題&lt;span class="hx:absolute hx:-mt-20" id="3-靜態-kubeconfig-檔案的問題"&gt;&lt;/span&gt;
&lt;a href="#3-%e9%9d%9c%e6%85%8b-kubeconfig-%e6%aa%94%e6%a1%88%e7%9a%84%e5%95%8f%e9%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;許多 Kubernetes 叢集仍仰賴手動分發 Kubeconfig 檔案，其中包含的憑證有效期可能長達數月，甚至永久有效。這導致了以下問題：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;資安風險&lt;/strong&gt;：設定檔一旦遭竊，攻擊者即可在未被察覺的情況下持續存取叢集。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;維運阻礙&lt;/strong&gt;：原本在 kubeconfig 檔案中，user client 憑證要一年換一次，且憑證輪替 (Credential rotation) 的過程緩慢容易出錯。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;擴展性瓶頸&lt;/strong&gt;：隨著團隊規模擴大，管理個別使用者的設定檔將變得難以掌控。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;4. OIDC 如何解決此問題&lt;span class="hx:absolute hx:-mt-20" id="4-oidc-如何解決此問題"&gt;&lt;/span&gt;
&lt;a href="#4-oidc-%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%ba%e6%ad%a4%e5%95%8f%e9%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;將 OIDC 與 Kubernetes 整合，讓您能透過以下方式，解決手動分發 kubeconfig 檔案的問題：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;移除 user client 憑證&lt;/strong&gt;：每一次的連線階段 (Session) 都必須透過 IdP 進行認證。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;實施角色權限控制 (RBAC)&lt;/strong&gt;：將 IdP 的群組對應 (Map) 至 Kubernetes 的 RBAC 角色。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;集中身分管理&lt;/strong&gt;：在 IdP 中統一管理所有的使用者和群組，而非讓設定散落在各處的設定檔中。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;5. Keycloak 介紹&lt;span class="hx:absolute hx:-mt-20" id="5-keycloak-介紹"&gt;&lt;/span&gt;
&lt;a href="#5-keycloak-%e4%bb%8b%e7%b4%b9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;keycloak 是一個開源的、面向現代應用程式和服務的 IAM（身分認證和存取控制）解決方案。 Keycloak 提供了單一登入（SSO）功能，支援 &lt;strong&gt;OpenID Connect&lt;/strong&gt;、&lt;strong&gt;OAuth 2.0&lt;/strong&gt;、&lt;strong&gt;SAML 2.0&lt;/strong&gt; 等協議，同時 Keycloak 也支援整合不同的身分認證服務，例如 LDAP、Active Directory、Github、Google 和 Facebook 等等。&lt;/p&gt;
&lt;hr&gt;
&lt;h1&gt;&lt;font color=blue&gt;開始部署和初始化設定 HA Keycloak&lt;/font&gt;&lt;/h1&gt;&lt;h2&gt;1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="1-先決條件"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;部署好一套 Kubernetes 叢集，我使用的叢集版本是 &lt;code&gt;v1.34.2&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;已在作業系統中安裝 &lt;code&gt;kubectl&lt;/code&gt; 和 &lt;code&gt;wget&lt;/code&gt; 工具。&lt;/li&gt;
&lt;li&gt;具有 &lt;code&gt;cluster-admin&lt;/code&gt; 的管理權限。
&lt;ul&gt;
&lt;li&gt;可執行 &lt;code&gt;kubectl auth whoami&lt;/code&gt; 確認&lt;/li&gt;
&lt;li&gt;預期執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ATTRIBUTE VALUE
Username kubernetes-admin
Groups [kubeadm:cluster-admins system:authenticated]
Extra: authentication.kubernetes.io/credential-id [X509SHA256=e0692cad816cb69cf9f8685f14343bd5f06618cb6ddbae57e70632ea595064dc]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;已在 Kuebernetes 中安裝 ingress，在我的環境中是安裝 &lt;code&gt;ingress-nginx&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;可執行 &lt;code&gt;kubectl get ingressclasses&lt;/code&gt; 確認&lt;/li&gt;
&lt;li&gt;預期執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CONTROLLER PARAMETERS AGE
nginx k8s.io/ingress-nginx &amp;lt;none&amp;gt; 37d&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;本篇文章測試的 K8s 節點資訊如下
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kubeadm-c1.kubeantony.com Ready control-plane 37d v1.34.2 10.200.8.21 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-88-generic cri-o://1.34.3
kubeadm-c2.kubeantony.com Ready control-plane 37d v1.34.2 10.200.8.22 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-71-generic cri-o://1.34.3
kubeadm-c3.kubeantony.com Ready control-plane 37d v1.34.2 10.200.8.23 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-71-generic cri-o://1.34.3
kubeadm-w1.kubeantony.com Ready logging,worker 37d v1.34.2 10.200.8.24 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-71-generic cri-o://1.34.3
kubeadm-w2.kubeantony.com Ready logging,worker 37d v1.34.2 10.200.8.25 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-71-generic cri-o://1.34.3
kubeadm-w3.kubeantony.com Ready logging,worker 37d v1.34.2 10.200.8.26 &amp;lt;none&amp;gt; Ubuntu 24.04.3 LTS 6.8.0-71-generic cri-o://1.34.3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 安裝 Keycloak Operator&lt;span class="hx:absolute hx:-mt-20" id="2-安裝-keycloak-operator"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%ae%89%e8%a3%9d-keycloak-operator" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;使用 ssh 連線進可以執行 &lt;code&gt;kubectl&lt;/code&gt; 的 K8s 管理主機&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/kubeadm/addon/keycloak; cd ${HOME}/k8s/kubeadm/addon/keycloak&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Kustomize 目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p {env/test,resource/base-v26.4.7/operator/crd}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視當前目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tree -d .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;.
├── env
│   └── test ## 用來存放在測試環境中，keycloak 相關的 yaml 檔
└── resource
└── base-v26.4.7
└── operator ## 用來存放 keycloak operator 相關的 yaml 檔
└── crd
7 directories&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 keycloak operator 的 crd yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget -P resource/base-v26.4.7/operator/crd \
https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.4.7/kubernetes/keycloaks.k8s.keycloak.org-v1.yml
wget -P resource/base-v26.4.7/operator/crd \
https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.4.7/kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak operator 的 namespace yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; resource/base-v26.4.7/operator/keycloak-operator-ns.yaml
apiVersion: v1
kind: Namespace
metadata:
name: keycloak
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 keycloak operator 的 deployment yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget -O resource/base-v26.4.7/operator/keycloak-operator-deployment.yaml \
https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.4.7/kubernetes/kubernetes.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak operator 的 kustomization yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; resource/kustomization.yaml
kind: Kustomization
resources:
- ./base-v26.4.7/operator/crd/keycloaks.k8s.keycloak.org-v1.yml
- ./base-v26.4.7/operator/crd/keycloakrealmimports.k8s.keycloak.org-v1.yml
- ./base-v26.4.7/operator/keycloak-operator-ns.yaml
- ./base-v26.4.7/operator/keycloak-operator-deployment.yaml
namespace: keycloak
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試部署 keycloak operator 是否有誤&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k resource/ --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Warning: resource namespaces/keycloak is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
namespace/keycloak configured (server dry run)
customresourcedefinition.apiextensions.k8s.io/keycloakrealmimports.k8s.keycloak.org created (server dry run)
customresourcedefinition.apiextensions.k8s.io/keycloaks.k8s.keycloak.org created (server dry run)
serviceaccount/keycloak-operator created (server dry run)
role.rbac.authorization.k8s.io/keycloak-operator-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/keycloak-operator-clusterrole created (server dry run)
clusterrole.rbac.authorization.k8s.io/keycloakcontroller-cluster-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/keycloakrealmimportcontroller-cluster-role created (server dry run)
rolebinding.rbac.authorization.k8s.io/keycloak-operator-role-binding created (server dry run)
rolebinding.rbac.authorization.k8s.io/keycloak-operator-view created (server dry run)
rolebinding.rbac.authorization.k8s.io/keycloakcontroller-role-binding created (server dry run)
rolebinding.rbac.authorization.k8s.io/keycloakrealmimportcontroller-role-binding created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/keycloak-operator-clusterrole-binding created (server dry run)
service/keycloak-operator created (server dry run)
deployment.apps/keycloak-operator created (server dry run)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認沒問題後，正式部署&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k resource/ &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 keycloak operator pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n keycloak get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
keycloak-operator-59c9ff54-h9wvv 1/1 Running 0 2m13s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;2. 安裝 local path provisioner (如果環境已有 StorageClass 可跳過此步驟)&lt;span class="hx:absolute hx:-mt-20" id="2-安裝-local-path-provisioner-如果環境已有-storageclass-可跳過此步驟"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%ae%89%e8%a3%9d-local-path-provisioner-%e5%a6%82%e6%9e%9c%e7%92%b0%e5%a2%83%e5%b7%b2%e6%9c%89-storageclass-%e5%8f%af%e8%b7%b3%e9%81%8e%e6%ad%a4%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;部署 local path provisioner&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.34/deploy/local-path-storage.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 local path provisioner 的 pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n local-path-storage get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
local-path-provisioner-5cf8df5d54-wtl8k 1/1 Running 1 (12h ago) 12h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 storageclass 名稱&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl get sc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path rancher.io/local-path Delete WaitForFirstConsumer false 107d&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 透過 CloudNativePG Operator 安裝 PostgreSQL cluster&lt;span class="hx:absolute hx:-mt-20" id="3-透過-cloudnativepg-operator-安裝-postgresql-cluster"&gt;&lt;/span&gt;
&lt;a href="#3-%e9%80%8f%e9%81%8e-cloudnativepg-operator-%e5%ae%89%e8%a3%9d-postgresql-cluster" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/kubeadm/addon/cloudNativePG; cd ${HOME}/k8s/kubeadm/addon/cloudNativePG&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Kustomize 目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p {env/test,resource/base-v1.28.0/operator}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視當前目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tree -d .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;.
├── env
│   └── test
└── resource
└── base-v1.28.0
└── operator
6 directories&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 CloudNativePG Operator yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget -P resource/base-v1.28.0/operator \
https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.28/releases/cnpg-1.28.0.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 CloudNativePG Operator 的 kustomization yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; resource/kustomization.yaml
kind: Kustomization
resources:
- ./base-v1.28.0/operator/cnpg-1.28.0.yaml
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試部署 CloudNativePG Operator&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k resource/ --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/cnpg-system created (server dry run)
customresourcedefinition.apiextensions.k8s.io/backups.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/clusterimagecatalogs.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/clusters.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/databases.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/failoverquorums.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/imagecatalogs.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/publications.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/scheduledbackups.postgresql.cnpg.io created (server dry run)
customresourcedefinition.apiextensions.k8s.io/subscriptions.postgresql.cnpg.io created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-database-editor-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-database-viewer-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-manager created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-publication-editor-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-publication-viewer-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-subscription-editor-role created (server dry run)
clusterrole.rbac.authorization.k8s.io/cnpg-subscription-viewer-role created (server dry run)
clusterrolebinding.rbac.authorization.k8s.io/cnpg-manager-rolebinding created (server dry run)
mutatingwebhookconfiguration.admissionregistration.k8s.io/cnpg-mutating-webhook-configuration created (server dry run)
validatingwebhookconfiguration.admissionregistration.k8s.io/cnpg-validating-webhook-configuration created (server dry run)
Error from server (Invalid): error when creating &amp;#34;resource/&amp;#34;: CustomResourceDefinition.apiextensions.k8s.io &amp;#34;poolers.postgresql.cnpg.io&amp;#34; is invalid: metadata.annotations: Too long: may not be more than 262144 bytes
Error from server (NotFound): error when creating &amp;#34;resource/&amp;#34;: namespaces &amp;#34;cnpg-system&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;resource/&amp;#34;: namespaces &amp;#34;cnpg-system&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;resource/&amp;#34;: namespaces &amp;#34;cnpg-system&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;resource/&amp;#34;: namespaces &amp;#34;cnpg-system&amp;#34; not found&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 CloudNativePG Operator&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k resource/ --server-side&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 CloudNativePG Operator 的 pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cnpg-system get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cnpg-controller-manager-6b9f78f594-8g2qt 1/1 Running 0 40s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 PostgreSQL cluster 的 namespace yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/cnpg-ns.yaml
apiVersion: v1
kind: Namespace
metadata:
name: cnpg
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 PostgreSQL cluster 儲存初始化資料庫的使用者帳密的 secret yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/cnpg-user-secret.yaml
apiVersion: v1
data:
password: YmlncmVk
username: YmlncmVk
kind: Secret
metadata:
name: cnpg-bigred
namespace: cnpg
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 PostgreSQL cluster 的 cluster yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/cnpg-cluster.yaml
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: psql
namespace: cnpg
spec:
instances: 3
imageName: ghcr.io/cloudnative-pg/postgresql:17.5
bootstrap:
initdb:
database: keycloak
owner: bigred
secret:
name: cnpg-bigred
storage:
storageClass: local-path
size: 1Gi
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 PostgreSQL cluster 的 pooler yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/cnpg-pooler.yaml
apiVersion: postgresql.cnpg.io/v1
kind: Pooler
metadata:
name: pooler-rw
namespace: cnpg
spec:
cluster:
name: psql
instances: 3
type: rw
pgbouncer:
poolMode: session
parameters:
max_client_conn: &amp;#34;1000&amp;#34;
default_pool_size: &amp;#34;10&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 PostgreSQL cluster 的 kustomizte yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/kustomization.yaml
kind: Kustomization
resources:
- ./cnpg-ns.yaml
- ./cnpg-user-secret.yaml
- ./cnpg-cluster.yaml
- ./cnpg-pooler.yaml
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試部署 PostgreSQL cluster&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/ --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/cnpg created (server dry run)
Error from server (NotFound): error when creating &amp;#34;env/test/&amp;#34;: namespaces &amp;#34;cnpg&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;env/test/&amp;#34;: namespaces &amp;#34;cnpg&amp;#34; not found
Error from server (NotFound): error when creating &amp;#34;env/test/&amp;#34;: namespaces &amp;#34;cnpg&amp;#34; not found&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;正式部署 PostgreSQL cluster&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/cnpg created
secret/cnpg-bigred created
cluster.postgresql.cnpg.io/psql created
pooler.postgresql.cnpg.io/pooler-rw created&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 PostgreSQL cluster pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cnpg get pods -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pooler-rw-8949649fd-9fw6z 1/1 Running 0 8m9s 10.244.4.204 kubeadm-w2 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
pooler-rw-8949649fd-h47mt 1/1 Running 0 8m9s 10.244.3.106 kubeadm-w1 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
pooler-rw-8949649fd-n862s 1/1 Running 0 8m9s 10.244.5.208 kubeadm-w3 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
psql-1 1/1 Running 0 7m2s 10.244.3.1 kubeadm-w1 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
psql-2 1/1 Running 0 6m5s 10.244.5.164 kubeadm-w3 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;
psql-3 1/1 Running 0 4m59s 10.244.4.229 kubeadm-w2 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 PostgreSQL cluster service&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cnpg get svc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
pooler-rw ClusterIP 10.96.28.116 &amp;lt;none&amp;gt; 5432/TCP 6m43s
psql-r ClusterIP 10.96.216.168 &amp;lt;none&amp;gt; 5432/TCP 6m44s
psql-ro ClusterIP 10.96.3.136 &amp;lt;none&amp;gt; 5432/TCP 6m44s
psql-rw ClusterIP 10.96.21.102 &amp;lt;none&amp;gt; 5432/TCP 6m44s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 安裝 cert-manager&lt;span class="hx:absolute hx:-mt-20" id="4-安裝-cert-manager"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%ae%89%e8%a3%9d-cert-manager" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/kubeadm/addon/cert-manager; cd ${HOME}/k8s/kubeadm/addon/cert-manager&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Kustomize 目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p {env/test,resource/base-v1.19.2}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視當前目錄結構&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tree -d .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;.
├── env
│   └── test
└── resource
└── base-v1.19.2
5 directories&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;下載 cert-manager yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget -P resource/base-v1.19.2 \
https://github.com/cert-manager/cert-manager/releases/download/v1.19.2/cert-manager.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 cert-manager 基本湯底的 kustomize yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; resource/kustomization.yaml
kind: Kustomization
resources:
- ./base-v1.19.2/cert-manager.yaml
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫測試區 cert-manager 的 kustomize yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/kustomization.yaml
kind: Kustomization
resources:
- ../../resource/
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試部署 cert-manager&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/ --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;正式部署 cert-manager&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 cert-mangaer pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cert-manager get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
cert-manager-548f7cf98c-v47q9 1/1 Running 1 (14h ago) 14h
cert-manager-cainjector-8798f647f-8f2xl 1/1 Running 1 (14h ago) 14h
cert-manager-webhook-6c8678dc46-hw5r4 1/1 Running 1 (14h ago) 14h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. 透過 Keycloak Operator 安裝 HA Keycloak&lt;span class="hx:absolute hx:-mt-20" id="5-透過-keycloak-operator-安裝-ha-keycloak"&gt;&lt;/span&gt;
&lt;a href="#5-%e9%80%8f%e9%81%8e-keycloak-operator-%e5%ae%89%e8%a3%9d-ha-keycloak" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ${HOME}/k8s/kubeadm/addon/keycloak&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak namespace yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/keycloak-ns.yaml
apiVersion: v1
kind: Namespace
metadata:
name: keycloak
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak 儲存初始化管理員的使用者帳密 secret yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/keycloak-bootstrapAdmin-user-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: keycloak-bootstrapadmin-user
namespace: keycloak
type: kubernetes.io/basic-auth
stringData:
username: admin
password: admin
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak 要串接 postgresql 的帳號密碼的 secret yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/cnpg-user-secret.yaml
apiVersion: v1
data:
password: YmlncmVk
username: YmlncmVk
kind: Secret
metadata:
name: cnpg-bigred
namespace: keycloak
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/keycloak.yaml
apiVersion: k8s.keycloak.org/v2alpha1
kind: Keycloak
metadata:
name: keycloak
namespace: keycloak
spec:
instances: 3
env:
- name: KC_PROXY
value: &amp;#39;edge&amp;#39;
bootstrapAdmin:
user:
secret: keycloak-bootstrapadmin-user
db:
vendor: postgres
host: pooler-rw.cnpg.svc.cluster.local
usernameSecret:
name: cnpg-bigred
key: username
passwordSecret:
name: cnpg-bigred
key: password
http:
httpEnabled: true
ingress:
enabled: false
hostname:
hostname: keycloak.kubeantony.com
proxy:
headers: xforwarded
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak 憑證 yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/keycloak-cert-manager-cert.yaml
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigned-issuer
namespace: cert-manager
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: root-ca
namespace: cert-manager
spec:
isCA: true
duration: 87600h # 10 years
renewBefore: 720h # 30d
commonName: root-ca
secretName: root-ca-secret
issuerRef:
name: selfsigned-issuer
kind: Issuer
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: keycloak-ca-clusterissuer
spec:
ca:
secretName: root-ca-secret
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak ingress yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/keycloak-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: keycloak
namespace: keycloak
annotations:
cert-manager.io/cluster-issuer: keycloak-ca-clusterissuer
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: &amp;#39;true&amp;#39;
nginx.ingress.kubernetes.io/proxy-body-size: &amp;#39;0&amp;#39;
nginx.ingress.kubernetes.io/affinity: &amp;#34;cookie&amp;#34;
nginx.ingress.kubernetes.io/session-cookie-name: &amp;#34;INGRESS_ROUTE&amp;#34;
nginx.ingress.kubernetes.io/session-cookie-hash: &amp;#34;sha1&amp;#34;
nginx.ingress.kubernetes.io/session-cookie-expires: &amp;#34;172800&amp;#34;
spec:
ingressClassName: nginx
tls:
- hosts:
- keycloak.kubeantony.com
secretName: keycloak-tls
rules:
- host: keycloak.kubeantony.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: keycloak-service
port:
number: 8080
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 keycloak kustomize yaml 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF &amp;gt; env/test/kustomization.yaml
kind: Kustomization
resources:
- ./keycloak-ns.yaml
- ./cnpg-user-secret.yaml
- ./keycloak-bootstrapAdmin-user-secret.yaml
- ./keycloak-cert-manager-cert.yaml
- ./keycloak.yaml
- ./keycloak-ingress.yaml
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試部署 keycloak&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/ --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/keycloak unchanged (server dry run)
secret/cnpg-bigred created (server dry run)
secret/keycloak-bootstrapadmin-user created (server dry run)
certificate.cert-manager.io/root-ca unchanged (server dry run)
clusterissuer.cert-manager.io/keycloak-ca-clusterissuer unchanged (server dry run)
issuer.cert-manager.io/selfsigned-issuer unchanged (server dry run)
keycloak.k8s.keycloak.org/keycloak created (server dry run)
ingress.networking.k8s.io/keycloak created (server dry run)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;正式部署 keycloak&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -k env/test/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;namespace/keycloak unchanged
secret/cnpg-bigred created
secret/keycloak-bootstrapadmin-user created
certificate.cert-manager.io/root-ca created
clusterissuer.cert-manager.io/keycloak-ca-clusterissuer created
issuer.cert-manager.io/selfsigned-issuer created
keycloak.k8s.keycloak.org/keycloak created
ingress.networking.k8s.io/keycloak created&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 keycloak 部署完成&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n keycloak rollout status statefulset keycloak&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Waiting for 3 pods to be ready...
Waiting for 2 pods to be ready...
Waiting for 2 pods to be ready...
Waiting for 1 pods to be ready...
Waiting for 1 pods to be ready...
partitioned roll out complete: 3 new pods have been updated...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 keycloak pods 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n keycloak get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
keycloak-0 1/1 Running 0 2m38s
keycloak-1 1/1 Running 0 117s
keycloak-2 1/1 Running 0 81s
keycloak-operator-59c9ff54-h9wvv 1/1 Running 0 3h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 keycloak ingress&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n keycloak get ing&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME CLASS HOSTS ADDRESS PORTS AGE
keycloak nginx keycloak.kubeantony.com 10.200.8.24,10.200.8.25,10.200.8.26 80, 443 4d3h&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;打開瀏覽器，連線至 keycloak 管理網站，URL 是 ingress 的 &lt;code&gt;HOSTS&lt;/code&gt; 的值，我的文章是 &lt;code&gt;keycloak.kubeantony.com&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkIeqHCNWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;登入 keycloak 管理網站，執行以下命令獲取帳號密碼&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n keycloak get secrets keycloak-bootstrapadmin-user -o go-template=&amp;#39;User: {{.data.username | base64decode}}{{&amp;#34;\n&amp;#34;}}Pass: {{.data.password | base64decode}}{{&amp;#34;\n&amp;#34;}}&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;User: admin
Pass: admin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Skz33BC4bl.png" alt="image" loading="lazy" /&gt;
按 &lt;code&gt;Sign In&lt;/code&gt; 按鈕後，登入畫面如下：
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BksJprAV-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;6. 初始化 Keycloak 設定&lt;span class="hx:absolute hx:-mt-20" id="6-初始化-keycloak-設定"&gt;&lt;/span&gt;
&lt;a href="#6-%e5%88%9d%e5%a7%8b%e5%8c%96-keycloak-%e8%a8%ad%e5%ae%9a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立永久的 admin 帳號
左側選單 Users -&amp;gt; Add User
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Sk8qkLA4Wl.png" alt="image" loading="lazy" /&gt;
在 Username 欄位輸入：&lt;code&gt;administrator&lt;/code&gt;，然後點選 &lt;code&gt;Create&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1iIeU0Nbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;幫 admin 帳號設定永久有效的密碼
點選 &lt;code&gt;Credentials&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Set password&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkXieU0Ebl.png" alt="image" loading="lazy" /&gt;
在 Password 欄位輸入：&lt;code&gt;password&lt;/code&gt;
在 Password confimation 欄位再次輸入：&lt;code&gt;password&lt;/code&gt;
點選 &lt;code&gt;Save&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJrwbU0VZx.png" alt="image" loading="lazy" /&gt;
點選 &lt;code&gt;Save password&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hy-aW8AEZe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 admin 權限給 &lt;code&gt;administrator&lt;/code&gt; 使用者
點選 &lt;code&gt;Role mapping&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Assign role&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Realm roles&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Bka8zUCEZe.png" alt="image" loading="lazy" /&gt;
將所有權限都打勾，然後點選左下角 &lt;code&gt;Assign&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HykcELC4Wl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h1&gt;&lt;font color=blue&gt;設定 Keycloak 作為 Kubernetes API Server 的認證服務&lt;/font&gt;&lt;/h1&gt;&lt;h2&gt;1. Keycloak 先備知識&lt;span class="hx:absolute hx:-mt-20" id="1-keycloak-先備知識"&gt;&lt;/span&gt;
&lt;a href="#1-keycloak-%e5%85%88%e5%82%99%e7%9f%a5%e8%ad%98" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在 Keycloak 中有以下幾個主要概念：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;領域（realms）：領域管理一批使用者、憑證、角色、群組等等，不同領域之間的資源是相互隔離的，實現了多租戶的效果。&lt;/li&gt;
&lt;li&gt;客戶端（clients）：需接取 Keycloak 實現使用者認證的應用程式和服務，以下實作範例的 kube-apiserver 就會是 client。&lt;/li&gt;
&lt;li&gt;使用者（users）：使用者是能夠登入應用程式系統的實體，擁有相關的屬性，例如電子郵件、使用者名稱、地址、電話號碼和生日等等。&lt;/li&gt;
&lt;li&gt;群組（groups）：一組使用者的集合，你可以將一系列的角色賦予定義好的使用者群組，一旦某使用者屬於該使用者群組，那麼該使用者將獲得對應群組的所有角色權限。&lt;/li&gt;
&lt;li&gt;證書（credential）：Keycloak 用於驗證使用者的憑證，例如密碼、一次性密碼、證書、指紋等等。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 建立 Keycloak Realm&lt;span class="hx:absolute hx:-mt-20" id="2-建立-keycloak-realm"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%bb%ba%e7%ab%8b-keycloak-realm" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Manage realms&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create realm&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1bSis1SZl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;Realm name 欄位輸入：&lt;code&gt;kubernetes-project&lt;/code&gt;
點選左下角 &lt;code&gt;Create&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1V6jsJSWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 建立 keycloak User&lt;span class="hx:absolute hx:-mt-20" id="3-建立-keycloak-user"&gt;&lt;/span&gt;
&lt;a href="#3-%e5%bb%ba%e7%ab%8b-keycloak-user" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Users&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create new user&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkolV2JrWe.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;Username 欄位輸入：&lt;code&gt;bigred&lt;/code&gt;
Email 欄位輸入：&lt;code&gt;bigred@example.com&lt;/code&gt;
First name 欄位輸入：&lt;code&gt;bigred&lt;/code&gt;
Last name 欄位輸入：&lt;code&gt;bigred&lt;/code&gt;
點選下方 &lt;code&gt;Create&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1f6RxgBWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Credentials&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Set password&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1TML3Jrbx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;Password 欄位輸入: &lt;code&gt;bigred&lt;/code&gt;
Password confirmation: &lt;code&gt;bigred&lt;/code&gt;
Temporary 調整成 &lt;code&gt;Off&lt;/code&gt;
點選 Save 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BySc8nyS-e.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Save password&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkUWwhJHbe.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Users&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create new user&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Username 欄位輸入：&lt;code&gt;rbean&lt;/code&gt;
Email 欄位輸入：&lt;code&gt;rbean@example.com&lt;/code&gt;
First name 欄位輸入：&lt;code&gt;rbean&lt;/code&gt;
Last name 欄位輸入：&lt;code&gt;rbean&lt;/code&gt;
點選下方 &lt;code&gt;Create&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Credentials&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Set password&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;li&gt;Password 欄位輸入: &lt;code&gt;rbean&lt;/code&gt;
Password confirmation: &lt;code&gt;rbean&lt;/code&gt;
Temporary 調整成 &lt;code&gt;Off&lt;/code&gt;
點選 Save 按鈕&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Save password&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 建立 keycloak Group&lt;span class="hx:absolute hx:-mt-20" id="4-建立-keycloak-group"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%bb%ba%e7%ab%8b-keycloak-group" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Groups&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create group&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyFAvnyr-l.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;Name 欄位輸入：&lt;code&gt;admin&lt;/code&gt;
Description 欄位輸入：&lt;code&gt;Kubernetes cluster admin&lt;/code&gt;
點選 &lt;code&gt;Create&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJTcO2kHWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;admin&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkhqK2kSbx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Members&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Add member&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJV0KnyBWx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;勾選 &lt;code&gt;bigred&lt;/code&gt; user -&amp;gt; 點選下方 &lt;code&gt;Add&lt;/code&gt; 按扭
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ0Qq21Hbl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Groups&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create group&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;li&gt;Name 欄位輸入：&lt;code&gt;developers&lt;/code&gt;
Description 欄位輸入：&lt;code&gt;Kubernetes namespace admin&lt;/code&gt;
點選 &lt;code&gt;Create&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;developers&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Members&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Add member&lt;/code&gt; 按鈕&lt;/li&gt;
&lt;li&gt;勾選 &lt;code&gt;rbean&lt;/code&gt; user -&amp;gt; 點選下方 &lt;code&gt;Add&lt;/code&gt; 按扭&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. 建立 Keycloak Client&lt;span class="hx:absolute hx:-mt-20" id="5-建立-keycloak-client"&gt;&lt;/span&gt;
&lt;a href="#5-%e5%bb%ba%e7%ab%8b-keycloak-client" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;在 &lt;code&gt;kubernetes-project&lt;/code&gt; Realm 建立 Keycloak Client
點選左側選單 &lt;code&gt;Clients&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Create client&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJYYhskHbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Client ID 欄位輸入：&lt;code&gt;kube-apiserver&lt;/code&gt;
Name 欄位輸入：&lt;code&gt;kube-apiserver&lt;/code&gt;
點選 &lt;code&gt;Next&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ-M6sJSZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;勾選 &lt;code&gt;Client authentication&lt;/code&gt;
點選 &lt;code&gt;Next&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJidCs1S-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Valid redirect URIs 欄位輸入：&lt;code&gt;urn:ietf:wg:oauth:2.0:oob&lt;/code&gt;
點選 &lt;code&gt;Save&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJgJy3kBWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;什麼是 &lt;a
href="https://www.keycloak.org/docs/25.0.6/securing_apps/index.html#:~:text=be%20used%20instead.-,urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob,-If%20you%20cannot"target="_blank" rel="noopener"&gt;urn:ietf:wg:oauth:2.0:oob&lt;/a&gt; ?
當使用此重新導向 URI 時，Keycloak 會顯示一個頁面，授權碼 (code) 會同時出現在網頁標題 (title) 以及頁面上的文字方塊中。應用程式可以偵測瀏覽器標題的變更，或者由使用者手動複製該代碼並貼上至應用程式中。透過此重新導向 URI，使用者還可以使用不同的裝置來取得代碼，再將其貼回原本的應用程式。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;6. 添加 Group Membership 類型的 mapper&lt;span class="hx:absolute hx:-mt-20" id="6-添加-group-membership-類型的-mapper"&gt;&lt;/span&gt;
&lt;a href="#6-%e6%b7%bb%e5%8a%a0-group-membership-%e9%a1%9e%e5%9e%8b%e7%9a%84-mapper" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;在 Keycloak 的 Client 設定中，Mapper 的核心功能可以簡單概括為：「決定 Token 裡面要包含什麼資料，以及這些資料要叫什麼名字」。&lt;/p&gt;
&lt;p&gt;當使用者登入成功後，Keycloak 會發發 Token（如 ID Token 或 Access Token）給應用程式 (Client)。預設情況下，Token 裡只會有基本資料（如 username, email, sub）。&lt;/p&gt;
&lt;p&gt;Group Membership Mapper: &lt;strong&gt;把使用者所屬的 群組 (Groups) 放進 Token。在 Kubernetes OIDC 整合，這個非常重要，因為 K8s 通常是靠這個欄位來綁定 RBAC 權限的。&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;點選 &lt;code&gt;Client scopes&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;kube-apiserver-dedicated&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SyIpenyHWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Configure a new mapper&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJTeb21Bbl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Group Membership&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rkISBo1BWx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;Name 欄位輸入：&lt;code&gt;kube-groups&lt;/code&gt;
Token Claim Name 欄位輸入：&lt;code&gt;kube-groups&lt;/code&gt;
Full group path 設定為 &lt;code&gt;Off&lt;/code&gt;
Add to ID token 保持為 &lt;code&gt;On&lt;/code&gt;
Add to access token 設定為 &lt;code&gt;Off&lt;/code&gt;
Add to lightweight access token 保持為 &lt;code&gt;Off&lt;/code&gt;
Add to userinfo 設定為 &lt;code&gt;Off&lt;/code&gt;
Add to token introspection 設定為 &lt;code&gt;Off&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Bk9UzhyHbg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;7. 延長 Token 時間 (可跳過)&lt;span class="hx:absolute hx:-mt-20" id="7-延長-token-時間-可跳過"&gt;&lt;/span&gt;
&lt;a href="#7-%e5%bb%b6%e9%95%b7-token-%e6%99%82%e9%96%93-%e5%8f%af%e8%b7%b3%e9%81%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Keycloak 中設定的 &lt;code&gt;access_token&lt;/code&gt; 和 &lt;code&gt;id_token&lt;/code&gt; 的有效期限預設是 &lt;code&gt;5&lt;/code&gt; 分鐘，為了方便後續的實作，這裡將令牌的有效期延長至 &lt;code&gt;30&lt;/code&gt; 分鐘。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Realm settings&lt;/code&gt; 按鈕 -&amp;gt; 點選右側選單 &lt;code&gt;Access tokens&lt;/code&gt; 按鈕
Access Token Lifespan 預設為 &lt;code&gt;5&lt;/code&gt; 分鐘
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ0CjnkSWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;將 Access Token Lifespan 調整成 &lt;code&gt;30&lt;/code&gt; 分鐘
點選下方 &lt;code&gt;Save&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rycFnhJHbl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;8. 查看 Keycloak Realm Endpoint 資訊&lt;span class="hx:absolute hx:-mt-20" id="8-查看-keycloak-realm-endpoint-資訊"&gt;&lt;/span&gt;
&lt;a href="#8-%e6%9f%a5%e7%9c%8b-keycloak-realm-endpoint-%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Realm settings&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;General&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;Endpoints&lt;/code&gt; 欄位的 &lt;code&gt;OpenID Endpoint Configuration&lt;/code&gt; 超連結按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1snp2JHWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;勾選美化排版，記住 &lt;code&gt;issuer&lt;/code&gt; 欄位的 url，稍後會用到
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1I1k6yHWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;9. 永久設定 Kube-apiserver 參數 (K8s 版本升級時設定不會被原始值覆蓋)&lt;span class="hx:absolute hx:-mt-20" id="9-永久設定-kube-apiserver-參數-k8s-版本升級時設定不會被原始值覆蓋"&gt;&lt;/span&gt;
&lt;a href="#9-%e6%b0%b8%e4%b9%85%e8%a8%ad%e5%ae%9a-kube-apiserver-%e5%8f%83%e6%95%b8-k8s-%e7%89%88%e6%9c%ac%e5%8d%87%e7%b4%9a%e6%99%82%e8%a8%ad%e5%ae%9a%e4%b8%8d%e6%9c%83%e8%a2%ab%e5%8e%9f%e5%a7%8b%e5%80%bc%e8%a6%86%e8%93%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ${HOME}/k8s/kubeadm/config/; cd ${HOME}/k8s/kubeadm/config/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;匯出當前 K8s 叢集的設定檔 &lt;code&gt;kubeadm-config&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get cm kubeadm-config -o yaml &amp;gt; kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;備份 K8s 叢集的設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cp kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml.bk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 K8s 叢集的設定檔，將 &lt;code&gt;kube-apiserver&lt;/code&gt; 啟用 OpenID Connect 認證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;需修改的檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;data:
ClusterConfiguration: |
apiServer:
extraArgs:
- name: oidc-issuer-url
value: &amp;#34;https://keycloak.kubeantony.com/realms/kubernetes-project&amp;#34;
- name: oidc-client-id
value: &amp;#34;kube-apiserver&amp;#34;
- name: oidc-username-claim
value: &amp;#34;preferred_username&amp;#34;
- name: oidc-groups-claim
value: &amp;#34;kube-groups&amp;#34;
- name: oidc-ca-file
value: &amp;#34;/etc/kubernetes/pki/keycloak-ca.crt&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;需要在 API Server 的啟動參數中新增下列設定：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--oidc-issuer-url&lt;/code&gt;：OpenID 發行者的 URL，僅接受 HTTPS 協定。若有設定，將用於驗證 OIDC JSON Web Token (JWT)。
&lt;ul&gt;
&lt;li&gt;在步驟 8 查看 Keycloak Realm Endpoint 資訊有得到這個值&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--oidc-client-id&lt;/code&gt;：OpenID Connect 客戶端的 Client ID。若已設定 &lt;code&gt;oidc-issuer-url&lt;/code&gt;，則必須設定此項。
&lt;ul&gt;
&lt;li&gt;在步驟 5 建立 Keycloak Client 中有設定 client id 的值&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--oidc-username-claim&lt;/code&gt;：用來作為使用者名稱的 OpenID claim。請注意，除了預設值 (&lt;code&gt;sub&lt;/code&gt;) 以外的宣告，無法保證其唯一性與不可變更性。
&lt;ul&gt;
&lt;li&gt;請依照以下步驟查看
&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Client scopes&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;profile&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1GM_6Jrbg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Mappers&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;username&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1Xi_pJH-x.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;確認 &lt;code&gt;Token Claim Name&lt;/code&gt; 欄位的值，本篇文章為 &lt;code&gt;preferred_username&lt;/code&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1dkKpyBbe.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--oidc-groups-claim&lt;/code&gt;: 若有提供，此為用來指定使用者群組的自訂 OpenID Connect claim 名稱。該宣告的值預期為字串或字串陣列。
&lt;ul&gt;
&lt;li&gt;在步驟 6 添加 Group Membership 類型的 mapper 中有設定 Token Claim Name&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--oidc-ca-file&lt;/code&gt;：若有設定，OpenID 伺服器的憑證將由 &lt;code&gt;oidc-ca-file&lt;/code&gt; 中的憑證授權單位 (CA) 進行驗證；否則，將使用主機本身的根憑證庫 (Root CA set)。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲取由 cert-manager 幫 keycloak 簽發的 Root CA 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n cert-manager get secret root-ca-secret \
-o jsonpath=&amp;#39;{.data.ca\.crt}&amp;#39; | base64 -d \
&amp;gt; ${HOME}/k8s/kubeadm/addon/keycloak/env/test/ca.pem&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 keycloak Root CA 憑證配發至 K8s 叢集中的&lt;strong&gt;每一台&lt;/strong&gt; Control-plane node&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;scp ${HOME}/k8s/kubeadm/addon/keycloak/env/test/ca.pem &amp;lt;user&amp;gt;@&amp;lt;control-plane node 1 ip&amp;gt;:./ca.pem
scp ${HOME}/k8s/kubeadm/addon/keycloak/env/test/ca.pem &amp;lt;user&amp;gt;@&amp;lt;control-plane node 2 ip&amp;gt;:./ca.pem
scp ${HOME}/k8s/kubeadm/addon/keycloak/env/test/ca.pem &amp;lt;user&amp;gt;@&amp;lt;control-plane node 3 ip&amp;gt;:./ca.pem&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在&lt;strong&gt;每一台&lt;/strong&gt; Control-plane node 將 keycloak Root CA 憑證拷貝到先前 K8s 叢集設定檔中指定的目錄區&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 1 ip&amp;gt;
sudo cp ${HOME}/ca.pem /etc/kubernetes/pki/keycloak-ca.crt
ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 2 ip&amp;gt;
sudo cp ${HOME}/ca.pem /etc/kubernetes/pki/keycloak-ca.crt
ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 3 ip&amp;gt;
sudo cp ${HOME}/ca.pem /etc/kubernetes/pki/keycloak-ca.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;回到 K8s 管理主機，模擬套用 Kubernetes 叢集設定檔，檢查設定檔語法是否正確以及是否能被叢集接受&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml --dry-run=server&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Warning: resource configmaps/kubeadm-config is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
configmap/kubeadm-config configured (server dry run)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認沒問題後，正式套用 Kubernetes 叢集設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f kubeadm-config-$(date &amp;#39;&amp;#43;%Y-%m-%d&amp;#39;).yaml &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Warning: resource configmaps/kubeadm-config is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
configmap/kubeadm-config configured&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將叢集現有的 K8s 叢集設定檔提取出來，並儲存為本機檔案 &lt;code&gt;config.yaml&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get cm kubeadm-config \
-o jsonpath={.data.ClusterConfiguration} &amp;gt; /tmp/config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 &lt;code&gt;config.yaml&lt;/code&gt; 派送至&lt;strong&gt;每一台&lt;/strong&gt; Control-plane node 的 &lt;code&gt;/tmp&lt;/code&gt; 目錄區底下&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;scp /tmp/config.yaml &amp;lt;user&amp;gt;@&amp;lt;control-plane node 1 ip&amp;gt;:/tmp/
scp /tmp/config.yaml &amp;lt;user&amp;gt;@&amp;lt;control-plane node 2 ip&amp;gt;:/tmp/
scp /tmp/config.yaml &amp;lt;user&amp;gt;@&amp;lt;control-plane node 3 ip&amp;gt;:/tmp/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在&lt;strong&gt;每一台&lt;/strong&gt; Control-plane node 修改 API Server 的啟動參數&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 1 ip&amp;gt;
sudo kubeadm init phase control-plane apiserver --config /tmp/config.yaml
ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 2 ip&amp;gt;
sudo kubeadm init phase control-plane apiserver --config /tmp/config.yaml
ssh &amp;lt;user&amp;gt;@&amp;lt;control-plane node 3 ip&amp;gt;
sudo kubeadm init phase control-plane apiserver --config /tmp/config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;會在每一台 Control-plane 看到以下執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[control-plane] Creating static Pod manifest for &amp;#34;kube-apiserver&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;回到 K8s 管理主機，確認 kube-apiserver pods 是否有重啟，並且狀態正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n kube-system get pods -l &amp;#34;component=kube-apiserver&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
kube-apiserver-kubeadm-c1 1/1 Running 0 104s
kube-apiserver-kubeadm-c2 1/1 Running 0 58s
kube-apiserver-kubeadm-c3 1/1 Running 0 50s&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;10. 設定 K8s RBAC&lt;span class="hx:absolute hx:-mt-20" id="10-設定-k8s-rbac"&gt;&lt;/span&gt;
&lt;a href="#10-%e8%a8%ad%e5%ae%9a-k8s-rbac" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 &lt;code&gt;developers&lt;/code&gt; 群組專用的 K8s namespace&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create ns project-1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 &lt;code&gt;developers&lt;/code&gt; 群組為特定 namespace 的 admin&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create rolebinding developers-group-ns-admin \
--clusterrole=admin \
--group=developers \
--namespace=project-1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 &lt;code&gt;admin&lt;/code&gt; 群組為 K8s 叢集管理員&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create clusterrolebinding admin-group-cluster-admin \
--clusterrole=cluster-admin \
--group=admin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;11. 使用 &lt;code&gt;Kubelogin&lt;/code&gt; 進行身份驗證 - 搭配瀏覽器模式&lt;span class="hx:absolute hx:-mt-20" id="11-使用-kubelogin-進行身份驗證---搭配瀏覽器模式"&gt;&lt;/span&gt;
&lt;a href="#11-%e4%bd%bf%e7%94%a8-kubelogin-%e9%80%b2%e8%a1%8c%e8%ba%ab%e4%bb%bd%e9%a9%97%e8%ad%89---%e6%90%ad%e9%85%8d%e7%80%8f%e8%a6%bd%e5%99%a8%e6%a8%a1%e5%bc%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;當執行 &lt;code&gt;kubectl&lt;/code&gt; 指令時，&lt;code&gt;kubelogin&lt;/code&gt; 會給一個超連結，當使用瀏覽器連線到該連結的網站，使用者需要輸入使用者名稱和密碼登入程序，認證通過後，kubelogin 會從認證伺服器取得一個 token，然後 &lt;code&gt;kubectl&lt;/code&gt; 就可以使用該 token 和 K8s API Server 進行溝通，具體的流程圖如下：&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJj6DyCEWe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;安裝 &lt;code&gt;krew&lt;/code&gt; kubectl plugin&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;(
set -x; cd &amp;#34;$(mktemp -d)&amp;#34; &amp;amp;&amp;amp;
OS=&amp;#34;$(uname | tr &amp;#39;[:upper:]&amp;#39; &amp;#39;[:lower:]&amp;#39;)&amp;#34; &amp;amp;&amp;amp;
ARCH=&amp;#34;$(uname -m | sed -e &amp;#39;s/x86_64/amd64/&amp;#39; -e &amp;#39;s/\(arm\)\(64\)\?.*/\1\2/&amp;#39; -e &amp;#39;s/aarch64$/arm64/&amp;#39;)&amp;#34; &amp;amp;&amp;amp;
KREW=&amp;#34;krew-${OS}_${ARCH}&amp;#34; &amp;amp;&amp;amp;
curl -fsSLO &amp;#34;https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz&amp;#34; &amp;amp;&amp;amp;
tar zxvf &amp;#34;${KREW}.tar.gz&amp;#34; &amp;amp;&amp;amp;
./&amp;#34;${KREW}&amp;#34; install krew
)
echo &amp;#39;export PATH=&amp;#34;${KREW_ROOT:-$HOME/.krew}/bin:$PATH&amp;#34;&amp;#39; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 &lt;code&gt;kubelogin&lt;/code&gt; kubectl plugin&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl krew install oidc-login&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Updated the local copy of plugin index.
Installing plugin: oidc-login
Installed plugin: oidc-login
\
| Use this plugin:
| kubectl oidc-login
| Documentation:
| https://github.com/int128/kubelogin
| Caveats:
| \
| | You need to setup the OIDC provider, Kubernetes API server, role binding and kubeconfig.
| /
/
WARNING: You installed plugin &amp;#34;oidc-login&amp;#34; from the krew-index plugin repository.
These plugins are not audited for security by the Krew maintainers.
Run them at your own risk.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 kubectl 使用 oidc-test 帳號時，透過 OIDC 協議與 Keycloak 進行互動式認證以取得存取 Kubernetes 的 Token。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl config set-credentials oidc-web \
--exec-api-version=client.authentication.k8s.io/v1 \
--exec-interactive-mode=IfAvailable \
--exec-command=kubectl \
--exec-arg=oidc-login \
--exec-arg=get-token \
--exec-arg=&amp;#34;--oidc-issuer-url=https://keycloak.kubeantony.com/realms/kubernetes-project&amp;#34; \
--exec-arg=&amp;#34;--oidc-client-id=kube-apiserver&amp;#34; \
--exec-arg=&amp;#34;--oidc-client-secret=EM06cnVYdLFjRa46DDgoBRl4NL7zhMxJ&amp;#34; \
--exec-arg=&amp;#34;--oidc-redirect-url=urn:ietf:wg:oauth:2.0:oob&amp;#34; \
--exec-arg=&amp;#34;--certificate-authority=/etc/kubernetes/pki/keycloak-ca.crt&amp;#34; \
--exec-arg=&amp;#34;--grant-type=authcode-keyboard&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kubectl config set-credentials oidc-web&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;在 kubeconfig 檔案中建立或更新名為 &lt;code&gt;oidc-web&lt;/code&gt; 的使用者條目。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--exec-api-version&lt;/code&gt; &amp;amp; &lt;code&gt;--exec-command&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;指定使用 Kubernetes 的 &lt;code&gt;client.authentication.k8s.io/v1&lt;/code&gt; API，並呼叫 &lt;code&gt;kubectl&lt;/code&gt; 作為執行檔（實際是透過它來呼叫插件）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--exec-arg=oidc-login&lt;/code&gt;, &lt;code&gt;get-token&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;指定實際執行的插件指令為 &lt;code&gt;oidc-login&lt;/code&gt; (即 kubelogin)，動作為獲取 Token。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--exec-arg=&amp;quot;--oidc-issuer-url/client-id/secret&amp;quot;&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;提供連線到 OIDC Provider (此處為 Keycloak) 所需的端點、客戶端 ID 與 secret。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--exec-arg=&amp;quot;--grant-type=authcode-keyboard&amp;quot;&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;指定認證流程為「鍵盤輸入授權碼」。使用者在瀏覽器登入後，必須&lt;strong&gt;手動複製授權碼 (Auth Code)&lt;/strong&gt; 並貼回終端機，而非透過本機 Port 自動回傳。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--exec-arg=&amp;quot;--oidc-redirect-url=urn:ietf:wg:oauth:2.0:oob&amp;quot;&lt;/code&gt;：
&lt;ul&gt;
&lt;li&gt;配合上述模式，告訴 Keycloak 驗證完成後顯示 Out-of-Band (OOB) 頁面（通常是顯示一段代碼），而非跳轉到特定的 URL。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;請執行以下步驟得到 &lt;code&gt;oidc-client-secret&lt;/code&gt; 的值
&lt;ol&gt;
&lt;li&gt;點選左側選單 &lt;code&gt;Clients&lt;/code&gt; 按鈕 -&amp;gt; &lt;code&gt;kube-apiserver&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/Hkld6CyHWg.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Credentials&lt;/code&gt; 按鈕 -&amp;gt; Client Secret 欄位右側的複製按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SJvTpAyr-x.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;User &amp;#34;oidc-web&amp;#34; set.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證存取 K8s&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-web auth whoami&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Please visit the following URL in your browser: https://keycloak.kubeantony.com/realms/kubernetes-project/protocol/openid-connect/auth?access_type=offline&amp;amp;client_id=kube-apiserver&amp;amp;code_challenge=P4RQKK8ISp0lNuDjEdFh21JzyP-mXZvmw9NxPhgie8Y&amp;amp;code_challenge_method=S256&amp;amp;nonce=YXM_s1sD3u6mmsLQpe_Zg1Nsem-0OhBodCbORiJO5T4&amp;amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;amp;response_type=code&amp;amp;scope=openid&amp;amp;state=UYOI-OojjJRVk1rWr4m_BxVnHuu46ratNYmf2FZMWAA
Enter code:&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;記得先在 keycloak 登出 &lt;code&gt;administrator&lt;/code&gt; 帳號
連線到命令給的驗證連結，並輸入以下內容：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Username or email: &lt;code&gt;bigred&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Password: &lt;code&gt;bigred&lt;/code&gt;
點選 &lt;code&gt;Sign In&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ry_ffJeS-l.png" alt="image" loading="lazy" /&gt;
就會得到驗證碼，點擊右側的複製按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ511ger-l.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將驗證碼貼到終端機上&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Enter code: 229cea71-4d33-8bc1-4662-704dff97a9ac.172198d7-1020-1881-90f3-e75d092fb006.31751bd5-670a-4446-a183-6ea3386ea8e2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ATTRIBUTE VALUE
Username https://keycloak.kubeantony.com/realms/kubernetes-project#bigred
Groups [admin system:authenticated]
Extra: authentication.kubernetes.io/credential-id [JTI=89287e03-0da6-d421-ea72-7adfd388e894]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 &lt;code&gt;bigred&lt;/code&gt; 使用者是否具備整個 Kubernetes 叢集的完整超級管理員（cluster-admin）權限&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-web auth can-i &amp;#39;*&amp;#39; &amp;#39;*&amp;#39; -A&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;yes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;12. 使用 &lt;code&gt;Kubelogin&lt;/code&gt; 進行身份驗證 - 純命令模式&lt;span class="hx:absolute hx:-mt-20" id="12-使用-kubelogin-進行身份驗證---純命令模式"&gt;&lt;/span&gt;
&lt;a href="#12-%e4%bd%bf%e7%94%a8-kubelogin-%e9%80%b2%e8%a1%8c%e8%ba%ab%e4%bb%bd%e9%a9%97%e8%ad%89---%e7%b4%94%e5%91%bd%e4%bb%a4%e6%a8%a1%e5%bc%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;設定 keycloak client 允許 Direct access grants
點選左側選單 Clients 按鈕 -&amp;gt; kube-apiserver
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1-aNlxBWg.png" alt="image" loading="lazy" /&gt;
點選右側選單 &lt;code&gt;Capability config&lt;/code&gt; 按鈕 -&amp;gt; 勾選 &lt;code&gt;Direct access grants&lt;/code&gt;
點選下方 &lt;code&gt;Save&lt;/code&gt; 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkVXregS-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;刪除 token cache&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl oidc-login clean&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試使用命令模式登入&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl config set-credentials oidc-cli \
--exec-api-version=client.authentication.k8s.io/v1 \
--exec-interactive-mode=IfAvailable \
--exec-command=kubectl \
--exec-arg=oidc-login \
--exec-arg=get-token \
--exec-arg=&amp;#34;--oidc-issuer-url=https://keycloak.kubeantony.com/realms/kubernetes-project&amp;#34; \
--exec-arg=&amp;#34;--oidc-client-id=kube-apiserver&amp;#34; \
--exec-arg=&amp;#34;--oidc-client-secret=EM06cnVYdLFjRa46DDgoBRl4NL7zhMxJ&amp;#34; \
--exec-arg=&amp;#34;--certificate-authority=/etc/kubernetes/pki/keycloak-ca.crt&amp;#34; \
--exec-arg=&amp;#34;--grant-type=password&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;--exec-arg=&amp;quot;--grant-type=password&amp;quot;&lt;/code&gt;： 指定認證流程為 ROPC 模式。 &lt;code&gt;kubectl&lt;/code&gt; 在執行時，直接在終端機提示使用者輸入 Username 和 Password，並直接將這些憑據發送給 Keycloak 進行驗證&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;User &amp;#34;oidc-cli&amp;#34; set.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證存取 K8s&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-cli auth whoami&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Username: rbean
Password: rbean
ATTRIBUTE VALUE
Username https://keycloak.kubeantony.com/realms/kubernetes-project#rbean
Groups [developers system:authenticated]
Extra: authentication.kubernetes.io/credential-id [JTI=43a41723-b6d7-95fe-543a-d8bf5069e6cb]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 &lt;code&gt;rbean&lt;/code&gt; 使用者是否能在其他 K8s namespace 建立 deployment&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-cli auth can-i create deployment -n default&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;no&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 &lt;code&gt;rbean&lt;/code&gt; 使用者是否能在 &lt;code&gt;project-1&lt;/code&gt; namespace 建立 deployment&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-cli auth can-i create deployment -n project-1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;yes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 &lt;code&gt;rbean&lt;/code&gt; 使用者在其他 K8s namespace 擁有的權限&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-cli auth can-i --list -n default&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Resources Non-Resource URLs Resource Names Verbs
selfsubjectreviews.authentication.k8s.io [] [] [create]
selfsubjectaccessreviews.authorization.k8s.io [] [] [create]
selfsubjectrulesreviews.authorization.k8s.io [] [] [create]
[/api/*] [] [get]
[/api] [] [get]
[/apis/*] [] [get]
[/apis] [] [get]
[/healthz] [] [get]
[/healthz] [] [get]
[/livez] [] [get]
[/livez] [] [get]
[/openapi/*] [] [get]
[/openapi] [] [get]
[/readyz] [] [get]
[/readyz] [] [get]
[/version/] [] [get]
[/version/] [] [get]
[/version] [] [get]
[/version] [] [get]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 &lt;code&gt;rbean&lt;/code&gt; 使用者是否能獲得 K8s 叢集節點資訊&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --user=oidc-cli auth can-i get nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Warning: resource &amp;#39;nodes&amp;#39; is not namespace scoped
no&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 oidc-cli user 的 kubeconfig 獨立出來&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl config set-context oidc-context \
--cluster=topgun \
--user=oidc-cli \
--namespace=project-1
kubectl config view \
--context=oidc-context \
--minify \
--flatten \
&amp;gt; oidc-cli.kubeconfig&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 oidc-cli user 的 kubeconfig&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl --kubeconfig oidc-cli.kubeconfig config view&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA&amp;#43;OMITTED
server: https://192.168.11.176:6443
name: topgun
contexts:
- context:
cluster: topgun
namespace: project-1
user: oidc-cli
name: oidc-context
current-context: oidc-context
kind: Config
users:
- name: oidc-cli
user:
exec:
apiVersion: client.authentication.k8s.io/v1
args:
- oidc-login
- get-token
- --oidc-issuer-url=https://keycloak.kubeantony.com/realms/kubernetes-project
- --oidc-client-id=kube-apiserver
- --oidc-client-secret=EM06cnVYdLFjRa46DDgoBRl4NL7zhMxJ
- --certificate-authority=/etc/kubernetes/pki/keycloak-ca.crt
- --grant-type=password
command: kubectl
env: null
interactiveMode: IfAvailable
provideClusterInfo: false&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;可以看到沒有 user 的 client-certificate-data 跟 client-key-data，變成動態的到 keycloak 去取得 token&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;參考文章&lt;/h1&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://www.voltagepark.com/blog/how-to-use-oidc-for-secure-streamlined-kubernetes-access"target="_blank" rel="noopener"&gt;How to Implement OIDC Auth in Kubernetes for Secure Cluster Access&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://cloud.tencent.com/developer/article/1983889"target="_blank" rel="noopener"&gt;在Kubernetes 中使用Keycloak OIDC Provider 對使用者進行身份驗證&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://geek-cookbook.funkypenguin.co.nz/kubernetes/oidc-authentication/keycloak/"target="_blank" rel="noopener"&gt;Authenticate to Kubernetes with Keycloak OIDC on K3s&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://github.com/int128/kubelogin/tree/master"target="_blank" rel="noopener"&gt;kubelogin - github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://krew.sigs.k8s.io/docs/user-guide/setup/install/"target="_blank" rel="noopener"&gt;Krew Installing - Krew Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>How to Create a User Using Htpasswd in Openshift</title><link>https://blog.kubeantony.com/archive/openshift/how-to-create-a-user-using-htpasswd-in-openshift/</link><pubDate>Wed, 31 Dec 2025 05:26:48 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/how-to-create-a-user-using-htpasswd-in-openshift/</guid><description>
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;安裝 htpasswd 套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;yum install -y httpd-tools&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 htpasswd 使用者檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;htpasswd -c -B -b users.htpasswd mgr-haha haha&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;格式如下：
&lt;code&gt;htpasswd -c -B -b &amp;lt;/path/to/users.htpasswd&amp;gt; &amp;lt;username&amp;gt; &amp;lt;password&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;密碼會以雜湊形式存儲在 &lt;code&gt;users.htpasswd&lt;/code&gt; 檔案中。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;創建 Htpasswd secret。定義一個包含 HTPasswd 使用者檔案的 secret。&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc -n openshift-config create secret generic htpass-secret \
--from-file=htpasswd=users.htpasswd &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;格式如下：
&lt;code&gt;oc create secret generic htpass-secret --from-file=htpasswd=&amp;lt;/path/to/users.htpasswd&amp;gt; -n openshift-config&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 &lt;code&gt;HTPasswd identity&lt;/code&gt; CR&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano htpasswd.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: mgr-haha_htpasswd_provider
challenge: true
login: true
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 &lt;code&gt;HTPasswd identity&lt;/code&gt; CR&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc apply -f htpasswd.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;為新的使用者設定叢集管理員角色&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm policy add-role-to-user cluster-admin mgr-haha&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將叢集的 CA 內容存成 ca.crt 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc -n openshift-config-managed get configmap kube-root-ca.crt \
-o jsonpath=&amp;#39;{.data.ca\.crt}&amp;#39; &amp;gt; ca.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試新使用者登入 ocp&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc login -u=mgr-haha -p haha --certificate-authority=ca.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;正確執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Login successful.
You have one project on this server: &amp;#34;default&amp;#34;
Using project &amp;#34;default&amp;#34;.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;為 mgr-test 創建客戶端證書，使用內部 OpenShift CA&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openssl req -nodes -newkey rsa:4096 \
-keyout /tmp/mgr-test.key -subj &amp;#34;/O=system:admin/CN=mgr-test&amp;#34; \
-out /tmp/mgr-test.csr&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 CSR 提交給 OpenShift，以便稍後用內部 CA 簽署：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt; EOF | oc create -f -
apiVersion: certificates.k8s.io/v1
kind: CertificateSigningRequest
metadata:
name: mgr-test-access
spec:
signerName: kubernetes.io/kube-apiserver-client
groups:
- system:authenticated
request: $(cat /tmp/mgr-test.csr | base64 -w0)
usages:
- client auth
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;批准證書請求&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm certificate approve mgr-test-access&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;證書已獲批准，我們現在可以從叢集中獲取它：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get csr mgr-test-access -o jsonpath=&amp;#39;{.status.certificate}&amp;#39; \
| base64 -d &amp;gt; /tmp/mgr-test.crt&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;為 test-mgr 創建 kubeconfig 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;export OPENSHIFT_API_SERVER_ENDPOINT=api.topgun.kubeantony.com:6443
openssl s_client -showcerts -connect ${OPENSHIFT_API_SERVER_ENDPOINT} &amp;lt;/dev/null 2&amp;gt;/dev/null|openssl x509 -outform PEM &amp;gt; /tmp/ocp-apiserver-cert.crt
export USER=mgr-test
# 1. 設定使用者憑證 (加入 config)
oc config set-credentials ${USER} \
--kubeconfig=&amp;#34;/tmp/${USER}config&amp;#34; \
--client-certificate=&amp;#34;/tmp/${USER}.crt&amp;#34; \
--client-key=&amp;#34;/tmp/${USER}.key&amp;#34; \
--embed-certs=true
# 2. 設定叢集資訊 (加入 config)
oc config set-cluster topgun-ocp-cluster \
--kubeconfig=&amp;#34;/tmp/${USER}config&amp;#34; \
--certificate-authority=&amp;#34;/tmp/ocp-apiserver-cert.crt&amp;#34; \
--embed-certs=true \
--server=&amp;#34;https://${OPENSHIFT_API_SERVER_ENDPOINT}&amp;#34;
# 3. 設定 Context (加入 config)
oc config set-context topgun-ocp \
--kubeconfig=&amp;#34;/tmp/${USER}config&amp;#34; \
--cluster=topgun-ocp-cluster \
--namespace=default \
--user=${USER}
# 4. 切換 Context (加入 config)
oc config use-context topgun-ocp \
--kubeconfig=&amp;#34;/tmp/${USER}config&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認當前身份&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc --kubeconfig=/tmp/mgr-testconfig auth whoami&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ATTRIBUTE VALUE
Username mgr-test
Groups [system:admin system:authenticated]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;參考文件&lt;span class="hx:absolute hx:-mt-20" id="參考文件"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e6%96%87%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/dx-operational-observability-onprem/24-2/installation-and-upgrade/installing/reference-information/Create-a-User-in-Openshift.html"target="_blank" rel="noopener"&gt;Create a User in OpenShift - Broadcom Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
href="https://linuxera.org/user-certificates-in-openshift4/"target="_blank" rel="noopener"&gt;OpenShift 4 User Certificates&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>ocp to vmware loginsight</title><link>https://blog.kubeantony.com/archive/openshift/ocp-to-vmware-loginsight/</link><pubDate>Mon, 29 Dec 2025 03:42:18 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/ocp-to-vmware-loginsight/</guid><description>
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc new-project vmware-vrealize-log-insight
oc create configmap vrli-fluent-config --from-file=fluent.conf
oc create configmap fluentd-gemfile-config --from-file=Gemfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>動手實作 OpenTelemetry</title><link>https://blog.kubeantony.com/archive/ops-automation/%E5%8B%95%E6%89%8B%E5%AF%A6%E4%BD%9C-opentelemetry/</link><pubDate>Tue, 16 Dec 2025 19:45:08 +0800</pubDate><guid>https://blog.kubeantony.com/archive/ops-automation/%E5%8B%95%E6%89%8B%E5%AF%A6%E4%BD%9C-opentelemetry/</guid><description>
&lt;h2&gt;0. Preface&lt;span class="hx:absolute hx:-mt-20" id="0-preface"&gt;&lt;/span&gt;
&lt;a href="#0-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章是翻譯 Getting Started with OpenTelemetry (LFS148) 的第四章節，想看原文可參考以下網址：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#"target="_blank" rel="noopener"&gt;https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;</description></item><item><title>為什麼需要 OpenTelemetry</title><link>https://blog.kubeantony.com/archive/ops-automation/%E7%82%BA%E4%BB%80%E9%BA%BC%E9%9C%80%E8%A6%81-opentelemetry/</link><pubDate>Tue, 16 Dec 2025 19:44:46 +0800</pubDate><guid>https://blog.kubeantony.com/archive/ops-automation/%E7%82%BA%E4%BB%80%E9%BA%BC%E9%9C%80%E8%A6%81-opentelemetry/</guid><description>
&lt;h2&gt;0. Preface&lt;span class="hx:absolute hx:-mt-20" id="0-preface"&gt;&lt;/span&gt;
&lt;a href="#0-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章是翻譯 Getting Started with OpenTelemetry (LFS148) 的第二章節，想看原文可參考以下網址：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#"target="_blank" rel="noopener"&gt;https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;
&lt;h2&gt;1. 學習目標完成本章後，您將能夠：&lt;span class="hx:absolute hx:-mt-20" id="1-學習目標完成本章後您將能夠"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%ad%b8%e7%bf%92%e7%9b%ae%e6%a8%99%e5%ae%8c%e6%88%90%e6%9c%ac%e7%ab%a0%e5%be%8c%e6%82%a8%e5%b0%87%e8%83%bd%e5%a4%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;定義與&lt;strong&gt;工作負載 (Workload)&lt;/strong&gt; 及資源分析相關的通用術語&lt;/li&gt;
&lt;li&gt;說明為何&lt;strong&gt;可觀測性 (Observability)&lt;/strong&gt; 在&lt;strong&gt;分散式系統&lt;/strong&gt;中至關重要&lt;/li&gt;
&lt;li&gt;探討可觀測性的三大支柱——&lt;strong&gt;日誌 (Logs)&lt;/strong&gt;、&lt;strong&gt;指標 (Metrics)&lt;/strong&gt; 與 &lt;strong&gt;追蹤 (Traces)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;探討現代——且常是&lt;strong&gt;多語言混合 (Polyglot)&lt;/strong&gt;——分散式應用程式所面臨的挑戰&lt;/li&gt;
&lt;li&gt;描述 &lt;strong&gt;OpenTelemetry&lt;/strong&gt; 的特性&lt;/li&gt;
&lt;li&gt;說明 &lt;strong&gt;OpenTelemetry&lt;/strong&gt; 如何試圖解決傳統可觀測性解決方案的不足之處&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 當前可觀察性的狀態&lt;span class="hx:absolute hx:-mt-20" id="2-當前可觀察性的狀態"&gt;&lt;/span&gt;
&lt;a href="#2-%e7%95%b6%e5%89%8d%e5%8f%af%e8%a7%80%e5%af%9f%e6%80%a7%e7%9a%84%e7%8b%80%e6%85%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;根據維基百科的定義，「&lt;strong&gt;可觀測性 (Observability)&lt;/strong&gt; 是衡量我們能多有效地透過系統的外部輸出，來推斷其內部狀態的一項指標」(2024)。換句話說，可觀測性指的是您透過檢視系統（例如應用程式或服務）所產生的資訊，來理解其內部運作狀況的容易程度。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;分散式系統 (Distributed System)&lt;/strong&gt; 是由一組獨立的電腦或&lt;strong&gt;節點 (nodes)&lt;/strong&gt; 所組成的網路，它們協同運作以執行任務，表現得就像是一個單一系統。這類系統廣泛應用於&lt;strong&gt;雲端運算 (Cloud Computing)&lt;/strong&gt; 等領域，其中應用程式的不同部分會在不同的伺服器上運行，藉此共享資源並達成&lt;strong&gt;工作負載平衡 (balance the workload)&lt;/strong&gt;。由於分散式系統的複雜性，要在任何時間點掌握每個&lt;strong&gt;元件 (component)&lt;/strong&gt; 內部的運作情形，往往是一項艱鉅的挑戰。這正是可觀測性變得至關重要的原因。&lt;/p&gt;
&lt;p&gt;為了讓分散式系統具備可觀測性，我們必須以一種能讓我們推導其行為的方式來建立狀態模型。這個模型由三個要素組成：&lt;/p&gt;
&lt;p&gt;首先是 &lt;strong&gt;工作負載 (Workload)&lt;/strong&gt;。這是系統為了達成目標所執行的操作。例如，當使用者發送一個請求時，分散式系統通常會將其拆解為由不同服務處理的較小任務。這通常也被稱為 &lt;strong&gt;交易 (Transactions)&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;第二是構成分散式系統結構的 &lt;strong&gt;軟體抽象層 (Software Abstractions)&lt;/strong&gt;。這包含了諸如 &lt;strong&gt;負載平衡器 (Load Balancers)&lt;/strong&gt;、&lt;strong&gt;服務 (Services)&lt;/strong&gt;、&lt;strong&gt;Pods&lt;/strong&gt;、&lt;strong&gt;容器 (Containers)&lt;/strong&gt; 等元件。&lt;/p&gt;
&lt;p&gt;最後是提供 &lt;strong&gt;運算資源 (Computational Resources)&lt;/strong&gt;（如 RAM、CPU、磁碟空間、網路）以執行工作的 &lt;strong&gt;實體機器 (Physical Machines)&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/SkOqMbyQZg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;根據我們的背景不同，在調查分散式系統的效能或進行故障排除時，我們往往會有特定的 &lt;strong&gt;切入視角 (bias)&lt;/strong&gt;。應用程式開發人員通常專注於與工作負載相關的層面，而 &lt;strong&gt;維運團隊 (Operations Teams)&lt;/strong&gt; 則傾向於關注實體資源。&lt;/p&gt;
&lt;p&gt;為了真正理解一個系統，我們必須結合來自多個角度的洞察，並釐清它們彼此之間的關聯。然而，在我們能進行分析之前，必須先捕捉系統行為的各個面向。這通常是透過結合 &lt;strong&gt;日誌 (Logs)&lt;/strong&gt;、&lt;strong&gt;指標 (Metrics)&lt;/strong&gt; 和 &lt;strong&gt;追蹤 (Traces)&lt;/strong&gt; 來完成的。&lt;/p&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h3&gt;2.1. Logs&lt;span class="hx:absolute hx:-mt-20" id="21-logs"&gt;&lt;/span&gt;
&lt;a href="#21-logs" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1LPXW1Xbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;日誌（Logs）是一種僅能追加（append-only）的資料結構，用來記錄系統中發生的事件。&lt;/strong&gt; 一筆日誌紀錄包含標示事件發生時間的時間戳記（timestamp），以及描述事件細節的訊息。然而，要制定一個標準化的日誌格式並非易事。其中一個原因是，不同類型的軟體通常傳達不同的資訊內容。HTTP 網頁伺服器的日誌，肯定與核心（kernel）的日誌截然不同。但即使是相似的軟體，人們對於「好的日誌」應具備的樣貌也常有不同看法。&lt;/p&gt;
&lt;p&gt;除了內容之外，日誌格式也會隨著其使用對象（consumers）而有所不同。最初，純文字格式是為了迎合人類的可讀性而設計。然而，隨著軟體系統變得日益複雜，日誌的量級很快就變得難以管理。為了應對這個問題，我們開始將事件編碼為鍵值對（key/value pairs），使其具備機器可讀性（machine-readable），這通常被稱為結構化日誌（structured logging）。&lt;/p&gt;
&lt;p&gt;此外，貨櫃化（containerized）應用程式的分散式與短暫特性（ephemeral nature），意味著登入個別機器去翻找日誌的做法不再可行。因此，人們開始構建日誌代理程式（logging agents）和通訊協定，將日誌轉發到專用的服務中。這些日誌系統實現了高效的儲存，並具備在集中位置搜尋與過濾日誌的能力。&lt;/p&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h3&gt;2.2. Metrics&lt;span class="hx:absolute hx:-mt-20" id="22-metrics"&gt;&lt;/span&gt;
&lt;a href="#22-metrics" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJZsEZ1QZl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;服務在執行時捕獲的測量值。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;日誌（Logs）非常擅長提供關於個別事件的詳細資訊。然而，有時我們需要掌握系統當前狀態的宏觀概覽（high-level view）。這正是指標（Metrics）派上用場的地方。&lt;/p&gt;
&lt;p&gt;指標是透過對一組事件應用統計運算後，所推導出的單一數值。換句話說，指標代表的是一種聚合數據。這非常有價值，因為它們精簡的呈現方式，讓我們能夠將系統隨時間變化的情形繪製成圖表。&lt;/p&gt;
&lt;p&gt;因應這些需求，業界開發了用來萃取指標的儀器（instruments）、用來表示與傳輸資料的格式與通訊協定、專門用來儲存資料的時序資料庫（time-series databases），以及讓終端使用者能存取這些資料的前端介面。&lt;/p&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h3&gt;2.3. Traces&lt;span class="hx:absolute hx:-mt-20" id="23-traces"&gt;&lt;/span&gt;
&lt;a href="#23-traces" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1ACIb1XWx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;隨著分散式系統的規模擴大，傳統日誌系統在對複雜問題進行除錯（debug）時，顯然經常感到力有未逮。原因在於，我們往往必須理解系統中一連串事件的脈絡。&lt;/p&gt;
&lt;p&gt;在單機環境下，堆疊追蹤（stack traces）讓我們能將例外狀況（exception）追溯回特定的程式碼行數。然而在分散式環境中，我們無法享有這種便利。取而代之的是，我們必須進行大量的過濾，才能定位出我們關注的日誌事件。為了理解整體脈絡（context），我們必須識別其他相關聯的事件，例如觸發該日誌紀錄的特定請求或交易，以及該請求在系統中處理時所涉及的服務或微服務之順序。這通常會導致大量的人工操作（例如比對時間戳記），或者需要對應用程式具備深厚的領域知識。為了正視這個問題，Google 開發了 &lt;a
href="https://research.google.com/pubs/pub36356.html?spm=5176.100239.blogcont60165.11.OXME9Z"target="_blank" rel="noopener"&gt;Dapper&lt;/a&gt;，並普及了分散式追蹤（distributed tracing）的概念。&lt;/p&gt;
&lt;p&gt;從本質上來說，分散式追蹤就是「強化版」的日誌記錄（logging on steroids）。其核心概念在於為日誌添加交易脈絡（transactional context）。這使得我們能夠推斷因果關係，並還原請求在系統中的完整路徑（journey）。&lt;/p&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;3. 可觀測性的三大支柱&lt;span class="hx:absolute hx:-mt-20" id="3-可觀測性的三大支柱"&gt;&lt;/span&gt;
&lt;a href="#3-%e5%8f%af%e8%a7%80%e6%b8%ac%e6%80%a7%e7%9a%84%e4%b8%89%e5%a4%a7%e6%94%af%e6%9f%b1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;strong&gt;遙測（Telemetry）&lt;/strong&gt; 是指從遠端或分散式系統自動收集並傳輸資料的過程，目的是為了監控、測量及追蹤這些系統的效能或狀態。遙測資料提供了關於應用程式各個部分運作情形的即時洞察（real-time insights）。這些數據成為可觀測性工具的基礎，協助開發人員和系統管理員觀察、除錯（troubleshoot）並最佳化系統，而無需手動檢查每一個元件。&lt;/p&gt;
&lt;p&gt;從表面上看，Log（日誌）、Metric（指標）和 Trace（追蹤）在其生命週期和組成元件上有許多相似之處。一切都始於 &lt;strong&gt;Instrumentation（儀器化/埋點）&lt;/strong&gt;，負責捕捉並發送資料。這些資料必須具備由格式定義的特定結構。接著，我們需要一種機制來收集並轉發這些遙測數據。通常會有某種 &lt;strong&gt;Agent（代理程式）&lt;/strong&gt; 來進一步擴充（enrich）、處理和批次打包資料，然後將其攝入（ingest）後端系統。這個過程通常涉及一個資料庫，以有效地儲存、索引和搜尋大量的資料。最後，會有前端分析介面讓終端使用者能存取這些數據。&lt;/p&gt;
&lt;p&gt;然而，在實務上，我們針對每種類型的遙測開發專用系統是有充分理由的：每一種遙測訊號（signal）都帶來了獨特的技術挑戰。這些挑戰主要源於資料本質的不同。&lt;/p&gt;
&lt;p&gt;資料模型、交換格式和傳輸協定的設計，高度取決於你處理的是非結構化或半結構化的文字資訊（Logs）、時間序列中緊湊的數值（Metrics），還是描述事件間因果關係的圖狀結構（Traces）。即使是針對單一種訊號，業界在這些議題上也尚未達成共識。&lt;/p&gt;
&lt;p&gt;此外，我們如何運用並從遙測中獲取洞察的方式也大相徑庭。一個系統可能需要執行全文檢索、檢查單一事件、分析歷史趨勢、視覺化請求流程、診斷效能瓶頸等等。這些需求具體體現在儲存、存取模式、查詢功能等方面的設計與最佳化上。&lt;/p&gt;
&lt;p&gt;當面對這些技術挑戰時，&lt;strong&gt;垂直整合（vertical integration）&lt;/strong&gt; 成為了一種務實的解決方案。在實務中，可觀測性廠商往往將問題範圍縮小到單一訊號，並提供生成資料的 Instrumentation 以及分析遙測的工具，形成一個單一且完全整合的解決方案。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1mRwWkQbl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Three Pillars of Observability: Metrics, Traces and Logs&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;正因為針對 Logs（日誌）、Metrics（指標）和 Traces（追蹤）擁有各自專用的系統，我們才普遍將它們稱為可觀測性的「三大支柱」。&lt;/p&gt;
&lt;p&gt;「支柱」這個概念提供了一個極佳的思考框架（mental framework），因為它強調了以下重點：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;遙測資料（telemetry）區分為不同的類別。&lt;/li&gt;
&lt;li&gt;每一根支柱都具備其獨特的優勢，且能獨當一面。&lt;/li&gt;
&lt;li&gt;這些支柱具有互補性，必須結合在一起，才能構成實現可觀測性的穩固基石。&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3&gt;3.1. 現行可觀測性作法的問題&lt;span class="hx:absolute hx:-mt-20" id="31-現行可觀測性作法的問題"&gt;&lt;/span&gt;
&lt;a href="#31-%e7%8f%be%e8%a1%8c%e5%8f%af%e8%a7%80%e6%b8%ac%e6%80%a7%e4%bd%9c%e6%b3%95%e7%9a%84%e5%95%8f%e9%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;面對市面上充斥著大量的開源與商用可觀測性解決方案，你可能會（很合理地）問自己：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;如果針對 Logs、Metrics 和 Traces 的產生、收集、儲存與分析，都已經有許多成熟的解決方案了，那我為什麼要在意（OpenTelemetry）？&lt;/li&gt;
&lt;li&gt;目前的可觀測性現狀到底有什麼問題？&lt;/li&gt;
&lt;li&gt;喔，好極了……這該不會又是一次試圖制定標準的嘗試吧？&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;這些都是合理的問題。為了回答這些問題，我們必須點出在建構與使用那些「基於支柱（pillar-based）」的可觀測性系統時，所衍生出的一些缺點。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;3.2. 孤島式的遙測資料難以運用&lt;span class="hx:absolute hx:-mt-20" id="32-孤島式的遙測資料難以運用"&gt;&lt;/span&gt;
&lt;a href="#32-%e5%ad%a4%e5%b3%b6%e5%bc%8f%e7%9a%84%e9%81%99%e6%b8%ac%e8%b3%87%e6%96%99%e9%9b%a3%e4%bb%a5%e9%81%8b%e7%94%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkUTKZJXbg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;首先，遙測資料的品質本身存在不足。為了說明這一點，讓我們想像一下我們要調查某個問題的根本原因（root cause）。&lt;/p&gt;
&lt;p&gt;問題的第一個徵兆，通常是來自警報，或是指標儀表板（metrics dashboard）上的異常。為了確認該事件值得調查，我們必須先形成初步的假設。目前我們手上唯一的資訊是，在特定時間點發生了某些事情。因此，第一步通常是使用指標系統，去尋找其他在時間上具備關聯性（temporally correlated）且呈現異常行為的指標。&lt;/p&gt;
&lt;p&gt;在對問題做出有根據的推測後，我們會希望深入挖掘（drill down）並調查問題的根本原因。為了獲取額外資訊，我們通常會切換到日誌系統（logging system）。在這裡，我們撰寫查詢語法並進行大量的過濾，試圖找出與那些可疑指標相關的日誌事件。&lt;/p&gt;
&lt;p&gt;發現感興趣的日誌事件後，我們通常想了解該操作發生當下更廣泛的脈絡（context）。遺憾的是，傳統日誌系統缺乏重建特定交易中事件鏈的機制。傳統日誌系統往往無法捕捉操作的完整脈絡，導致難以將跨越不同服務或元件的事件關聯起來。它們經常缺乏保留關鍵 Metadata（如 Trace ID 或 Span ID）的能力，而這些對於連結相關事件至關重要。這種限制導致了系統行為視角的破碎化，單一操作的「故事」散落在多個日誌中，缺乏清晰的敘事。此外，缺乏標準化的查詢語言或介面，更加深了有效搜尋與分析日誌的難度，因為維運人員必須仰賴客製化腳本或手動過濾，才能發掘出模式與異常。&lt;/p&gt;
&lt;p&gt;如果我們將視角從「構建」可觀測性解決方案的人，切換到「使用」它的人，就會發現一種本質上的脫節。真實世界的問題並不是由 Log、Metrics 或 Tracing 構成的。相反地，我們必須在不同類型的遙測數據之間來回切換，以建立心智模型（mental model）並推斷系統的行為。由於可觀測性工具往往是彼此不相連的資料孤島（silos），要釐清資訊片段之間的關聯，會給維運人員帶來巨大的&lt;strong&gt;認知負擔（cognitive load）&lt;/strong&gt;。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;3.3. 缺乏 Instrumentation (儀器化) 標準導致資料品質低落&lt;span class="hx:absolute hx:-mt-20" id="33-缺乏-instrumentation-儀器化-標準導致資料品質低落"&gt;&lt;/span&gt;
&lt;a href="#33-%e7%bc%ba%e4%b9%8f-instrumentation-%e5%84%80%e5%99%a8%e5%8c%96-%e6%a8%99%e6%ba%96%e5%b0%8e%e8%87%b4%e8%b3%87%e6%96%99%e5%93%81%e8%b3%aa%e4%bd%8e%e8%90%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;另一個讓根本原因分析（root-cause analysis）變得困難的因素是，遙測資料往往深受「缺乏一致性」所苦。&lt;/p&gt;
&lt;p&gt;這導致在不同服務或元件之間&lt;strong&gt;關聯（correlating）&lt;/strong&gt; 事件變得相當困難，因為缺乏標準化的方式來識別相關聯的事件，例如透過 Trace ID 或 Span ID 來串接。&lt;/p&gt;
&lt;p&gt;此外，目前也沒有直接了當的方法，能將多個針對特定解決方案（solution-specific）的日誌函式庫，整合到一個連貫的系統中。這最終導致我們對系統行為的觀察變得破碎且脫節。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;3.4. 開源軟體缺乏內建 Instrumentation (儀器化)&lt;span class="hx:absolute hx:-mt-20" id="34-開源軟體缺乏內建-instrumentation-儀器化"&gt;&lt;/span&gt;
&lt;a href="#34-%e9%96%8b%e6%ba%90%e8%bb%9f%e9%ab%94%e7%bc%ba%e4%b9%8f%e5%85%a7%e5%bb%ba-instrumentation-%e5%84%80%e5%99%a8%e5%8c%96" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;讓我們從開源軟體開發者的角度來看待這件事。現今，大多數的應用程式都是建構在開源函式庫、框架和獨立元件之上。由於大量的運作都發生在應用程式開發者所撰寫的商業邏輯之外，因此從這些開源元件收集遙測數據（telemetry）至關重要。最了解軟體運作時哪些資訊至關重要的，莫過於開發者與維護者本身。然而，目前缺乏一種透過&lt;strong&gt;原生儀器化（native instrumentation）&lt;/strong&gt; 來傳遞這些資訊的良好方式。&lt;/p&gt;
&lt;p&gt;其中一個選項是選用特定可觀測性解決方案的儀器化工具。然而，這會為專案增加額外的相依性（dependencies），並強迫使用者將其整合到自己的系統中。雖然同時運行多套日誌與指標系統雖然不切實際（impractical），但在技術上尚屬可行；然而，分散式追蹤（Tracing）卻是完全不可能的，因為它需要所有人達成共識，採用統一的標準，才能讓 &lt;strong&gt;Trace Context 的傳遞（propagation）&lt;/strong&gt; 順利運作。&lt;/p&gt;
&lt;p&gt;電腦科學界解決問題的一個常見策略，就是增加一層&lt;strong&gt;間接層（indirection）&lt;/strong&gt;。與其嵌入特定廠商的儀器化程式碼，開源開發者通常會提供可觀測性的 &lt;strong&gt;Hooks&lt;/strong&gt;。這讓使用者能撰寫&lt;strong&gt;轉接器（adapters）&lt;/strong&gt;，將開源元件連接到自己的可觀測性系統。&lt;/p&gt;
&lt;p&gt;雖然這種方法提供了較大的彈性，但也伴隨著不少問題。例如，每當軟體推出新版本時，使用者都必須留意並更新他們的轉接器。此外，這種間接層也增加了系統開銷（overhead），因為我們必須在不同的遙測格式之間進行轉換。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;3.5. 結合遙測生成與特定方案將導致供應商綁定 (Vendor Lock-in)&lt;span class="hx:absolute hx:-mt-20" id="35-結合遙測生成與特定方案將導致供應商綁定-vendor-lock-in"&gt;&lt;/span&gt;
&lt;a href="#35-%e7%b5%90%e5%90%88%e9%81%99%e6%b8%ac%e7%94%9f%e6%88%90%e8%88%87%e7%89%b9%e5%ae%9a%e6%96%b9%e6%a1%88%e5%b0%87%e5%b0%8e%e8%87%b4%e4%be%9b%e6%87%89%e5%95%86%e7%b6%81%e5%ae%9a-vendor-lock-in" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;讓我們試著戴上終端使用者的帽子（站在使用者的立場）來看待這件事。一旦決定採用某個解決方案，應用程式的程式碼庫（codebase）中就會遍佈著許多針對該特定解決方案的函式庫呼叫（library calls）。&lt;/p&gt;
&lt;p&gt;若日後想要轉換到另一個可觀測性工具，我們將被迫把現有所有的儀器化程式碼（instrumentation）連根拔除並替換，同時還得遷移我們的分析工具。這種「重新儀器化（re-instrumentation）」所需的巨大前期成本，使得遷移變得困難重重，而這正是&lt;strong&gt;供應商綁定（Vendor Lock-in）&lt;/strong&gt; 的一種形式。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;3.6. 陷入苦戰的可觀測性廠商 / 高聳的進入門檻&lt;span class="hx:absolute hx:-mt-20" id="36-陷入苦戰的可觀測性廠商--高聳的進入門檻"&gt;&lt;/span&gt;
&lt;a href="#36-%e9%99%b7%e5%85%a5%e8%8b%a6%e6%88%b0%e7%9a%84%e5%8f%af%e8%a7%80%e6%b8%ac%e6%80%a7%e5%bb%a0%e5%95%86--%e9%ab%98%e8%81%b3%e7%9a%84%e9%80%b2%e5%85%a5%e9%96%80%e6%aa%bb" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;這個方程式的最後一個環節，是可觀測性廠商本身。乍看之下，廠商似乎是唯一從現狀中獲利的一方。在過去，高品質的儀器化（instrumentation）是與競爭對手做出&lt;strong&gt;市場區隔（differentiation）&lt;strong&gt;的絕佳方式。此外，由於為大量既有軟體開發整合介面（integrations）非常昂貴，可觀測性市場具有相對較高的&lt;/strong&gt;進入門檻（barrier to entry）&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;由於客戶對昂貴的「重新儀器化（re-instrumentation）」望之卻步，既有的老牌廠商面臨較少的競爭與創新壓力。然而，他們也正經歷著巨大的痛點。過去十年間，軟體開發的速度呈現指數級成長。現今 &lt;strong&gt;異質化（heterogeneous）&lt;/strong&gt; 的軟體生態，使得要維護針對每一個函式庫、框架和元件的儀器化支援，變得根本不可能。&lt;/p&gt;
&lt;p&gt;一旦廠商開始難以提供（特定的）儀器化支援，客戶就會開始拒絕採用他們的產品。結果導致各家解決方案都在競爭誰能打造出最好的「N 對 N 格式轉換器」，而不是將這些資源投入到開發更棒的分析工具上。另一個缺點是，轉換那些由外部來源產生的資料，往往會導致遙測資料品質的&lt;strong&gt;劣化（degradation）&lt;/strong&gt;。一旦資料定義不再明確，分析起來就變得更加困難。&lt;/p&gt;
&lt;/div&gt;
&lt;hr&gt;
&lt;h2&gt;4. 什麼是 OpenTelemetry&lt;span class="hx:absolute hx:-mt-20" id="4-什麼是-opentelemetry"&gt;&lt;/span&gt;
&lt;a href="#4-%e4%bb%80%e9%ba%bc%e6%98%af-opentelemetry" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;OpenTelemetry (OTel) 是一個開源專案，旨在提供標準化的工具和 API，用於生成、收集和匯出&lt;strong&gt;追蹤 (Traces)&lt;/strong&gt;、&lt;strong&gt;指標 (Metrics)&lt;/strong&gt; 和 &lt;strong&gt;日誌 (Logs)&lt;/strong&gt; 等遙測數據。其目的是讓開發人員能深入掌握應用程式的可觀測性，進而協助監控、故障排除以及最佳化軟體系統。&lt;/p&gt;
&lt;p&gt;OpenTelemetry 的主要目標包括：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;統一的遙測 (Unified telemetry)：&lt;/strong&gt; 將追蹤、日誌和指標結合至單一框架中，實現所有數據的關聯分析，並建立遙測數據的開放標準。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;供應商中立 (Vendor-neutrality)：&lt;/strong&gt; 可整合不同的後端系統來處理數據（不被特定單一廠商綁定）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;跨平台 (Cross-platform)：&lt;/strong&gt; 支援多種程式語言（如 Java、Python、Go 等）與平台，使其能靈活適用於各種開發環境。&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h3&gt;4.1. OpenTelemetry 不是什麼？&lt;span class="hx:absolute hx:-mt-20" id="41-opentelemetry-不是什麼"&gt;&lt;/span&gt;
&lt;a href="#41-opentelemetry-%e4%b8%8d%e6%98%af%e4%bb%80%e9%ba%bc" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;通常透過定義某個事物「不是什麼」，會更有助於理解它的本質。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;OpenTelemetry 是：&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;不是一套多合一 (All-in-One) 的監控或可觀測性工具
OpenTelemetry 不會取代像 Datadog、New Relic 或 Prometheus 這類功能完整的監控或可觀測性平台。相反地，它協助收集並標準化遙測數據（追蹤、指標、日誌），讓您可以將數據發送到這些工具進行視覺化和分析。&lt;/li&gt;
&lt;li&gt;不是數據儲存或儀表板 (Dashboarding) 解決方案
OpenTelemetry 本身不負責儲存或視覺化數據。它專注於收集和匯出遙測數據到負責儲存與呈現的外部系統，例如 Grafana、Jaeger 或 Prometheus。&lt;/li&gt;
&lt;li&gt;不是預先設定好的監控工具
OpenTelemetry 是一套用於收集和匯出數據的工具組 (Toolkit)，但它需要進行設定並與其他系統整合。它不會自動提供開箱即用 (out-of-the-box) 的監控或告警功能。&lt;/li&gt;
&lt;li&gt;不是效能最佳化工具 (Performance Optimizer)
雖然 OpenTelemetry 協助您收集詳細的效能數據，但它不會自動將應用程式效能最佳化。它是一種診斷工具，協助您收集數據洞察，以作為手動調校 (Manual tuning) 的依據。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;總結來說：&lt;/strong&gt;
本質上，OpenTelemetry 是一個針對遙測數據的「整合與標準化工具」，而非監控、日誌記錄或效能管理的多合一解決方案。它透過標準化數據收集流程，來與其他工具&lt;strong&gt;相輔相成 (Complements)&lt;/strong&gt;。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;4.2. 為什麼 OpenTelemetry 備受看好？&lt;span class="hx:absolute hx:-mt-20" id="42-為什麼-opentelemetry-備受看好"&gt;&lt;/span&gt;
&lt;a href="#42-%e7%82%ba%e4%bb%80%e9%ba%bc-opentelemetry-%e5%82%99%e5%8f%97%e7%9c%8b%e5%a5%bd" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;截至本文撰寫時（2024 年 5 月），OpenTelemetry 是 &lt;strong&gt;CNCF&lt;/strong&gt;（雲端原生運算基金會）中成長速度第二快的專案。OpenTelemetry 之所以獲得如此高度的關注，是因為它有望為我們產生遙測數據的方式帶來&lt;strong&gt;根本性的轉變 (Fundamental shift)&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;我們必須記住，「可觀測性 (Observability)」還是一個相當年輕的領域。在過去，快速的創新步調以及（廠商間的）&lt;strong&gt;利益衝突 (Conflicts of interest)&lt;/strong&gt;，阻礙了我們為遙測數據制定出一套廣泛採用的標準。然而，憑藉著 OpenTelemetry 目前的時機點與&lt;strong&gt;發展動能 (Momentum)&lt;/strong&gt;，看來確實有極大的機會能推動遙測數據通用面向的標準化。&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;4.3. OpenTelemetry 的優勢&lt;span class="hx:absolute hx:-mt-20" id="43-opentelemetry-的優勢"&gt;&lt;/span&gt;
&lt;a href="#43-opentelemetry-%e7%9a%84%e5%84%aa%e5%8b%a2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;一次儀器化，隨處可用 (Instrument once, use everywhere)
OpenTelemetry 的一個關鍵承諾是，您只需對程式碼進行一次 &lt;strong&gt;儀器化 (Instrument)&lt;/strong&gt;，之後便不再需要重複進行，並能在任何地方使用該儀器化結果。OpenTelemetry 體認到，若要成功，它必須成為許多軟體專案的核心依賴 (Dependency)。因此，它遵循嚴格的流程以提供長期的穩定性保證。一旦某個訊號 (Signal) 被宣告為穩定版本 (Stable)，其承諾是客戶端將永遠不會遇到&lt;strong&gt;破壞性的 API 變更 (Breaking API change)&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;將遙測數據的「生成」與「分析」分離
OpenTelemetry 的另一個核心概念是，將產生遙測數據的機制，與分析數據的系統分開。這種開放且&lt;strong&gt;不依賴特定供應商 (Vendor-agnostic)&lt;/strong&gt; 的儀器化方式，標誌著可觀測性產業的根本變革。供應商不再需要投入大量資源開發專有的儀器化工具並維持其更新，而是必須透過功能豐富且易用性極佳的分析平台來做出市場區隔。OpenTelemetry 促進了競爭，因為使用者不再被開發期間選擇的可觀測性解決方案&lt;strong&gt;綁死 (Lock-in)&lt;/strong&gt;。切換到 OpenTelemetry 後，您可以更換平台，而無需重新對整個系統進行儀器化。&lt;/li&gt;
&lt;li&gt;讓軟體預設即具備可觀測性 (Make software observable by default)
藉由 OpenTelemetry，開源開發者可以在專案中加入原生的儀器化功能，而無需引入會造成使用者負擔的廠商特定程式碼。其概念是讓「可觀測性」在開發階段就成為&lt;strong&gt;一等公民 (First-class citizen)&lt;/strong&gt;。透過軟體出廠時即內建儀器化功能，我們不再需要於事後 (After the fact) 透過複雜的機制來擷取和整合數據。&lt;/li&gt;
&lt;li&gt;改善我們使用遙測數據的方式
最後（但絕對同樣重要），OpenTelemetry 試圖改變我們思考和使用遙測數據的方式。OpenTelemetry 摒棄了將日誌、指標和追蹤視為三個獨立&lt;strong&gt;孤島 (Silos)&lt;/strong&gt; 的做法，而是採用將遙測訊號相互連結的典範。隨著上下文 (Context) 在訊號之間建立起接觸點，遙測數據的整體價值與易用性將大幅提升。例如，想像一下能夠直接從儀表板上顯著的統計數據，跳轉到相關聯的日誌中。互相關聯的遙測數據有助於降低維運複雜系統的人員的&lt;strong&gt;認知負荷 (Cognitive load)&lt;/strong&gt;。能夠利用這些連結數據，將標誌著新一代可觀測性工具的誕生。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. 本章總結&lt;span class="hx:absolute hx:-mt-20" id="5-本章總結"&gt;&lt;/span&gt;
&lt;a href="#5-%e6%9c%ac%e7%ab%a0%e7%b8%bd%e7%b5%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;在本章中，我們涵蓋了 &lt;strong&gt;工作負載與資源分析（Workload and resource analysis）&lt;/strong&gt; 的核心概念，為您在監控與優化現代應用程式時所需的術語打下基礎。我們強調了 &lt;strong&gt;可觀測性（Observability）&lt;/strong&gt; 的重要性，以及它在了解分散式系統健康狀況與效能方面所扮演的關鍵角色。&lt;/p&gt;
&lt;p&gt;您現在已經了解可觀測性的&lt;strong&gt;三大支柱&lt;/strong&gt;——&lt;strong&gt;日誌（Logs）&lt;/strong&gt;、&lt;strong&gt;指標（Metrics）&lt;strong&gt;與&lt;/strong&gt;追蹤（Traces）&lt;/strong&gt;——以及它們如何各自發揮獨特作用，以提供系統行為的完整視野。本章也點出了現代化、多語言開發（Polyglot）及分散式應用程式所帶來的挑戰，例如日益增加的複雜度，以及難以跨多種服務來關聯 &lt;strong&gt;遙測資料（Telemetry data）&lt;/strong&gt; 的問題。&lt;/p&gt;
&lt;p&gt;我們探討了 &lt;strong&gt;OpenTelemetry&lt;/strong&gt; 是什麼——它是一個 &lt;strong&gt;供應商中立（Vendor-neutral）&lt;/strong&gt; 的開源工具，用於收集與標準化遙測資料——並釐清了它「不是」什麼。我們特別強調 OpenTelemetry 並非一個一站式的可觀測性平台，而是一個強大的整合與資料收集工具。&lt;/p&gt;
&lt;p&gt;最後，我們檢視了 OpenTelemetry 如何透過提供一種統一的方式，以高度適應性且跨平台的手法來收集追蹤、指標與日誌，從而解決傳統可觀測性解決方案的局限性。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;6. 小試身手&lt;span class="hx:absolute hx:-mt-20" id="6-小試身手"&gt;&lt;/span&gt;
&lt;a href="#6-%e5%b0%8f%e8%a9%a6%e8%ba%ab%e6%89%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;問題 1&lt;span class="hx:absolute hx:-mt-20" id="問題-1"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;下列哪一項敘述最能貼切地描述可觀測性的三大支柱——&lt;strong&gt;指標 (Metrics)&lt;/strong&gt;、&lt;strong&gt;日誌 (Logs)&lt;/strong&gt; 與 &lt;strong&gt;追蹤 (Traces)&lt;/strong&gt;——如何各自協助我們理解系統的行為？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 指標 (Metrics) 提供個別錯誤的詳細解釋，日誌 (Logs) 總結整體效能，而追蹤 (Traces) 則記錄每個請求完成所需的時間。&lt;/p&gt;
&lt;p&gt;B. 追蹤 (Traces) 記錄即時 CPU 使用率，日誌 (Logs) 顯示效能趨勢，而指標 (Metrics) 則記錄請求在系統中的完整歷程。&lt;/p&gt;
&lt;p&gt;C. 指標 (Metrics) 與追蹤 (Traces) 用於記錄使用者行為，而日誌 (Logs) 則監控伺服器效能與錯誤。&lt;/p&gt;
&lt;p&gt;D. 日誌 (Logs) 捕捉用於故障排除的歷史資料，指標 (Metrics) 追蹤隨時間變化的系統效能，而追蹤 (Traces) 則跟隨請求在分散式系統中的路徑，以精準定位延遲或故障發生的位置。&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;D&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logs (日誌)：紀錄發生了什麼事 (What happened? - 歷史事件)&lt;/li&gt;
&lt;li&gt;Metrics (指標)：紀錄系統狀態與趨勢 (Is it healthy? - 數值與趨勢)&lt;/li&gt;
&lt;li&gt;Traces (追蹤)：紀錄請求的路徑與因果關係 (Where is the latency? - 分散式路徑)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;問題 2&lt;span class="hx:absolute hx:-mt-20" id="問題-2"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;OpenTelemetry 是什麼？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. OpenTelemetry 是一個針對分散式系統的完整監控與告警平台。&lt;/p&gt;
&lt;p&gt;B. OpenTelemetry 是一個針對遙測資料（日誌、指標與追蹤）的資料收集工具，並可與可觀測性平台進行整合。&lt;/p&gt;
&lt;p&gt;C. OpenTelemetry 是一個特定供應商專用的工具，用於在微服務環境中收集指標。&lt;/p&gt;
&lt;p&gt;D. OpenTelemetry 會自動最佳化（Optimize）分散式應用程式的效能。&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;B&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OpenTelemetry 專注於產生與收集資料（Telemetry），它本身不負責儲存資料後的分析與告警（那是 Backend 平台的工作，所以 A 錯）。&lt;/li&gt;
&lt;li&gt;它是供應商中立 (Vendor-neutral) 的，所以 C 錯。&lt;/li&gt;
&lt;li&gt;它是用來觀察系統的，而非主動去修改或優化系統效能，所以 D 錯。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;問題 3&lt;span class="hx:absolute hx:-mt-20" id="問題-3"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;OpenTelemetry 是一個預先設定好（Pre-configured）的監控工具，用於收集與匯出資料。&lt;/p&gt;
&lt;p&gt;正確還是錯誤？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 正確 (True)&lt;/p&gt;
&lt;p&gt;B. 錯誤 (False)&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;B&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;p&gt;OpenTelemetry 是一套用於收集與匯出資料的工具組，但它需要經過設定並與其他系統進行整合。它並不自動提供開箱即用（out-of-the-box）的監控或告警功能。&lt;/p&gt;
&lt;h3&gt;問題 4&lt;span class="hx:absolute hx:-mt-20" id="問題-4"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;情境&lt;/p&gt;
&lt;p&gt;貴公司的 Web 應用程式正面臨回應速度變慢的問題，但該系統是由多個&lt;strong&gt;微服務 (Microservices)&lt;/strong&gt; 所建構。每個服務都會產生自己的&lt;strong&gt;日誌 (Logs)&lt;/strong&gt;、&lt;strong&gt;指標 (Metrics)&lt;/strong&gt; 和&lt;strong&gt;追蹤 (Traces)&lt;/strong&gt;，但這些資料皆各自獨立儲存，缺乏跨所有服務的&lt;strong&gt;統一視圖 (Unified view)&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;問題&lt;/p&gt;
&lt;p&gt;在嘗試找出並修復此問題時，您最可能面臨的主要挑戰是什麼？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 來自每個服務的資料會發生衝突，導致無法採信任何日誌或指標。&lt;/p&gt;
&lt;p&gt;B. 當偵測到效能問題時，每個服務會停止產生日誌，導致無法進行故障排除。&lt;/p&gt;
&lt;p&gt;C. 難以將跨服務的資訊進行關聯 (Correlate)，這使得難以追蹤請求的流向，或無法精準定位 (Pinpoint)問題發生的位置。&lt;/p&gt;
&lt;p&gt;D. 您將無法同時存取所有服務的日誌，導致在識別根本原因 (Root cause) 時產生延遲。&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;C&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A: 資料通常不會衝突，只是分散而已。&lt;/li&gt;
&lt;li&gt;B: 系統通常不會因為效能差就停止寫 Log（反而可能寫更多錯誤 Log）。&lt;/li&gt;
&lt;li&gt;C: 遙測資料孤島化 (Siloed telemetry) 意指日誌、指標與追蹤是針對個別服務分開儲存的，這使得難以看清請求在系統中流動的完整全貌。這種缺乏整合的情況，會導致在識別效能問題或錯誤時，增加複雜度並造成延誤。&lt;/li&gt;
&lt;li&gt;D: 「無法同時存取」通常是指權限或工具介面問題，但在這個情境下，真正的痛點不是「讀不到」，而是讀到了卻「看不出彼此的關係」。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>OpenTelemetry 框架概述</title><link>https://blog.kubeantony.com/archive/ops-automation/opentelemetry-%E6%A1%86%E6%9E%B6%E6%A6%82%E8%BF%B0/</link><pubDate>Tue, 16 Dec 2025 19:41:46 +0800</pubDate><guid>https://blog.kubeantony.com/archive/ops-automation/opentelemetry-%E6%A1%86%E6%9E%B6%E6%A6%82%E8%BF%B0/</guid><description>
&lt;h2&gt;0. Preface&lt;span class="hx:absolute hx:-mt-20" id="0-preface"&gt;&lt;/span&gt;
&lt;a href="#0-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章是翻譯 Getting Started with OpenTelemetry (LFS148) 的第三章節，想看原文可參考以下網址：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#"target="_blank" rel="noopener"&gt;https://training.linuxfoundation.org/training/getting-started-with-opentelemetry-lfs148/#&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;
&lt;h2&gt;1. 學習目標在本章結束後，您應該能夠：&lt;span class="hx:absolute hx:-mt-20" id="1-學習目標在本章結束後您應該能夠"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%ad%b8%e7%bf%92%e7%9b%ae%e6%a8%99%e5%9c%a8%e6%9c%ac%e7%ab%a0%e7%b5%90%e6%9d%9f%e5%be%8c%e6%82%a8%e6%87%89%e8%a9%b2%e8%83%bd%e5%a4%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;解釋 &lt;strong&gt;OpenTelemetry 訊號規範 (Signal Specification)&lt;/strong&gt; 的目的，以及它如何確保跨語言和跨平台的一致性。&lt;/li&gt;
&lt;li&gt;描述 &lt;strong&gt;OTel SDK&lt;/strong&gt; 和 &lt;strong&gt;API&lt;/strong&gt; 規範，以及&lt;strong&gt;語意約定 (Semantic Conventions)&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;探討&lt;strong&gt;供應商中立 (Vendor-Agnostic) 的儀表化 (Instrumentation)&lt;/strong&gt; 概念，重點在於 OpenTelemetry 如何提供針對特定語言的儀表化功能，包含不同的儀表化層級。&lt;/li&gt;
&lt;li&gt;解釋 &lt;strong&gt;OpenTelemetry Collector&lt;/strong&gt; 作為&lt;strong&gt;遙測數據處理器 (Telemetry Processor)&lt;/strong&gt; 的角色，以及它如何協助處理與匯出遙測數據。&lt;/li&gt;
&lt;li&gt;探討 &lt;strong&gt;OTLP (OpenTelemetry Protocol)&lt;/strong&gt;，說明其作為傳輸遙測數據之&lt;strong&gt;傳輸協定 (Wire Protocol)&lt;/strong&gt; 的重要性，以及其在標準化不同元件間通訊的角色。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. Signal Specification 訊號規範 (Language-Agnostic / 跨語言通用)&lt;span class="hx:absolute hx:-mt-20" id="2-signal-specification-訊號規範-language-agnostic--跨語言通用"&gt;&lt;/span&gt;
&lt;a href="#2-signal-specification-%e8%a8%8a%e8%99%9f%e8%a6%8f%e7%af%84-language-agnostic--%e8%b7%a8%e8%aa%9e%e8%a8%80%e9%80%9a%e7%94%a8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;從宏觀角度來看，OpenTelemetry 是由各種 &lt;strong&gt;訊號 (Signals)&lt;/strong&gt; 所組成的，主要包含 &lt;strong&gt;Tracing (追蹤)&lt;/strong&gt;、&lt;strong&gt;Metrics (指標)&lt;/strong&gt; 和 &lt;strong&gt;Logging (日誌)&lt;/strong&gt;。每一個訊號都是作為獨立的元件進行開發（但仍有方法可以將彼此的資料流串接起來）。&lt;/p&gt;
&lt;p&gt;這些訊號都被定義在 OpenTelemetry 的「&lt;a
href="https://opentelemetry.io/docs/specs/"target="_blank" rel="noopener"&gt;跨語言規範 (Language-Agnostic Specification)&lt;/a&gt;」中，這也是整個專案的核心所在。雖然終端使用者 (End-user) 可能不會直接接觸到這份規範，但它對於確保 OpenTelemetry 生態系中的一致性 (Consistency) 與互通性 (Interoperability) 扮演著至關重要的角色。&lt;/p&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/B1lwsmy7-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;OpenTelemetry Specification (Language Agnostic)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;這份規範主要由三個部分組成。首先是&lt;a
href="https://opentelemetry.io/docs/specs/otel/glossary/"target="_blank" rel="noopener"&gt;術語定義&lt;/a&gt;，旨在建立共同的詞彙與認知，以避免混淆。其次，它詳述了每個訊號的技術設計細節。這包含：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;API 規範&lt;/strong&gt; (請參閱 &lt;a
href="https://opentelemetry.io/docs/specs/otel/trace/api/"target="_blank" rel="noopener"&gt;Tracing API&lt;/a&gt;, &lt;a
href="https://opentelemetry.io/docs/specs/otel/metrics/api/"target="_blank" rel="noopener"&gt;Metrics API&lt;/a&gt; 和 &lt;a
href="https://opentelemetry.io/docs/specs/otel/logs/"target="_blank" rel="noopener"&gt;OpenTelemetry Logging&lt;/a&gt;)
&lt;ul&gt;
&lt;li&gt;定義實作 (Implementations) 必須遵守的（概念性）介面。&lt;/li&gt;
&lt;li&gt;確保各個實作之間彼此相容。&lt;/li&gt;
&lt;li&gt;包含可用於產生、處理及匯出遙測數據 (Telemetry data) 的方法。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SDK 規範&lt;/strong&gt; (請參閱 &lt;a
href="https://opentelemetry.io/docs/specs/otel/trace/sdk/"target="_blank" rel="noopener"&gt;Tracing SDK&lt;/a&gt;, &lt;a
href="https://opentelemetry.io/docs/specs/otel/metrics/sdk/"target="_blank" rel="noopener"&gt;Metrics SDK&lt;/a&gt;, &lt;a
href="https://opentelemetry.io/docs/specs/otel/logs/sdk/"target="_blank" rel="noopener"&gt;Logs SDK&lt;/a&gt;)
&lt;ul&gt;
&lt;li&gt;作為開發人員的指引。&lt;/li&gt;
&lt;li&gt;定義特定語言的 API 實作必須滿足哪些需求才能符合標準 (Compliant)。&lt;/li&gt;
&lt;li&gt;包含關於遙測數據的設定 (Configuration)、處理和匯出的相關概念。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;除了訊號架構之外，該規範也涵蓋了與遙測數據相關的面向。例如，OpenTelemetry 定義了 &lt;strong&gt;&lt;a
href="https://opentelemetry.io/docs/specs/semconv/"target="_blank" rel="noopener"&gt;語意約定 (Semantic Conventions)&lt;/a&gt;&lt;/strong&gt;。透過推動通用遙測 Metadata 在命名與解釋上的一致性，OpenTelemetry 旨在減少對來自不同來源的數據進行「正規化 (Normalize)」的需求。&lt;/p&gt;
&lt;p&gt;最後，規範中還包含了 &lt;strong&gt;&lt;a
href="https://opentelemetry.io/docs/specs/otlp/"target="_blank" rel="noopener"&gt;OpenTelemetry Protocol (OTLP)&lt;/a&gt;&lt;/strong&gt;，我們將在本章稍後進行探討。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;3. 供應商中立、針對特定語言的儀表化 (Instrumentation)&lt;span class="hx:absolute hx:-mt-20" id="3-供應商中立針對特定語言的儀表化-instrumentation"&gt;&lt;/span&gt;
&lt;a href="#3-%e4%be%9b%e6%87%89%e5%95%86%e4%b8%ad%e7%ab%8b%e9%87%9d%e5%b0%8d%e7%89%b9%e5%ae%9a%e8%aa%9e%e8%a8%80%e7%9a%84%e5%84%80%e8%a1%a8%e5%8c%96-instrumentation" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/BJbJ0Xkm-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Generate and Emit Telemetry via the OTel API and SDK Packages&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;為了從應用程式中產生並發送遙測數據 (Telemetry)，我們使用遵循 OpenTelemetry 規範的「特定語言實作 (Language-specific implementations)」。OpenTelemetry 支援多種熱門的&lt;a
href="https://opentelemetry.io/docs/languages/#status-and-releases"target="_blank" rel="noopener"&gt;程式語言&lt;/a&gt;，且各語言的支援成熟度 (Maturity) 亦有所不同。一個訊號 (Signal) 的實作包含兩個部分：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;API&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;定義規範中列出的介面 (Interfaces) 與常數。&lt;/li&gt;
&lt;li&gt;供應用程式與函式庫開發者使用，以進行供應商中立 (Vendor-agnostic) 的儀表化。&lt;/li&gt;
&lt;li&gt;預設指向一個「無操作 (no-op)」的實作（即呼叫後不會執行任何動作）。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SDK&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;實作了 OpenTelemetry API 的提供者 (Provider)。&lt;/li&gt;
&lt;li&gt;包含產生、處理並發送遙測數據的實際邏輯。&lt;/li&gt;
&lt;li&gt;OpenTelemetry 隨附了官方提供者作為「參考實作 (Reference Implementation)」（通常直接稱為 SDK）。&lt;/li&gt;
&lt;li&gt;您也可以自行撰寫 SDK。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;一般來說，我們使用 OpenTelemetry API 將儀表化功能加入原始碼中。實際上，這可以透過多種方式達成，例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;零程式碼 (Zero-code) 或自動儀表化 (Automatic Instrumentation)&lt;/strong&gt;（若可用，且為了避免修改程式碼）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;儀表化函式庫 (Instrumentation Libraries)&lt;/strong&gt; 提供簡化版 OpenTelemetry 整合的函式庫（可能需要或不需要修改程式碼）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;手動或基於程式碼的儀表化 (Manual Instrumentation)&lt;/strong&gt;（為了精細的控制，並深度嵌入程式碼中）。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;目前我們先跳過細節，專注於為何 OpenTelemetry 決定將 &lt;strong&gt;API&lt;/strong&gt; 與 &lt;strong&gt;SDK&lt;/strong&gt; 分離。在啟動時，應用程式會為每種類型的訊號註冊一個提供者 (Provider)。之後，對 API 的呼叫會被轉送 (Forwarded) 給相應的提供者。如果我們沒有明確註冊，OpenTelemetry 將使用一個備援 (Fallback) 提供者，將 API 呼叫轉換為無操作 (no-ops)。&lt;/p&gt;
&lt;p&gt;將 API 與 SDK 分離的主要原因，是為了讓開源函式庫更容易嵌入&lt;strong&gt;原生儀表化 (Native Instrumentation)&lt;/strong&gt; 功能。OpenTelemetry 的 API 被設計為輕量級且可安全依賴 (Safe to depend on)。相對地，由 SDK 提供的訊號實作則明顯複雜許多，且很可能包含對其他軟體的依賴 (Dependencies)。若強制使用者接受這些依賴，可能會導致與其特定的軟體環境 (Software stack) 發生衝突。&lt;/p&gt;
&lt;p&gt;透過在初始設定期間註冊提供者，允許使用者藉由選擇不同的實作來解決依賴衝突。此外，這讓我們能發布內建&lt;strong&gt;可觀測性 (Observability)&lt;/strong&gt; 的軟體，而不會將儀表化的執行成本 (Runtime cost) 強加給不需要的使用者。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;4. 遙測數據處理器（獨立元件）Telemetry Processor (Standalone Component)&lt;span class="hx:absolute hx:-mt-20" id="4-遙測數據處理器獨立元件telemetry-processor-standalone-component"&gt;&lt;/span&gt;
&lt;a href="#4-%e9%81%99%e6%b8%ac%e6%95%b8%e6%93%9a%e8%99%95%e7%90%86%e5%99%a8%e7%8d%a8%e7%ab%8b%e5%85%83%e4%bb%b6telemetry-processor-standalone-component" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/ry4lxEymWg.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;到目前為止，我們已經看到 OpenTelemetry 為應用程式與函式庫開發者提供了&lt;strong&gt;供應商中立 (Vendor-agnostic)&lt;/strong&gt; 的儀表化工具。光是這一點就是一個重大的里程碑，但 OpenTelemetry 框架所涵蓋的範圍不僅止於此。&lt;/p&gt;
&lt;p&gt;在產生並發送遙測數據 (Telemetry) 後，&lt;strong&gt;維運人員 (Operators)&lt;/strong&gt; 負責管理這些數據，並將其&lt;strong&gt;攝取 (Ingest)&lt;/strong&gt; 到各自的後端系統中。這包含了以下任務：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;從各種來源收集數據。&lt;/li&gt;
&lt;li&gt;解析數據並進行轉換，以供下游處理。&lt;/li&gt;
&lt;li&gt;使用額外的 Metadata 進行&lt;strong&gt;豐富化 (Enrichment)&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;過濾掉不相關的數據，以減少雜訊並降低儲存需求。&lt;/li&gt;
&lt;li&gt;進行&lt;strong&gt;正規化 (Normalization)&lt;/strong&gt; 並套用轉換。&lt;/li&gt;
&lt;li&gt;進行&lt;strong&gt;緩衝 (Buffering)&lt;/strong&gt; 以提升&lt;strong&gt;韌性 (Resilience)&lt;/strong&gt; 與效能。&lt;/li&gt;
&lt;li&gt;進行&lt;strong&gt;路由 (Routing)&lt;/strong&gt;，將部分遙測數據引導至不同的目的地。&lt;/li&gt;
&lt;li&gt;轉送至後端系統。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;為了建構並設定這類遙測數據&lt;strong&gt;管線 (Pipelines)&lt;/strong&gt;，維運團隊通常會部署額外的基礎設施。一個常見的例子是 &lt;a
href="https://fluentbit.io/"target="_blank" rel="noopener"&gt;fluentbit&lt;/a&gt; 遙測代理程式 (Agent)。同樣地，OpenTelemetry 提供了一個具備這些能力的獨立元件：&lt;strong&gt;&lt;a
href="https://opentelemetry.io/docs/collector/"target="_blank" rel="noopener"&gt;OpenTelemetry Collector&lt;/a&gt;&lt;/strong&gt;。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;5. 傳輸協定 (Wire Protocol)&lt;span class="hx:absolute hx:-mt-20" id="5-傳輸協定-wire-protocol"&gt;&lt;/span&gt;
&lt;a href="#5-%e5%82%b3%e8%bc%b8%e5%8d%94%e5%ae%9a-wire-protocol" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;為了完善標準化、數據產生及管理的整套方案，OpenTelemetry 也定義了如何在生產者 (Producers)、代理程式 (Agents) 和後端 (Backends) 之間傳輸遙測數據。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a
href="https://opentelemetry.io/docs/specs/otel/protocol/"target="_blank" rel="noopener"&gt;OpenTelemetry Protocol (OTLP)&lt;/a&gt;&lt;/strong&gt; 是一個開源且&lt;strong&gt;供應商中立 (Vendor-neutral)&lt;/strong&gt; 的&lt;strong&gt;傳輸格式 (Wire format)&lt;/strong&gt;，它定義了：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;數據如何在記憶體中被編碼。&lt;/li&gt;
&lt;li&gt;用於在網路上傳輸該數據的協定。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;因此，OTLP 被廣泛應用於整個&lt;strong&gt;可觀測性堆疊 (Observability stack)&lt;/strong&gt; 中。以 OTLP 格式發送遙測數據，意味著&lt;strong&gt;已儀表化 (Instrumented)&lt;/strong&gt; 的應用程式與第三方服務，能與無數的可觀測性解決方案相容。&lt;/p&gt;
&lt;p&gt;雖然 Collector 支援接收來自各種格式的遙測數據，也能匯出成各種格式（例如：Prometheus Metrics, Zipkin traces 等），但通常會優先選擇 OTLP，因為 Collector 內部正是使用 OTLP 來表示與處理遙測數據。藉此，我們避免了格式轉換的成本，並提升了一致性。這是因為該原生格式與框架提出的理念緊密契合（例如屬性遵循&lt;strong&gt;語意約定&lt;/strong&gt;、跨訊號關聯等）。&lt;/p&gt;
&lt;p&gt;同樣地，大多數可觀測性後端都&lt;strong&gt;開箱即用 (Right out of the box)&lt;/strong&gt; 地支援 OTLP。鑑於 OpenTelemetry 的快速普及，整合 OTLP 能讓你自動觸及廣大的潛在使用者群體。此外，一個開源且供應商中立的遙測協定，意味著可觀測性工具開發者的工作量更少。以前，你必須開發無數的&lt;strong&gt;轉接器 (Adapters)&lt;/strong&gt;，才能&lt;strong&gt;攝取 (Ingest)&lt;/strong&gt; 以各種&lt;strong&gt;專有格式 (Proprietary formats)&lt;/strong&gt; 傳來的數據。換句話說，OTLP 大力推動了可觀測性生態系中工具與服務間的&lt;strong&gt;互通性 (Interoperability)&lt;/strong&gt;。&lt;/p&gt;
&lt;p&gt;OTLP 提供了三種用於傳輸遙測數據的傳輸機制：HTTP/1.1、HTTP/2 和 gRPC。使用 OTLP 時，傳輸機制的選擇取決於應用程式需求，需考量效能、可靠性與安全性等因素。&lt;/p&gt;
&lt;p&gt;OTLP 數據通常使用 &lt;strong&gt;Protocol Buffers (Protobuf)&lt;/strong&gt; 二進位格式進行編碼，該格式精簡且網路傳輸效率高，並支援&lt;strong&gt;模式演進 (Schema Evolution)&lt;/strong&gt;，允許在不破壞相容性的情況下修改未來的資料模型。數據也可以編碼為 JSON 格式，這提供了&lt;strong&gt;人類可讀 (Human-readable)&lt;/strong&gt; 的格式，但缺點是網路流量較高且檔案較大。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;6. 章節總結&lt;span class="hx:absolute hx:-mt-20" id="6-章節總結"&gt;&lt;/span&gt;
&lt;a href="#6-%e7%ab%a0%e7%af%80%e7%b8%bd%e7%b5%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;在本章中，我們探討了 &lt;strong&gt;OpenTelemetry 框架&lt;/strong&gt;的關鍵元件，涵蓋了它如何提供一種統一的方法來收集與傳輸遙測數據 (Telemetry data)。&lt;/p&gt;
&lt;p&gt;我們首先探討了 &lt;strong&gt;訊號規範 (Signal Specification)&lt;/strong&gt;，它是跨語言通用 (Language-agnostic) 的，確保了在不同平台與語言之間，定義和收集遙測數據（Log、Metric、Trace）的一致性。&lt;/p&gt;
&lt;p&gt;接著，我們討論了 &lt;strong&gt;供應商中立的儀表化 (Vendor-Agnostic Instrumentation)&lt;/strong&gt;，強調 OpenTelemetry 如何在特定程式語言中實現遙測數據的收集，同時保持獨立性，不被任何特定供應商的可觀測性工具組所綁定。&lt;/p&gt;
&lt;p&gt;隨後，我們檢視了 &lt;strong&gt;OpenTelemetry Collector&lt;/strong&gt; 作為&lt;strong&gt;遙測數據處理器 (Telemetry Processor)&lt;/strong&gt; 的角色，詳細說明它如何處理、轉換並匯出遙測數據至各種後端 (Backends)，讓管理可觀測性數據&lt;strong&gt;管線 (Pipelines)&lt;/strong&gt; 更具彈性。&lt;/p&gt;
&lt;p&gt;此外，我們介紹了 &lt;strong&gt;OTLP (OpenTelemetry Protocol)&lt;/strong&gt;，它標準化了整個系統中的遙測數據傳輸，確保不同元件之間能有可靠的通訊。&lt;/p&gt;
&lt;p&gt;最後，我們提及了 &lt;strong&gt;OTel SDK&lt;/strong&gt; 與 &lt;strong&gt;API 規範&lt;/strong&gt;的重要性，它們定義了開發者如何與 OpenTelemetry 互動；以及 &lt;strong&gt;語意約定 (Semantic Conventions)&lt;/strong&gt;，它為遙測數據提供一致的標籤 (Labeling) 與結構，提升了所收集資訊的清晰度與實用性。&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;7. 小試身手&lt;span class="hx:absolute hx:-mt-20" id="7-小試身手"&gt;&lt;/span&gt;
&lt;a href="#7-%e5%b0%8f%e8%a9%a6%e8%ba%ab%e6%89%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;問題 1&lt;span class="hx:absolute hx:-mt-20" id="問題-1"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-1" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;OpenTelemetry 訊號規範 (Signal Specification) 的目的是什麼？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 指定使用 OpenTelemetry 的供應商需求 (Vendor requirements)&lt;/p&gt;
&lt;p&gt;B. 定義針對特定語言 (Language-specific) 的 Tracing (追蹤) 協定&lt;/p&gt;
&lt;p&gt;C. 提供一種一致且跨語言通用 (Language-agnostic) 的遙測數據收集方法&lt;/p&gt;
&lt;p&gt;D. 建立自定義訊號以監控網路流量&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;C&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;跨語言通用 (Language-Agnostic)&lt;/strong&gt;：
本文中明確提到「Signals are defined inside OpenTelemetry’s &lt;strong&gt;language-agnostic specification&lt;/strong&gt;（訊號定義在 OpenTelemetry 的跨語言規範中）」。這表示規範本身不綁定特定語言，而是作為一個通用的標準，讓各種程式語言（如 Java, Python, Go）的實作去遵循。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;一致性 (Consistency)&lt;/strong&gt;：
本文中提到該規範的角色是「ensuring &lt;strong&gt;consistency&lt;/strong&gt; and interoperability（確保一致性與互通性）」。這正是選項 c 中提到的重點。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;為什麼其他選項不正確？&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A. 指定使用 OpenTelemetry 的供應商需求&lt;/strong&gt;：OpenTelemetry 的核心原則是「供應商中立 (Vendor-Agnostic)」，目的是&lt;strong&gt;不被&lt;/strong&gt;特定廠商綁定，而不是為了制定廠商的需求。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;B. 定義針對特定語言的 Tracing 協定&lt;/strong&gt;：規範本身是&lt;strong&gt;跨語言通用 (Language-Agnostic)&lt;/strong&gt; 的，而不是針對特定語言 (Language-specific)。「特定語言」的部分是在 SDK 實作層面，而非核心規範層面。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;D. 建立自定義訊號以監控網路流量&lt;/strong&gt;：雖然 OpenTelemetry 可以用於監控，但訊號規範的主要目的在於定義標準的三大訊號（Tracing, Metrics, Logging），而非專注於建立「監控網路流量的自定義訊號」。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;問題 2&lt;span class="hx:absolute hx:-mt-20" id="問題-2"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-2" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;OpenTelemetry 中的供應商中立儀表化 (Vendor-Agnostic Instrumentation) 如何讓開發者受益？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 它確保所有儀表化都在應用程式層級 (Application level) 處理
B. 它支援跨不同程式語言的自動 (Automatic) 與手動 (Manual) 儀表化
C. 它將儀表化僅限於高階效能指標
D. 它提供針對各家雲端供應商 (Cloud Provider) 的預建儀表化功能&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;B&lt;/p&gt;
&lt;p&gt;here is why:&lt;/p&gt;
&lt;p&gt;根據前文「Vendor-Agnostic, Language-Specific Instrumentation」章節的內容：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;支援多種模式&lt;/strong&gt;：文中明確提到儀表化可以透過「零程式碼或自動儀表化 (zero-code or automatic instrumentation)」以及「手動或基於程式碼的儀表化 (manual or code-based instrumentation)」來達成。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;跨語言支援&lt;/strong&gt;：文中提到 OTel 支援「廣泛的熱門程式語言 (wide-range of popular programming languages)」。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;供應商中立&lt;/strong&gt;：選項 D 提到「針對特定雲端供應商」，這與 Vendor-Agnostic（不被廠商綁定）的核心精神相違背。OTel 的目的是讓你的程式碼不依賴特定廠商的 SDK。&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;問題 3&lt;span class="hx:absolute hx:-mt-20" id="問題-3"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%8f%e9%a1%8c-3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;OpenTelemetry 中的語意約定 (Semantic Conventions) 是什麼？&lt;/p&gt;
&lt;div class="indent-title-1"&gt;
&lt;p&gt;A. 用於透過網際網路傳輸遙測數據的預定義格式
B. 僅用於 OpenTelemetry 日誌中的自定義命名慣例
C. 一種透過機器學習演算法處理追蹤 (Traces) 的方法
D. 一套用於一致地組織與標記 (Labeling) 遙測數據的規則&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;D&lt;/p&gt;
&lt;p&gt;根據前文「Signal Specification」章節的內容：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;定義與目的&lt;/strong&gt;：文中提到 OpenTelemetry 定義語意約定是為了推動「通用遙測 Metadata 在命名與解釋上的一致性 (consistency in the naming and interpretation of common telemetry metadata)」。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;減少正規化需求&lt;/strong&gt;：透過這些規則，目的是減少對來自不同來源的數據進行正規化的需求，讓數據結構標準化。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;為什麼其他選項不正確？&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A. 傳輸格式&lt;/strong&gt;：這是 &lt;strong&gt;OTLP (OpenTelemetry Protocol)&lt;/strong&gt; 的功能，屬於傳輸協定 (Wire Protocol) 的範疇。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;B. 僅用於日誌&lt;/strong&gt;：語意約定適用於&lt;strong&gt;所有&lt;/strong&gt;訊號（Tracing, Metrics 和 Logging），並非僅限於日誌。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C. 機器學習&lt;/strong&gt;：這與語意約定的定義完全無關。&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>HA K8s Control-plane components 之間如何運作？</title><link>https://blog.kubeantony.com/archive/kubernetes/ha-k8s-control-plane-components-%E4%B9%8B%E9%96%93%E5%A6%82%E4%BD%95%E9%81%8B%E4%BD%9C/</link><pubDate>Tue, 09 Dec 2025 11:50:46 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/ha-k8s-control-plane-components-%E4%B9%8B%E9%96%93%E5%A6%82%E4%BD%95%E9%81%8B%E4%BD%9C/</guid><description>
&lt;h2&gt;1. Preface&lt;span class="hx:absolute hx:-mt-20" id="1-preface"&gt;&lt;/span&gt;
&lt;a href="#1-preface" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;本篇文章會深度探討在高可用的 Kubernetes 叢集中，Control-plane nodes 上的 Components (kube-apiserver, etcd, &amp;hellip;等)之間會如何運作，並借由 &lt;code&gt;kubectl create&lt;/code&gt; 建立一個 &lt;code&gt;Deployment&lt;/code&gt; 來實踐理論。&lt;/p&gt;
&lt;h2&gt;2. 先備知識&lt;span class="hx:absolute hx:-mt-20" id="2-先備知識"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%85%88%e5%82%99%e7%9f%a5%e8%ad%98" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/rJXu0rHz-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;由以上 K8s 官網文件中的叢集架構圖可以看到單一台 Control-plane 內部的元件有 4 個，讓我們先來認識他們：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kube-apiserver&lt;/code&gt; : 負責接受前端管理者透過 CLI ( Command Line Interface, 命令模式 ) 或是在 Web UI 上面點點選選的方式下達的命令，並且 &lt;code&gt;kube-controller-manager&lt;/code&gt; 和 &lt;code&gt;kube-scheduler&lt;/code&gt; 要正常運作也需要對它呼叫 API Request。
&lt;ul&gt;
&lt;li&gt;在接收到 API Request 後，還會對這個 request 進行身份的驗證，並確保該身份有足夠的權限可以執行 request 內要做的動作。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kube-controller-manager&lt;/code&gt;：負責維護 K8s 叢集的狀態，它會試圖將當前叢集狀態移動到更接近所需狀態的地方，例如偵測節點是否故障、偵測 Pod 是否毀損等，並作出回應，此時期望的狀態是節點跟 pod 是否處於健康，Controller-manager 會去確認這些狀態，並在故障時做出對應的處理。
&lt;ul&gt;
&lt;li&gt;在這個元件裡面內定會執行很多個 controller processes。從邏輯上講，每個 controller 都是一個單獨的程序，但是為了降低複雜性，它們都被編譯到同一個可執行檔案，並在一個程序中執行，所以它會被稱為 manager。&lt;/li&gt;
&lt;li&gt;controller process 可以想像成執行 bash script while true 迴圈的一個程序，裡面會去比對 node, pod, &amp;hellip;等物件當前的狀態與期望的狀態是否一致。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;kube-scheduler&lt;/code&gt; : 負責監控新建立的 Pod ，選擇出最適合的節點讓 Pod 在上面運作。排程決策會有兩個階段，
&lt;ol&gt;
&lt;li&gt;Predicates (過濾) 階段：會先根據 pod 的規格檢查有哪些節點有足夠的硬體資源適合執行這個 pod。&lt;/li&gt;
&lt;li&gt;Priorities（評分) 階段：負責對通過 Predicates 的節點進行評分 (0-10 分），最終選擇分數最高的節點。&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;etcd&lt;/code&gt;：負責儲存 K8s 叢集的狀態，也就是 K8s 運作時產生的重要資料都會&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/Hk6_WnzM-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;</description></item><item><title>Running Nginx with Kubernetes Restricted Pod Security Standards</title><link>https://blog.kubeantony.com/archive/kubernetes/running-nginx-with-kubernetes-restricted-pod-security-standards/</link><pubDate>Fri, 05 Dec 2025 14:11:54 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/running-nginx-with-kubernetes-restricted-pod-security-standards/</guid><description>
&lt;h2&gt;1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="1-先決條件"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;K8s 已安裝完畢&lt;/li&gt;
&lt;li&gt;請使用 &lt;code&gt;kubernetes-admin&lt;/code&gt; 的 user 操作 K8s&lt;/li&gt;
&lt;li&gt;作業系統已安裝 &lt;code&gt;podman&lt;/code&gt;，並且可以上網&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 建立 Nginx App Container Image&lt;span class="hx:absolute hx:-mt-20" id="2-建立-nginx-app-container-image"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%bb%ba%e7%ab%8b-nginx-app-container-image" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;創建並切換工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p &amp;#34;$HOME&amp;#34;/wulin/nginx; cd &amp;#34;$HOME&amp;#34;/wulin/nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;撰寫 Dockerfile&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano Dockerfile&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 使用輕量版 Alpine 且包含 OpenTelemetry 支援的 Nginx 基礎映像
FROM docker.io/library/nginx:1.29.3-alpine-otel
# 定義參數
ARG user=bigred
ARG uid=1001
ARG gid=1001
ARG port=8080
# 合併 RUN 指令以減少圖層 (Layers) 並縮小體積
# 使用 set -e 確保任何指令失敗時停止建置
RUN set -e &amp;amp;&amp;amp; \
# 1. 新增使用者與群組
addgroup -g ${gid} -S ${user} &amp;amp;&amp;amp; \
adduser -u ${uid} -S -G ${user} ${user} &amp;amp;&amp;amp; \
# 2. 建立必要的暫存與 PID 目錄
mkdir -p /var/run/nginx \
/var/cache/nginx/client_temp \
/var/cache/nginx/proxy_temp \
/var/cache/nginx/fastcgi_temp \
/var/cache/nginx/scgi_temp \
/var/cache/nginx/uwsgi_temp &amp;amp;&amp;amp; \
# 3. 修改設定檔
sed -i -E &amp;#34;s/listen\s&amp;#43;80;/listen ${port};/g&amp;#34; /etc/nginx/conf.d/default.conf &amp;amp;&amp;amp; \
sed -i &amp;#34;s|/var/run/nginx.pid|/var/run/nginx/nginx.pid|g&amp;#34; /etc/nginx/nginx.conf &amp;amp;&amp;amp; \
# 4. 權限調整
chown -R ${uid}:${gid} \
/var/cache/nginx \
/var/run/nginx \
/var/log/nginx \
/run &amp;amp;&amp;amp; \
# 5. 清理不必要的暫存檔 (Alpine 特性，若有安裝套件時使用)
rm -rf /tmp/*
# 定義 run 成 app container 後內定執行的使用者
USER ${user}
# 宣告對外開的 tcp port number
EXPOSE ${port}
# 定義 run 成 app container 後內定執行的啟動命令
CMD [&amp;#34;nginx&amp;#34;, &amp;#34;-g&amp;#34;, &amp;#34;daemon off;&amp;#34;]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 App Container Image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman build --build-arg user=bigred \
--build-arg uid=1001 \
--build-arg gid=1001 \
--build-arg port=8080 \
--squash \
--tag nginx:1.29.3-alpine-otel-nonroot .&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;執行 Nginx App Container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman run --name nginx \
--detach \
--publish 8080:8080 \
localhost/nginx:1.29.3-alpine-otel-nonroot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 App Container 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman ps -a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
28bde4893f9b localhost/nginx:1.29.3-alpine-otel-nonroot nginx -g daemon o... 1 second ago Up 2 seconds 0.0.0.0:8080-&amp;gt;8080/tcp nginx&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證 Nginx 網站是否可以正常連接&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sI localhost:8080 | head -n 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;登入 quay.io&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman login quay.io&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 Nginx Image tag&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman tag localhost/nginx:1.29.3-alpine-otel-nonroot quay.io/hahappyman/nginx:1.29.3-alpine-otel-nonroot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 Nginx Image 上傳到 quay.io&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman push quay.io/hahappyman/nginx:1.29.3-alpine-otel-nonroot&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 設定 Namespace 強制執行 &lt;code&gt;Restricted&lt;/code&gt; Pod Security Standards (PSS)&lt;span class="hx:absolute hx:-mt-20" id="3-設定-namespace-強制執行-restricted-pod-security-standards-pss"&gt;&lt;/span&gt;
&lt;a href="#3-%e8%a8%ad%e5%ae%9a-namespace-%e5%bc%b7%e5%88%b6%e5%9f%b7%e8%a1%8c-restricted-pod-security-standards-pss" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 namespace&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl create ns mytest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 Namespace 強制執行 &lt;code&gt;Restricted&lt;/code&gt; Pod Security Standards&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl label --overwrite ns mytest \
pod-security.kubernetes.io/enforce=restricted \
pod-security.kubernetes.io/enforce-version=v1.34&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視是否成功&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl describe ns mytest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Name: mytest
Labels: kubernetes.io/metadata.name=mytest
pod-security.kubernetes.io/enforce=restricted
pod-security.kubernetes.io/enforce-version=v1.34
Annotations: &amp;lt;none&amp;gt;
Status: Active
No resource quota.
No LimitRange resource.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 將 Nginx 部署至強制執行 &lt;code&gt;Restricted&lt;/code&gt; PSS 的 namespace&lt;span class="hx:absolute hx:-mt-20" id="4-將-nginx-部署至強制執行-restricted-pss-的-namespace"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%b0%87-nginx-%e9%83%a8%e7%bd%b2%e8%87%b3%e5%bc%b7%e5%88%b6%e5%9f%b7%e8%a1%8c-restricted-pss-%e7%9a%84-namespace" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;撰寫 nginx pod yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano nginx-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
name: restricted-nginx-pod
namespace: mytest
labels:
app: restricted-nginx
spec:
containers:
- name: restricted-nginx-container
image: quay.io/hahappyman/nginx:1.29.3-alpine-otel-nonroot
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- &amp;#34;ALL&amp;#34;
runAsNonRoot: true
runAsUser: 1001
seccompProfile:
type: &amp;#34;RuntimeDefault&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color=red&gt;注意，&lt;code&gt;runAsNonRoot&lt;/code&gt; 會用 user id 判斷 App Container 是否有透過非 root 的帳號去執行，所以當 App Container image 內定執行的使用者指定的是 user name 不是 user id，就必須要再額外設定 &lt;code&gt;runAsUser&lt;/code&gt; 指定 &lt;code&gt;uid&lt;/code&gt; 去執行，否則你會遇到以下錯誤訊息：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Error: container has runAsNonRoot and image has non-numeric user (bigred), cannot verify user is non-root (pod: &amp;#34;restricted-nginx-pod_mytest(d40b3343-1027-48c2-9b7d-e9acac1c7524)&amp;#34;, container: restricted-nginx-container)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/font&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 Nginx Pod&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl apply -f nginx-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;pod/restricted-nginx-pod created&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Nginx Pod 運作狀態是否正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl -n mytest get pods -o wide&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
restricted-nginx-pod 1/1 Running 0 22s 10.244.3.113 kubeadm-w1 &amp;lt;none&amp;gt; &amp;lt;none&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;驗證網站是否能正常連線&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -sI http://10.244.3.113:8080 | head -n 1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HTTP/1.1 200 OK&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在 nginx 所在的 worker node 上查詢 container user uid&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo crictl inspect --name restricted-nginx-container | jq &amp;#39;.info.runtimeSpec.process.user.uid&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;1001&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Install Gitlab CE using Podman Pod</title><link>https://blog.kubeantony.com/archive/container/install-gitlab-ce-using-podman-pod/</link><pubDate>Mon, 01 Dec 2025 01:45:02 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/install-gitlab-ce-using-podman-pod/</guid><description>
&lt;h2&gt;1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="1-先決條件"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;已安裝好 &lt;code&gt;podman&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;2. 開始部署 Gitlab&lt;span class="hx:absolute hx:-mt-20" id="2-開始部署-gitlab"&gt;&lt;/span&gt;
&lt;a href="#2-%e9%96%8b%e5%a7%8b%e9%83%a8%e7%bd%b2-gitlab" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;為 gitlab 建立設定檔、data 和 log 的永存目錄區&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /etc/gitlab
sudo chown $(id -u):$(id -g) /etc/gitlab/
sudo mkdir -p /var/lib/gitlab
sudo chown $(id -u):$(id -g) /var/lib/gitlab/
sudo mkdir -p /var/log/gitlab
sudo chown $(id -u):$(id -g) /var/log/gitlab/
mkdir -p ${HOME}/wulin/gitlab
cd ${HOME}/wulin/gitlab&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 gitlab podman pod yaml&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano gitlab-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
labels:
app: gitlab
name: gitlab
spec:
containers:
- name: gitlab
image: docker.io/gitlab/gitlab-ce:latest
securityContext:
runAsUser: 0
runAsGroup: 0
ports:
- containerPort: 80
hostPort: 8080
- containerPort: 443
hostPort: 8443
- containerPort: 22
hostPort: 2222
volumeMounts:
- mountPath: /etc/gitlab:Z
name: gitlab_config
- mountPath: /var/log/gitlab:Z
name: gitlab_logs
- mountPath: /var/opt/gitlab:Z
name: gitlab_data
volumes:
- name: gitlab_config
hostPath:
path: /etc/gitlab
type: Directory
- name: gitlab_logs
hostPath:
path: /var/log/gitlab
type: Directory
- name: gitlab_data
hostPath:
path: /var/lib/gitlab
type: Directory&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;部署 gitlab&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman kube play gitlab-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 pod 是否運作正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman pod ps&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS
f260ec400479 gitlab Running 6 minutes ago 64e7a631a704 2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;打開瀏覽器連線至 &lt;code&gt;http://&amp;lt;host_ip&amp;gt;:8080&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJLI7dNx-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;移除 gitlab&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman kube down gitlab-pod.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Pods stopped:
f260ec4004799005a7088072f7e1193a9674f31365f1da21dde2a1b132dc99ba
Pods removed:
f260ec4004799005a7088072f7e1193a9674f31365f1da21dde2a1b132dc99ba
Secrets removed:
Volumes removed:&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定開機自動啟動&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 1. 建立一個目錄 (在 user home 中)，用來存放 Podman Quadlet 要使用的 Kubernetes YAML
# 注意路徑： ~/.config/containers/kube
mkdir -p ~/.config/containers/kube
# 2. 將 YAML 檔複製到上述 user 目錄中 (不需 sudo)
cp gitlab-pod.yaml ~/.config/containers/kube/gitlab-pod.yaml
# 3. 建立 user 的 Quadlet 目錄 (如果還不存在)
# 注意路徑： ~/.config/containers/systemd
mkdir -p ~/.config/containers/systemd
# 4. 建立 user systemd 的 Quadlet unit 檔案 (不需 sudo)
# 注意：檔案儲存在 ~/.config/containers/systemd/gitlab-pod.kube
tee ~/.config/containers/systemd/gitlab-pod.kube &amp;gt;/dev/null &amp;lt;&amp;lt;&amp;#39;EOF&amp;#39;
[Unit]
Description=Podman Quadlet: Gitlab Pod (gitlab-pod)
# User services 也可以依賴於網路
Wants=network-online.target
After=network-online.target
[Kube]
# 關鍵：使用 %h 來代表 user 的 home 目錄
Yaml=%h/.config/containers/kube/gitlab-pod.yaml
# StopTimeout=120
[Service]
# 這些設定與 system service 相同
Restart=always
RestartSec=5s
TimeoutStopSec=120s
[Install]
# 關鍵：User services 應該使用 &amp;#39;default.target&amp;#39;
# 這表示當您登入時，服務會啟動
WantedBy=default.target
EOF
# 5. 重新載入 user systemd daemon (使用 --user 旗標)
systemctl --user daemon-reload
# 6. 啟動 gitlab-pod 服務
systemctl --user start gitlab-pod.service
# 7. 檢查 gitlab-pod 服務目前的運行狀態 (使用 --user 旗標)
systemctl --user status gitlab-pod.service
# 8. 啟用 lingering，讓您的 user service 在登出後繼續運行
loginctl enable-linger $(whoami)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● gitlab-pod.service - Podman Quadlet: Gitlab Pod (gitlab-pod)
Loaded: loaded (/home/bigred/.config/containers/systemd/gitlab-pod.kube; generated)
Active: active (running) since Fri 2025-11-14 17:24:14 CST; 3min 19s ago
Main PID: 8412 (conmon)
Tasks: 14 (limit: 9434)
Memory: 7.6M (peak: 22.3M)
CPU: 268ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/gitlab-pod.service
├─8412 /usr/bin/conmon --api-version 1 -c 403dce5090111114ccd9c39b1fa05a49ac57dc91b3bea32c95b77c9083a2a7…
├─8492 rootlessport
├─8497 rootlessport-child
├─8504 /usr/bin/conmon --api-version 1 -c 6ddd4be557c3b945612f3a96122014dee42ed19d659e536c7c31ce0c3e5d7a…
└─8509 /usr/bin/conmon --api-version 1 -c 190c6322b1cc5c5edfc0651e74cd5d385acf28957c31918eeb0fa171e99123…
Nov 14 17:27:22 gitlab.kubeantony.com gitlab-gitlab[8509]: 2025-11-14_09:27:22.05060 - -&amp;gt; /sidekiq
Nov 14 17:27:23 gitlab.kubeantony.com gitlab-gitlab[8509]:
Nov 14 17:27:23 gitlab.kubeantony.com gitlab-gitlab[8509]: ==&amp;gt; /var/log/gitlab/gitlab-rails/production_json.log &amp;lt;==
Nov 14 17:27:23 gitlab.kubeantony.com gitlab-gitlab[8509]: {&amp;#34;method&amp;#34;:&amp;#34;GET&amp;#34;,&amp;#34;path&amp;#34;:&amp;#34;/-/metrics&amp;#34;,&amp;#34;format&amp;#34;:&amp;#34;html&amp;#34;,&amp;#34;contr…
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]:
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]: ==&amp;gt; /var/log/gitlab/gitlab-exporter/current &amp;lt;==
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]: 2025-11-14_09:27:29.18027 127.0.0.1 - - [14/Nov/2025…0 1778
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]: 2025-11-14_09:27:29.18030 - -&amp;gt; /database
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]: 2025-11-14_09:27:29.51964 127.0.0.1 - - [14/Nov/2025…0 1089
Nov 14 17:27:29 gitlab.kubeantony.com gitlab-gitlab[8509]: 2025-11-14_09:27:29.51966 - -&amp;gt; /ruby
Hint: Some lines were ellipsized, use -l to show in full.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 gitlab Container 狀態為 &lt;code&gt;Up X minutes (healthy)&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman ps -a&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
403dce509011 localhost/podman-pause:4.9.3-0 5 minutes ago Up 5 minutes ab2b6bed5526-service
6ddd4be557c3 localhost/podman-pause:4.9.3-0 5 minutes ago Up 5 minutes 0.0.0.0:2222-&amp;gt;22/tcp, 0.0.0.0:8080-&amp;gt;80/tcp, 0.0.0.0:8443-&amp;gt;443/tcp 7ab0d212f129-infra
190c6322b1cc docker.io/gitlab/gitlab-ce:latest /assets/init-cont... 4 minutes ago Up 5 minutes (healthy) 0.0.0.0:2222-&amp;gt;22/tcp, 0.0.0.0:8080-&amp;gt;80/tcp, 0.0.0.0:8443-&amp;gt;443/tcp gitlab-gitlab&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲取 gitlab root 使用者密碼&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman exec gitlab-gitlab cat /etc/gitlab/initial_root_password&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# WARNING: This password is only valid if ALL of the following are true:
# • You set it manually via the GITLAB_ROOT_PASSWORD environment variable
# OR the gitlab_rails[&amp;#39;initial_root_password&amp;#39;] setting in /etc/gitlab/gitlab.rb
# • You set it BEFORE the initial database setup (typically during first installation)
# • You have NOT changed the password since then (via web UI or command line)
#
# If this password doesn&amp;#39;t work, reset the admin password using:
# https://docs.gitlab.com/security/reset_user_password/#reset-the-root-password
Password: nmPd3GbmDgzm/0eP85FA46v/GOL&amp;#43;erXn6/V7b0vnWgk=
# NOTE: This file is automatically deleted after 24 hours on the next reconfigure run.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;成功登入 gitlab 網站&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HJhjDuVx-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 設定 Gitlab&lt;span class="hx:absolute hx:-mt-20" id="3-設定-gitlab"&gt;&lt;/span&gt;
&lt;a href="#3-%e8%a8%ad%e5%ae%9a-gitlab" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;修改 &lt;code&gt;root&lt;/code&gt; user 密碼
點選 &lt;strong&gt;Overview&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Users&lt;/strong&gt; -&amp;gt; &lt;strong&gt;Edit&lt;/strong&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r1pXetEx-x.png" alt="image" loading="lazy" /&gt;
在 Password 和 Password confirmation 欄位輸入密碼，然後按 &lt;strong&gt;Save changes&lt;/strong&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1QxWKEgZe.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;使用新的密碼重新登入
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/HyhNbtNxWl.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 參考連結&lt;span class="hx:absolute hx:-mt-20" id="4-參考連結"&gt;&lt;/span&gt;
&lt;a href="#4-%e5%8f%83%e8%80%83%e9%80%a3%e7%b5%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://medium.com/@johanesmistrialdo/gitlab-ce-deployment-with-podman-d19272dc16dd"target="_blank" rel="noopener"&gt;Gitlab CE Deployment with Podman&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>實作 Cilium BGP</title><link>https://blog.kubeantony.com/archive/kubernetes/%E5%AF%A6%E4%BD%9C-cilium-bgp/</link><pubDate>Sat, 29 Nov 2025 13:19:52 +0800</pubDate><guid>https://blog.kubeantony.com/archive/kubernetes/%E5%AF%A6%E4%BD%9C-cilium-bgp/</guid><description>
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/r1b2fOO-bl.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;1. Create Kind Cluster&lt;span class="hx:absolute hx:-mt-20" id="1-create-kind-cluster"&gt;&lt;/span&gt;
&lt;a href="#1-create-kind-cluster" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano cluster.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Install Elasticsearch Metrics Exporter on Openshift</title><link>https://blog.kubeantony.com/archive/openshift/install-elasticsearch-metrics-exporter-on-openshift/</link><pubDate>Thu, 27 Nov 2025 11:47:08 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/install-elasticsearch-metrics-exporter-on-openshift/</guid><description>
&lt;h2&gt;1. 環境資訊&lt;span class="hx:absolute hx:-mt-20" id="1-環境資訊"&gt;&lt;/span&gt;
&lt;a href="#1-%e7%92%b0%e5%a2%83%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;openshift version &lt;code&gt;4.19.7&lt;/code&gt; in disconnected network&lt;/li&gt;
&lt;li&gt;需要將 Elasticsearch Metrics Exporter 部署在 &lt;code&gt;logging&lt;/code&gt; 節點&lt;/li&gt;
&lt;li&gt;logging 節點資訊如下：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get nodes -l &amp;#34;node-role.kubernetes.io/logging&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
docpl01.ocp.cbsd.scsb.com.tw Ready logging 24d v1.32.6
docpl02.ocp.cbsd.scsb.com.tw Ready logging 24d v1.32.6
docpl03.ocp.cbsd.scsb.com.tw Ready logging 24d v1.32.6&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;logging 節點的 taints 資訊 :
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get nodes -l &amp;#34;node-role.kubernetes.io/logging&amp;#34; -o yaml | grep -A 6 -i &amp;#34;taints&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt; taints:
- effect: NoSchedule
key: logging
value: reserved
- effect: NoExecute
key: logging
value: reserved
--
taints:
- effect: NoSchedule
key: logging
value: reserved
- effect: NoExecute
key: logging
value: reserved
--
taints:
- effect: NoSchedule
key: logging
value: reserved
- effect: NoExecute
key: logging
value: reserved&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 前置作業&lt;span class="hx:absolute hx:-mt-20" id="2-前置作業"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%89%8d%e7%bd%ae%e4%bd%9c%e6%a5%ad" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;先決條件：須在可到 public 網路的 linux 主機作業，並有安裝 &lt;code&gt;podman&lt;/code&gt; 套件&lt;/li&gt;
&lt;li&gt;建立專案目錄並切換當前目錄
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir -p ~/openshift/addon/monitoring/es-exporter; cd ~/openshift/addon/monitoring/es-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;下載 helm 命令執行檔
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget https://get.helm.sh/helm-v4.0.1-linux-amd64.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;下載 prometheus-elasticsearch-exporter helm chart 檔案
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm pull oci://ghcr.io/prometheus-community/charts/prometheus-elasticsearch-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;下載 prometheus-elasticsearch-exporter default &lt;code&gt;values.yaml&lt;/code&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;wget https://raw.githubusercontent.com/prometheus-community/helm-charts/refs/heads/main/charts/prometheus-elasticsearch-exporter/values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;獲取 prometheus-elasticsearch-exporter container image 名稱
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat default-values.yaml | grep repository&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;repository: quay.io/prometheuscommunity/elasticsearch-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;tag 的版本預設會被指定在 &lt;code&gt;Chart.yaml&lt;/code&gt; 中&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;獲取 prometheus-elasticsearch-exporter container image tag 版本
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf prometheus-elasticsearch-exporter-7.0.0.tgz
grep -i appversion prometheus-elasticsearch-exporter/Chart.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;appVersion: v1.9.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;下載並打包 prometheus-elasticsearch-exporter container image
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman pull quay.io/prometheuscommunity/elasticsearch-exporter:v1.9.0
podman save quay.io/prometheuscommunity/elasticsearch-exporter:v1.9.0 &amp;gt; elasticsearch-exporter-v1.9.0.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;準備啟用 openshift logging 收集 user workload 的 configmap 設定檔
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#39;apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-monitoring-config
namespace: openshift-monitoring
data:
config.yaml: |
enableUserWorkload: true&amp;#39; &amp;gt; cm.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;先撰寫客製化的 helm &lt;code&gt;values.yaml&lt;/code&gt; 範本 (實際到客戶端會再根據環境修改成對應的設定值)
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;image:
repository: quay.kubeantony.com:8443/library/prometheuscommunity/elasticsearch-exporter
tag: &amp;#34;v1.9.0&amp;#34;
pullPolicy: IfNotPresent
podSecurityContext:
runAsNonRoot: true
runAsUser: 1000790001
seccompProfile:
type: &amp;#34;RuntimeDefault&amp;#34;
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
nodeSelector:
node-role.kubernetes.io/logging: &amp;#34;&amp;#34;
tolerations: []
es:
uri: https://admin:admin123@elasticsearch-sample-elastic.apps.topgun.kubeantony.com
sslSkipVerify: true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;撰寫 prometheus 收集 elasticsearch metrics 需要的 service monitor yaml 設定檔
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano es-service-monitor.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
檔案內容如下：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: ealsticsearch-monitor
namespace: elastic
spec:
endpoints:
- interval: 30s
port: http
scheme: http
selector:
matchLabels:
app.kubernetes.io/instance: prometheus-elasticsearch-exporter&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;將整個專案目錄壓縮成一個檔案，之後可直接提供給客戶
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ..; tar -zcvf es-exporter.tar.gz es-exporter/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;3. 開始設定與安裝 Elasticsearch Metrics Exporter&lt;span class="hx:absolute hx:-mt-20" id="3-開始設定與安裝-elasticsearch-metrics-exporter"&gt;&lt;/span&gt;
&lt;a href="#3-%e9%96%8b%e5%a7%8b%e8%a8%ad%e5%ae%9a%e8%88%87%e5%ae%89%e8%a3%9d-elasticsearch-metrics-exporter" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;將 &lt;code&gt;es-exporter.tar.gz&lt;/code&gt; 壓縮檔上傳至客戶 ocp 環境的
bastion 主機&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;scp es-exporter.tar.gz &amp;lt;user&amp;gt;:&amp;lt;host_ip&amp;gt;:&amp;lt;folder&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;for example: &lt;code&gt;scp es-exporter.tar.gz ansible@10.21.104.120:.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;解壓縮 &lt;code&gt;es-exporter.tar.gz&lt;/code&gt; 檔案&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf /PATH/TO/es-exporter.tar.gz -C &amp;lt;DST_Folder&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;for example: &lt;code&gt;tar -zxvf /home/ansible/es-exporter.tar.gz -C elk/&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;切換至工作目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cd ~/elk/es-exporter/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 &lt;code&gt;prometheus-elasticsearch-exporter&lt;/code&gt; container image 的打包檔還原成 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman load &amp;lt; elasticsearch-exporter-v1.9.0.tar&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 container image 名稱用以符合客戶環境&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman tag quay.io/prometheuscommunity/elasticsearch-exporter:v1.9.0 docph01.cbsd.scsb.com.tw/ocp4/elk/elasticsearch-exporter:v1.9.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認是否登入 Image Registry&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman login --get-login docph01.cbsd.scsb.com.tw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;admin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將 container image 推送至客戶 Image Registry&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;podman push docph01.cbsd.scsb.com.tw/ocp4/elk/elasticsearch-exporter:v1.9.0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;安裝 helm 指令&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -zxvf helm-v4.0.1-linux-amd64.tar.gz; \
mv linux-amd64/helm /usr/local/bin/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 helm &lt;code&gt;values.yaml&lt;/code&gt; 用以符合客戶 ocp 環境&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;主要會需要設定以下項目：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;image.repository&lt;/code&gt;: container image 名稱&lt;/li&gt;
&lt;li&gt;&lt;code&gt;podSecurityContext.runAsUser&lt;/code&gt;: pod 須以什麼 user 執行，可根據以下命令得知 namespace 底下可用的 uid 範圍
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get ns elastic -o yaml | grep uid-&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
執行結果：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openshift.io/sa.scc.uid-range: 1000780000/10000&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;resources&lt;/code&gt;: 設定 cpu 和 記憶體可用或上限的資源&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nodeSelector&lt;/code&gt;: 設定 pod 要跑在帶有什麼 label 的節點上&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tolerations&lt;/code&gt;: 如果該節點有 taints 需設定 tolerations 來容忍這些 taints，否則 pod 將無法被指派到該節點&lt;/li&gt;
&lt;li&gt;&lt;code&gt;es.url&lt;/code&gt;: elasticsearch url 的位置&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;image:
repository: docph01.cbsd.scsb.com.tw/ocp4/elk/elasticsearch-exporter
tag: &amp;#34;v1.9.0&amp;#34;
pullPolicy: IfNotPresent
podSecurityContext:
runAsNonRoot: true
runAsUser: 1000780001
seccompProfile:
type: &amp;#34;RuntimeDefault&amp;#34;
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
nodeSelector:
node-role.kubernetes.io/logging: &amp;#34;&amp;#34;
tolerations:
- effect: NoSchedule
key: logging
operator: Equal
value: reserved
- effect: NoExecute
key: logging
operator: Equal
value: reserved
es:
uri: https://elastic:1B91L1oPibVZ430p95wS3ljs@elasticsearch-elastic.apps.ocp.cbsd.scsb.com.tw
sslSkipVerify: true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查找 kubeconfig 位置&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo $KUBECONFIG&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;/source/OCP_4.14_CLI_and_YAMLs/OCP_YAMLs/ign-workdir/auth/kubeconfig&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;透過 helm 安裝 &lt;code&gt;prometheus-elasticsearch-exporter&lt;/code&gt;&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;helm --kubeconfig=/source/OCP_4.14_CLI_and_YAMLs/OCP_YAMLs/ign-workdir/auth/kubeconfig \
upgrade
--install prometheus-elasticsearch-exporter ./prometheus-elasticsearch-exporter-7.0.0.tgz \
-f custom-values.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 &lt;code&gt;prometheus-elasticsearch-exporter&lt;/code&gt; pod 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc -n elastic get pods&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME READY STATUS RESTARTS AGE
elasticsearch-es-data-nodes-0 1/1 Running 2 (5h7m ago) 5h8m
elasticsearch-es-data-nodes-1 1/1 Running 2 (5h7m ago) 5h8m
elasticsearch-es-data-nodes-2 1/1 Running 2 (5h7m ago) 5h8m
elasticsearch-es-master-nodes-0 1/1 Running 2 (5h7m ago) 5h8m
elasticsearch-es-master-nodes-1 1/1 Running 2 (5h7m ago) 5h8m
elasticsearch-es-master-nodes-2 1/1 Running 2 (5h7m ago) 5h8m
kibana-kb-688b58f67f-8jq4n 1/1 Running 0 5h8m
prometheus-elasticsearch-exporter-7b9d89dcd9-xx68g 1/1 Running 0 4h51m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 openshift monitoring 允許收集自定義的 metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc apply -f cm.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 openshift monitoring 要去收集 elasticsearch metrics expose 出來的 metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc apply -f es-service-monitor.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 servicemonitors 是否正常部署&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc -n elastic get servicemonitors&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME AGE
ealsticsearch-monitor 4h54m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 驗證 Prometheus 是否可收集到 Elasticsearch 的 metrics&lt;span class="hx:absolute hx:-mt-20" id="4-驗證-prometheus-是否可收集到-elasticsearch-的-metrics"&gt;&lt;/span&gt;
&lt;a href="#4-%e9%a9%97%e8%ad%89-prometheus-%e6%98%af%e5%90%a6%e5%8f%af%e6%94%b6%e9%9b%86%e5%88%b0-elasticsearch-%e7%9a%84-metrics" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;創建一個 &lt;code&gt;serviceAccount&lt;/code&gt; 並賦予相應的權限來驗證 prometheus 有收集到 elasticsearch 的 metrics&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc create sa monitor-reader
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z monitor-reader&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;為 &lt;code&gt;serviceAccount&lt;/code&gt; 建立 secret 來獲取永久的 token&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOF | oc apply -f -
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: monitor-reader-token
annotations:
kubernetes.io/service-account.name: &amp;#34;monitor-reader&amp;#34;
EOF&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲取 monitor-reader &lt;code&gt;serviceAccount&lt;/code&gt; 的 token&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#34;Bearer $(oc get secret monitor-reader-token -o jsonpath=&amp;#39;{.data.token}&amp;#39; | base64 -d)&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6Ilc4Y0dnOC1JMTVWZ1Zwd3kzVFpxdjlFeUJybWlnREJFcUlkZGdOanZFdlEifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJvcGVuc2hpZnQtbW9uaXRvcmluZyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJtb25pdG9yLXJlYWRlci10b2tlbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJtb25pdG9yLXJlYWRlciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjFhNjllNzJhLTU3YzAtNDJiYi1iMTU0LTVjMWUwYzgyYjllZiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpvcGVuc2hpZnQtbW9uaXRvcmluZzptb25pdG9yLXJlYWRlciJ9.ahjR-seVoZI6YiKNCKovP9TaIqAuy4rTRbYaZEb1xwHfy3FTowvrtZyi5zdYNHx4r5-Ry7M7edQUPFY4CCTdd8sbt3q-jD2rAankCIanKzCf02D_QVvPB2so1zdxdsVDBgx71tLTsx7k2wzzsefoL0QRnPcYA-nJJjMxeg2Rrzn2g8dNQm65sTl-ZAfunZq5UlqIs-UYhrM5DGZ0_EbQRtLgEdW91h_OGa0KFEtwsjXL_f8k4cPZydk63du4qwXeW0MLrHAQXRc6UAkG7Pl3GuPeqUdaSIafwywPOVv_BHBRKJl8FKtnBcYRuV7MFrqLsdjkfGO8XcWciIQzKn_2x33wb4kLGVeVKebU_72xVzqdgxCFSXNjO-tz3IF2DITByXxVGRoNv0y--sPxgldznDLSqUsoKBnpkjlnzA_rGUvTr7cy9r-Rj5uRDgO8pUFrptTldhlJxm5Dtfej_-jGuXysDkREBGs4SKond98WcKVYdIRWzjvY0Kgha7bdx6gmmysRdd2-5y_ffS6ruO-jikl82A-Bt2-7BjK2MdzNvDReD6SJ8zQXkG6_-oUPY_i0UR3PTidO71pORW4q0YxjVKD-si3wnot98A6HDCnCXkUAOgAA5SD8k0uzegeHL9Gbktqghuy9eL2PJyomSknxQoqQx9L4j2HsjOUkg70zIKA&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;獲得 &lt;code&gt;thanos-querier&lt;/code&gt; 的 host 跟 path&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc -n openshift-monitoring get route&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
alertmanager-main alertmanager-main-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw /api alertmanager-main web reencrypt/Redirect None
prometheus-k8s prometheus-k8s-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw /api prometheus-k8s web reencrypt/Redirect None
prometheus-k8s-federate prometheus-k8s-federate-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw /federate prometheus-k8s web reencrypt/Redirect None
thanos-querier thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw /api thanos-querier web reencrypt/Redirect None&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;查找 &lt;code&gt;thanos-querier&lt;/code&gt; fqdn 對應的 ip&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;dig thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw &amp;#43;short&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;10.21.107.50&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;因當前操作的實體主機網路無法直接存取透過 route 對外的 openshift 服務，故建立 ssh tunnel&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;ssh -L 10000:10.21.107.50:443 ansible@10.21.104.120&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;輸入密碼登入，並執行 top 避免被自動登出，造成 ssh tunnel 終止&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在本機 &lt;code&gt;/etc/hosts&lt;/code&gt; 添加一筆名稱解析&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/hosts&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;添加以下檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;127.0.0.1 thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;在實體主機的 Google Chrome 瀏覽器安裝 &lt;code&gt;ModHeader&lt;/code&gt; 插件&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;設定 &lt;code&gt;ModHeader&lt;/code&gt; 插件&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;點選 &lt;code&gt;+Mod&lt;/code&gt;，並選擇 &lt;code&gt;Request headers&lt;/code&gt;，然後依序填入以下設定：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;name: Authorization
value: 複製貼上第三步驟(獲取 monitor-reader `serviceAccount` 的 token)的執行結果&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;點選 &lt;code&gt;Filter&lt;/code&gt;，並選擇 &lt;code&gt;Request URL filters&lt;/code&gt;，然後輸入以下內容：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw:10000/.*&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;打開 Google Chrome 瀏覽器，連線測試是否可正常 query&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw:10000/api/v1/query?query=up&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認網路可正常連線到 ocp 叢集裡面的 thanos-querier 服務後，查詢 elasticsearch 的 metrics name 確認是否有成功收集&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw:10000/api/v1/query?query=elasticsearch_thread_pool_completed_count&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;5. 設定 Grafana 呈現 Prometheus 收集到的 Elasticsearch Metrics&lt;span class="hx:absolute hx:-mt-20" id="5-設定-grafana-呈現-prometheus-收集到的-elasticsearch-metrics"&gt;&lt;/span&gt;
&lt;a href="#5-%e8%a8%ad%e5%ae%9a-grafana-%e5%91%88%e7%8f%be-prometheus-%e6%94%b6%e9%9b%86%e5%88%b0%e7%9a%84-elasticsearch-metrics" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;打開 Google Chrome 瀏覽器，並連線至 Grafana&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;https://10.21.104.120&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;登入 Grafana&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;新增 Data Sources，點選左側選單 -&amp;gt; Connections -&amp;gt; Data Sources -&amp;gt; 右上角 Add new data source&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;選擇 prometheus&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;輸入 prometheus 連線資訊：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;name: ocp-prometheus
Connection
Prometheus server URL: https://thanos-querier-openshift-monitoring.apps.ocp.cbsd.scsb.com.tw
TLS settings
勾選 Skip TLS certificate validation
展開 HTTP headers
Add header
Header: Authorization
Value: 複製貼上第三步驟(獲取 monitor-reader `serviceAccount` 的 token)的執行結果&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;確認沒問題後，滑鼠滾到頁面最下面點選 &lt;code&gt;Save &amp;amp; test&lt;/code&gt; 按鈕&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認有出現綠色區塊的連線成功資訊&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;匯入 DashBorad，點選左側選單 Dashboard -&amp;gt; Elastic Folder -&amp;gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>修復 ocp 叢集憑證過期</title><link>https://blog.kubeantony.com/archive/openshift/%E4%BF%AE%E5%BE%A9-ocp-%E5%8F%A2%E9%9B%86%E6%86%91%E8%AD%89%E9%81%8E%E6%9C%9F/</link><pubDate>Fri, 21 Nov 2025 05:30:24 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/%E4%BF%AE%E5%BE%A9-ocp-%E5%8F%A2%E9%9B%86%E6%86%91%E8%AD%89%E9%81%8E%E6%9C%9F/</guid><description>
&lt;h2&gt;1. 環境資訊&lt;span class="hx:absolute hx:-mt-20" id="1-環境資訊"&gt;&lt;/span&gt;
&lt;a href="#1-%e7%92%b0%e5%a2%83%e8%b3%87%e8%a8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Red Hat OpenShift Container Platform (RHOCP)
4.19.10&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;2. 問題描述&lt;span class="hx:absolute hx:-mt-20" id="2-問題描述"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%95%8f%e9%a1%8c%e6%8f%8f%e8%bf%b0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;ocp 叢集的美台節點都關機一個月以上，再次重新開機時，遇到 Control-plane 上的核心元件 (kube-apiserver, kube-scheduler&amp;hellip;等)的憑證過期。&lt;/p&gt;
&lt;p&gt;無法透過 oc 指令跟 kube-apiserver 溝通&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Unable to connect to the server: tls: failed to verify certificate: x509: certificate has expired or is not yet valid: current time 2025-11-21T11:47:17&amp;#43;08:00 is after 2025-10-17T04:33:31Z&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;3. 問題根原因&lt;span class="hx:absolute hx:-mt-20" id="3-問題根原因"&gt;&lt;/span&gt;
&lt;a href="#3-%e5%95%8f%e9%a1%8c%e6%a0%b9%e5%8e%9f%e5%9b%a0" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Control Plane 憑證已經過期超過一個月，由於叢集被關機超過 2 個月以上，導致憑證自動輪替 (Rotation) 機制失效時。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;kube-apiserver&lt;/code&gt; 的 &lt;code&gt;kubelet-client&lt;/code&gt; 憑證已過期，API Server 無法與 Kubelet 進行 TLS 驗證。&lt;/p&gt;
&lt;h2&gt;4. 診斷步驟&lt;span class="hx:absolute hx:-mt-20" id="4-診斷步驟"&gt;&lt;/span&gt;
&lt;a href="#4-%e8%a8%ba%e6%96%b7%e6%ad%a5%e9%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;列出系統當前時間&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;TZ=GMT date&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Fri Nov 21 03:52:02 AM GMT 2025&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;列出在 openshift 叢集中所有過期的憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo -e &amp;#34;NAMESPACE\tNAME\tEXPIRY_DATE&amp;#34; &amp;amp;&amp;amp; \
oc get secrets --insecure-skip-tls-verify -A -o go-template=&amp;#39;{{range .items}}{{if eq .type &amp;#34;kubernetes.io/tls&amp;#34;}}{{.metadata.namespace}}{{&amp;#34; &amp;#34;}}{{.metadata.name}}{{&amp;#34; &amp;#34;}}{{index .data &amp;#34;tls.crt&amp;#34;}}{{&amp;#34;\n&amp;#34;}}{{end}}{{end}}&amp;#39; | \
while read namespace name cert; do
if ! echo &amp;#34;$cert&amp;#34; | base64 -d | openssl x509 -noout -checkend 0 &amp;gt; /dev/null; then
enddate=$(echo &amp;#34;$cert&amp;#34; | base64 -d | openssl x509 -noout -enddate | sed &amp;#39;s/notAfter=//&amp;#39;)
echo -e &amp;#34;$namespace\t$name\t$enddate&amp;#34;
fi
done | column -t&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAMESPACE NAME EXPIRY_DATE
openshift-config-managed kube-controller-manager-client-cert-key Oct 17 04:33:39 2025 GMT
openshift-config-managed kube-scheduler-client-cert-key Oct 17 04:33:39 2025 GMT
openshift-kube-apiserver-operator aggregator-client-signer Sep 18 04:10:54 2025 GMT
openshift-kube-apiserver aggregator-client Sep 18 04:10:54 2025 GMT
openshift-kube-apiserver check-endpoints-client-cert-key Oct 17 04:33:39 2025 GMT
openshift-kube-apiserver control-plane-node-admin-client-cert-key Oct 17 04:33:35 2025 GMT
openshift-kube-apiserver external-loadbalancer-serving-certkey Oct 17 04:33:31 2025 GMT
openshift-kube-apiserver internal-loadbalancer-serving-certkey Oct 17 04:33:34 2025 GMT
openshift-kube-apiserver kubelet-client Oct 17 04:33:35 2025 GMT
openshift-kube-apiserver localhost-serving-cert-certkey Oct 17 04:33:31 2025 GMT
openshift-kube-apiserver service-network-serving-certkey Oct 17 04:33:31 2025 GMT
openshift-kube-controller-manager-operator csr-signer Sep 18 04:10:55 2025 GMT
openshift-kube-controller-manager-operator csr-signer-signer Sep 18 04:10:55 2025 GMT
openshift-kube-controller-manager csr-signer Sep 18 04:10:55 2025 GMT
openshift-kube-controller-manager kube-controller-manager-client-cert-key Oct 17 04:33:39 2025 GMT
openshift-kube-scheduler kube-scheduler-client-cert-key Oct 17 04:33:39 2025 GMT
openshift-operator-lifecycle-manager pprof-cert Sep 18 04:45:10 2025 GMT&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;4. 解決問題&lt;span class="hx:absolute hx:-mt-20" id="4-解決問題"&gt;&lt;/span&gt;
&lt;a href="#4-%e8%a7%a3%e6%b1%ba%e5%95%8f%e9%a1%8c" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;觸發 OpenShift 叢集內所有 Master 和 Worker 節點的滾動式重新開機&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm reboot-machine-config-pool mcp/worker mcp/master \
--insecure-skip-tls-verify&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;machineconfig.machineconfiguration.openshift.io/95-oc-initiated-reboot-worker rolling reboot initiated
machineconfigpool.machineconfiguration.openshift.io/worker rolling reboot initiated
machineconfig.machineconfiguration.openshift.io/95-oc-initiated-reboot-master rolling reboot initiated
machineconfigpool.machineconfiguration.openshift.io/master rolling reboot initiated&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視被 drian 的節點&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get nodes --insecure-skip-tls-verify&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
master-1 Ready control-plane,master 65d v1.32.7
master-2 NotReady,SchedulingDisabled control-plane,master 65d v1.32.7
master-3 Ready control-plane,master 65d v1.32.7
worker-1 Ready worker 65d v1.32.7
worker-2 Ready worker 65d v1.32.7
worker-3 NotReady,SchedulingDisabled worker 65d v1.32.7&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;如果節點很久都沒自動重新開機，請執行以下步驟：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;檢視該節點上是否還有 pod 沒被驅逐&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get pods --all-namespaces \
--insecure-skip-tls-verify \
--field-selector spec.nodeName=master-2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAMESPACE NAME READY STATUS RESTARTS AGE
openshift-cluster-node-tuning-operator tuned-wq2dg 1/1 Running 0 65d
openshift-dns dns-default-rk5nw 2/2 Running 0 65d
openshift-dns node-resolver-6b5xt 1/1 Running 0 65d
openshift-etcd etcd-master-2 5/5 Running 0 65d
openshift-etcd revision-pruner-10-master-2 0/1 Pending 0 64d
openshift-image-registry node-ca-hshgn 1/1 Running 0 65d
openshift-kube-apiserver kube-apiserver-master-2 5/5 Running 0 65d
openshift-kube-controller-manager kube-controller-manager-master-2 4/4 Running 2 (64d ago) 65d
openshift-kube-scheduler openshift-kube-scheduler-master-2 3/3 Running 0 65d
openshift-kube-scheduler revision-pruner-6-master-2 0/1 Pending 0 64d
openshift-machine-config-operator kube-rbac-proxy-crio-master-2 1/1 Running 12 (65d ago) 65d
openshift-machine-config-operator machine-config-daemon-vtgwl 2/2 Running 0 65d
openshift-machine-config-operator machine-config-server-tx5vx 1/1 Running 0 65d
openshift-monitoring node-exporter-vcfsd 2/2 Running 0 65d
openshift-multus multus-47z8l 1/1 Running 0 65d
openshift-multus multus-additional-cni-plugins-zc8vb 1/1 Running 0 65d
openshift-multus network-metrics-daemon-6h8k7 2/2 Running 0 65d
openshift-network-diagnostics network-check-target-f29nk 1/1 Running 0 65d
openshift-network-node-identity network-node-identity-cg7rr 2/2 Running 0 65d
openshift-network-operator iptables-alerter-gl975 1/1 Running 0 65d
openshift-ovn-kubernetes ovnkube-node-czhkg 8/8 Running 0 65d&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;手動 drain 節點看有沒有什麼錯誤訊息&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm drain master-2 --insecure-skip-tls-verify --ignore-daemonsets --delete-emptydir-data&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;node/master-2 already cordoned
error: unable to drain node &amp;#34;master-2&amp;#34; due to error: cannot delete cannot delete Pods that declare no controller (use --force to override): openshift-etcd/revision-pruner-10-master-2, openshift-kube-scheduler/revision-pruner-6-master-2, continuing command...
There are pending nodes to be drained:
master-2
cannot delete cannot delete Pods that declare no controller (use --force to override): openshift-etcd/revision-pruner-10-master-2, openshift-kube-scheduler/revision-pruner-6-master-2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;revision-pruner&lt;/code&gt; Pod 是 OpenShift Operator 自動產生的清理工作 (Housekeeping)。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;它們的作用是清理舊的 Static Pod 設定檔 (Revision)。&lt;/li&gt;
&lt;li&gt;它們通常是暫時性的任務。如果因為 Drain 而被刪除，Operator 會在之後的協調循環 (Reconcile loop) 中，若有需要會再次建立它們，或者它們的任務其實早就結束了。&lt;/li&gt;
&lt;li&gt;它們不承載任何使用者流量或重要資料。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;因此，在這種情況下，使用 &lt;code&gt;--force&lt;/code&gt; 強制將其刪除是標準操作，不會對叢集造成傷害。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;強制驅逐該節點的 pods&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm drain master-2 \
--insecure-skip-tls-verify \
--ignore-daemonsets \
--delete-emptydir-data \
--force&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;node/master-2 already cordoned
Warning: ignoring DaemonSet-managed Pods: openshift-cluster-node-tuning-operator/tuned-wq2dg, openshift-dns/dns-default-rk5nw, openshift-dns/node-resolver-6b5xt, openshift-image-registry/node-ca-hshgn, openshift-machine-config-operator/machine-config-daemon-vtgwl, openshift-machine-config-operator/machine-config-server-tx5vx, openshift-monitoring/node-exporter-vcfsd, openshift-multus/multus-47z8l, openshift-multus/multus-additional-cni-plugins-zc8vb, openshift-multus/network-metrics-daemon-6h8k7, openshift-network-diagnostics/network-check-target-f29nk, openshift-network-node-identity/network-node-identity-cg7rr, openshift-network-operator/iptables-alerter-gl975, openshift-ovn-kubernetes/ovnkube-node-czhkg; deleting Pods that declare no controller: openshift-etcd/revision-pruner-10-master-2, openshift-kube-scheduler/revision-pruner-6-master-2
evicting pod openshift-kube-scheduler/revision-pruner-6-master-2
evicting pod openshift-etcd/revision-pruner-10-master-2
^C&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;以上命令如無法成功，請直些手動強制清除該 pod&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc delete pod revision-pruner-6-master-2 -n openshift-kube-scheduler --force --grace-period=0 --insecure-skip-tls-verify
oc delete pod revision-pruner-10-master-2 -n openshift-etcd --force --grace-period=0 --insecure-skip-tls-verify&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;再驅逐一次該節點的 pods&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc adm drain master-2 \
--insecure-skip-tls-verify \
--ignore-daemonsets \
--delete-emptydir-data \
--force&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Warning: ignoring DaemonSet-managed Pods: openshift-cluster-node-tuning-operator/tuned-wq2dg, openshift-dns/dns-default-rk5nw, openshift-dns/node-resolver-6b5xt, openshift-image-registry/node-ca-hshgn, openshift-machine-config-operator/machine-config-daemon-vtgwl, openshift-machine-config-operator/machine-config-server-tx5vx, openshift-monitoring/node-exporter-vcfsd, openshift-multus/multus-47z8l, openshift-multus/multus-additional-cni-plugins-zc8vb, openshift-multus/network-metrics-daemon-6h8k7, openshift-network-diagnostics/network-check-target-f29nk, openshift-network-node-identity/network-node-identity-cg7rr, openshift-network-operator/iptables-alerter-gl975, openshift-ovn-kubernetes/ovnkube-node-czhkg
node/master-2 drained&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Podman Spring native</title><link>https://blog.kubeantony.com/archive/container/podman-spring-native/</link><pubDate>Tue, 18 Nov 2025 14:19:06 +0800</pubDate><guid>https://blog.kubeantony.com/archive/container/podman-spring-native/</guid><description>
&lt;h2&gt;1. 開發 TLS Http Web Server&lt;span class="hx:absolute hx:-mt-20" id="1-開發-tls-http-web-server"&gt;&lt;/span&gt;
&lt;a href="#1-%e9%96%8b%e7%99%bc-tls-http-web-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1.1. 透過 Step-CA 產生自簽憑證&lt;span class="hx:absolute hx:-mt-20" id="11-透過-step-ca-產生自簽憑證"&gt;&lt;/span&gt;
&lt;a href="#11-%e9%80%8f%e9%81%8e-step-ca-%e7%94%a2%e7%94%9f%e8%87%aa%e7%b0%bd%e6%86%91%e8%ad%89" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;建立 certificate authority (CA) 設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /opt/zfs/ca
sudo chown 1000:1000 /opt/zfs/ca
sudo podman run --rm -it \
-v /opt/zfs/ca:/home/step \
smallstep/step-ca:latest \
step ca init \
--deployment-type &amp;#34;standalone&amp;#34; \
--name &amp;#34;Taroko&amp;#34; \
--dns &amp;#34;192.168.188.100&amp;#34; \
--address &amp;#34;192.168.188.100:443&amp;#34; \
--provisioner &amp;#34;bigred@k8s&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;there is no ca.json config file; please run step ca init, or provide config parameters via DOCKER_STEPCA_INIT_ vars
Choose a password for your CA keys and first provisioner.
✔ [leave empty and we&amp;#39;ll generate one]: bigred
Generating root certificate... done!
Generating intermediate certificate... done!
✔ Root certificate: /home/step/certs/root_ca.crt
✔ Root private key: /home/step/secrets/root_ca_key
✔ Root fingerprint: ec149e5b641071f34debb050f56732e120c01c01f4569d31c880880484e61972
✔ Intermediate certificate: /home/step/certs/intermediate_ca.crt
✔ Intermediate private key: /home/step/secrets/intermediate_ca_key
✔ Database folder: /home/step/db
✔ Default configuration: /home/step/config/defaults.json
✔ Certificate Authority configuration: /home/step/config/ca.json
Your PKI is ready to go. To generate certificates for individual services see &amp;#39;step help ca&amp;#39;.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立 Step-CA Server&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;echo &amp;#34;bigred&amp;#34; &amp;gt; /opt/zfs/ca/secrets/password
sudo podman run --name step-ca -itd \
-h ca.k8s --net=itfra --ip 192.168.188.100 \
--dns 192.168.188.10 --dns-search k8s \
-v /opt/zfs/ca:/home/step \
smallstep/step-ca&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認 Step-CA Server 運作是否正常&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;$ sudo podman logs step-ca&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;badger 2025/11/18 06:54:19 INFO: All 0 tables opened in 0s
2025/11/18 06:54:19 Building new tls configuration using step-ca x509 Signer Interface
2025/11/18 06:54:19 Starting Smallstep CA/0.28.4 (linux/amd64)
2025/11/18 06:54:19 Documentation: https://u.step.sm/docs/ca
2025/11/18 06:54:19 Community Discord: https://u.step.sm/discord
2025/11/18 06:54:19 Config file: /home/step/config/ca.json
2025/11/18 06:54:19 The primary server URL is https://192.168.188.100:443
2025/11/18 06:54:19 Root certificates are available at https://192.168.188.100:443/roots.pem
2025/11/18 06:54:19 X.509 Root Fingerprint: 440e375a87cfe8c75a0e10dcb8c00c306be0e8ae8d584c7a6b03c47c69c8b485
2025/11/18 06:54:19 Serving HTTPS on 192.168.188.100:443 ...&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢測 Step-CA Server&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl -k https://192.168.188.100:443/health&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;{&amp;#34;status&amp;#34;:&amp;#34;ok&amp;#34;}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;製作 web.k8s 憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo podman exec -it step-ca step ca certificate web.k8s web.k8s.crt web.k8s.key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;✔ Provisioner: bigred@k8s (JWK) [kid: CGRqFRj6mGpgM1JttMTT4jydH-UlpWHh91hAEIc2Ssk]
Please enter the password to decrypt the provisioner key:
✔ CA: https://192.168.188.100
✔ Certificate: web.k8s.crt
✔ Private Key: web.k8s.key&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;建立存放網站憑證的目錄，並將剛剛產生的憑證搬進該目錄&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir -p /opt/zfs/java-web/{conf.d,certs}
sudo mv /opt/zfs/ca/web.k8s* /opt/zfs/java-web/certs/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;將憑證轉換為 Java Keystore (PKCS12)&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo openssl pkcs12 -export \
-inkey /opt/zfs/java-web/certs/web.k8s.key \
-in /opt/zfs/java-web/certs/web.k8s.crt \
-out /opt/zfs/java-web/certs/web.k8s.keystore.p12 \
-name &amp;#34;sb3-tls&amp;#34; \
-passout pass:bigred
sudo cp /opt/zfs/java-web/certs/web.k8s.keystore.p12 ${HOME}/sb3/src/main/resources/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;1.2. 開發 Web 網站&lt;span class="hx:absolute hx:-mt-20" id="12-開發-web-網站"&gt;&lt;/span&gt;
&lt;a href="#12-%e9%96%8b%e7%99%bc-web-%e7%b6%b2%e7%ab%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;編輯 RESTful 網站開發套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano ${HOME}/sb3/src/main/java/k8s/sb3/TlsHelloController.java&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;package k8s.sb3;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TlsHelloController {
@GetMapping(&amp;#34;/hello&amp;#34;)
public String hello() {
return &amp;#34;Hello, GraalVM!\n&amp;#34;;
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;修改 application.properties&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano ${HOME}/sb3/src/main/resources/application.properties&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;spring.application.name=sb3
# 啟用 SSL
server.port=8443
server.ssl.enabled=true
server.ssl.key-store=classpath:web.k8s.keystore.p12
server.ssl.key-store-password=bigred
server.ssl.key-store-type=PKCS12
server.ssl.key-alias=sb3-tls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;編輯 &lt;code&gt;KeystoreRuntimeHints.java&lt;/code&gt;，將憑證 compile 進 jar 檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano src/main/java/k8s/sb3/KeystoreRuntimeHints.java&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;package k8s.sb3;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportRuntimeHints;
@Configuration
@ImportRuntimeHints(KeystoreRuntimeHints.KeystoreHintsRegistrar.class)
public class KeystoreRuntimeHints {
static class KeystoreHintsRegistrar implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
// 精準指定檔名
hints.resources().registerPattern(&amp;#34;web.k8s.keystore.p12&amp;#34;);
// 或者你也可以用通配：
// hints.resources().registerPattern(&amp;#34;*.p12&amp;#34;);
}
}
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;build image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo ${HOME}/sb3/mvnw clean \
-Pnative spring-boot:build-image \
-Dspring-boot.build-image.imageName=sb3:v1-tls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果：&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;[INFO] Successfully built image &amp;#39;docker.io/library/sb3:v1-tls&amp;#39;
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:07 min
[INFO] Finished at: 2025-11-18T21:23:22&amp;#43;08:00
[INFO] ------------------------------------------------------------------------&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 image&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;docker images sb3:v1-tls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;REPOSITORY TAG IMAGE ID CREATED SIZE
sb3 v1-tls f8c4fd25f90c 45 years ago 113MB&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run Container&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;docker run --name sb3 -d -p 443:8443 sb3:v1-tls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;檢視 web container 運作狀態&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;docker ps -a --filter name=sb3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
70b0a080e03d sb3:v1-tls &amp;#34;&amp;#34; 45 minutes ago Up 45 minutes 0.0.0.0:443-&amp;gt;8443/tcp sb3&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;信任 root ca 和 中繼憑證&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cp /opt/zfs/ca/certs/root_ca.crt /usr/local/share/ca-certificates
sudo cp /opt/zfs/ca/certs/intermediate_ca.crt /usr/local/share/ca-certificates
sudo update-ca-certificates&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;測試連線網站&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;curl https://web.k8s/hello&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;執行結果:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Hello, GraalVM!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>Step by Step install OpenShift 4.18 with the Agent-based Installer (Online)</title><link>https://blog.kubeantony.com/archive/openshift/step-by-step-install-openshift-4.18-with-the-agent-based-installer-online/</link><pubDate>Tue, 18 Nov 2025 10:12:50 +0800</pubDate><guid>https://blog.kubeantony.com/archive/openshift/step-by-step-install-openshift-4.18-with-the-agent-based-installer-online/</guid><description>
&lt;style&gt;
.indent-title-1{
margin-left: 1em;
}
.indent-title-2{
margin-left: 2em;
}
.indent-title-3{
margin-left: 3em;
}
&lt;/style&gt;
&lt;h1&gt;Preface&lt;/h1&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;本篇文章會介紹，如何在多台 VM 上使用 agent-based 的方式安裝 3 台 Control-plane Node 和 3 台 Worker Node 架構的 OpenShift Container Platform 4.18&lt;/p&gt;
&lt;p&gt;可以透過點擊展開以下目錄，選擇想看的內容，跳轉至特定章節&lt;/p&gt;
&lt;/div&gt;
&lt;h1&gt;1. 先備知識&lt;/h1&gt;&lt;h2&gt;1.1. 什麼是 Agent-based Installer&lt;span class="hx:absolute hx:-mt-20" id="11-什麼是-agent-based-installer"&gt;&lt;/span&gt;
&lt;a href="#11-%e4%bb%80%e9%ba%bc%e6%98%af-agent-based-installer" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Agent-based 安裝方式&lt;/strong&gt;是一個 OpenShift 安裝工具的子命令，可以生成一張可開機的 ISO，讓你彈性地啟動本地伺服器，自行部署叢集，甚至適用於全離線網路（air‑gapped）環境。&lt;/li&gt;
&lt;li&gt;它結合了 Assisted Installation 的便利與離線操作能力，整張 ISO 已包含部署叢集所需的所有資訊和 Release image。&lt;/li&gt;
&lt;li&gt;此安裝方式支持 Zero Touch Provisioning（ZTP），可利用宣告式方式，自動化部署裸機設備到新的邊緣站點，同時設定格式與其他安裝方式一致。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;1.2. 理解 Agent-based Installer 安裝流程&lt;span class="hx:absolute hx:-mt-20" id="12-理解-agent-based-installer-安裝流程"&gt;&lt;/span&gt;
&lt;a href="#12-%e7%90%86%e8%a7%a3-agent-based-installer-%e5%ae%89%e8%a3%9d%e6%b5%81%e7%a8%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1mNgLFXxx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;在 Control-plane node 中，其中一台會在開機一開始啟動 Assisted Service，並最終成為啟動節點（bootstrap host），這台節點被稱為 &lt;strong&gt;rendezvous host（節點 0）&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;Assisted Service 會檢查所有節點是否符合安裝需求，並啟動 OpenShift Container Platform 叢集的部署流程；每個節點都會將 Red Hat Enterprise Linux CoreOS（RHCOS）映像寫入硬碟。&lt;/li&gt;
&lt;li&gt;除了 rendezvous host 外的其他節點會重啟並開始安裝，rendezvous host 也會在稍後重啟並加入叢集；當所有節點都完成重啟並加入時，bootstrapping 完成，叢集部署成功。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;可以透過 &lt;code&gt;openshift-install agent create image&lt;/code&gt; 子命令，在離線環境安裝 OpenShift Container Platform，不同架構如下：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;單節點 OpenShift 叢集（SNO）&lt;/strong&gt;
一台同時包含 master 與 worker 身份的節點。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;三節點緊湊型叢集&lt;/strong&gt;
由三台 master 節點組成，同時也是 worker 節點。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;高可用 OpenShift 叢集（HA）&lt;/strong&gt;
至少三台 master 節點，搭配任意數量的 worker 節點，具備高可用架構。&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;1.3. 各台主機扮演的角色說明&lt;span class="hx:absolute hx:-mt-20" id="13-各台主機扮演的角色說明"&gt;&lt;/span&gt;
&lt;a href="#13-%e5%90%84%e5%8f%b0%e4%b8%bb%e6%a9%9f%e6%89%ae%e6%bc%94%e7%9a%84%e8%a7%92%e8%89%b2%e8%aa%aa%e6%98%8e" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;主機名稱&lt;/th&gt;
&lt;th&gt;角色和服務&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;bastion&lt;/td&gt;
&lt;td&gt;Cluster installer/bastion&lt;/td&gt;
&lt;td&gt;發動安裝 OCP 的跳板機, 同時提供 load balance, DNS Server 的服務&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;master-1&lt;/td&gt;
&lt;td&gt;rendezvous host/bootstrap&lt;/td&gt;
&lt;td&gt;安裝時重要的角色, 透過 installer 將 ocp cluster 角色先部署在此, 再透過 scale out 延伸到 master node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;master-[1-3]&lt;/td&gt;
&lt;td&gt;Master node&lt;/td&gt;
&lt;td&gt;ocp 重要的控制節點須為三個&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;worker-[1-3]&lt;/td&gt;
&lt;td&gt;Worker/compute node&lt;/td&gt;
&lt;td&gt;執行 Application 的節點&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;bastion&lt;/td&gt;
&lt;td&gt;DNS Server&lt;/td&gt;
&lt;td&gt;提供名稱解析和反解析(網址轉成 IP 或是將 IP 轉回網址)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;bastion&lt;/td&gt;
&lt;td&gt;HA Proxy&lt;/td&gt;
&lt;td&gt;提供 load balance 的服務&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h1&gt;2. 準備安裝&lt;/h1&gt;&lt;h2&gt;2.1. 先決條件&lt;span class="hx:absolute hx:-mt-20" id="21-先決條件"&gt;&lt;/span&gt;
&lt;a href="#21-%e5%85%88%e6%b1%ba%e6%a2%9d%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;2.1.1. 硬體資源需求&lt;span class="hx:absolute hx:-mt-20" id="211-硬體資源需求"&gt;&lt;/span&gt;
&lt;a href="#211-%e7%a1%ac%e9%ab%94%e8%b3%87%e6%ba%90%e9%9c%80%e6%b1%82" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ry5q-G6mlx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;2.1.2. 環境架構&lt;span class="hx:absolute hx:-mt-20" id="212-環境架構"&gt;&lt;/span&gt;
&lt;a href="#212-%e7%92%b0%e5%a2%83%e6%9e%b6%e6%a7%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;請在虛擬化平台(Proxmox/VMWare&amp;hellip;)產出以下 7 台 VM，&lt;font color=red&gt;並記錄每台 VM 對應的 Mac Address(除了 bastion)&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 台 bastion (RHEL)&lt;/li&gt;
&lt;li&gt;3 台 master (RHCOS)&lt;/li&gt;
&lt;li&gt;3 台 worker (RHCOS)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2.1.3. 主機名稱設定格式&lt;span class="hx:absolute hx:-mt-20" id="213-主機名稱設定格式"&gt;&lt;/span&gt;
&lt;a href="#213-%e4%b8%bb%e6%a9%9f%e5%90%8d%e7%a8%b1%e8%a8%ad%e5%ae%9a%e6%a0%bc%e5%bc%8f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;HOSTNAME.CLUSTER_NAME.DOMAIN_NAME&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;example:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;bastion.topgun.kubeantony.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HOSTNAME&lt;/code&gt; 就是 &lt;code&gt;bastion&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CLUSTER_NAME&lt;/code&gt; 就是 &lt;code&gt;topgun&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DOMAIN_NAME&lt;/code&gt; 就是 &lt;code&gt;kubeantony.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2.1.4. 軟體授權&lt;span class="hx:absolute hx:-mt-20" id="214-軟體授權"&gt;&lt;/span&gt;
&lt;a href="#214-%e8%bb%9f%e9%ab%94%e6%8e%88%e6%ac%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Red Hat Enterprise Linux subscription
&lt;ul&gt;
&lt;li&gt;60 天個人免費試用連結 : &lt;a
href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/server/trial"target="_blank" rel="noopener"&gt;https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux/server/trial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Red Hat OpenShift Container Platform subscription
&lt;ul&gt;
&lt;li&gt;60 天個人免費試用連結 : &lt;a
href="https://www.redhat.com/en/technologies/cloud-computing/openshift/ocp-self-managed-trial"target="_blank" rel="noopener"&gt;https://www.redhat.com/en/technologies/cloud-computing/openshift/ocp-self-managed-trial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;3. 安裝與設定 Bastion 主機&lt;/h1&gt;&lt;h2&gt;Step 0: 安裝與設定 Red Hat Enterprise Linux 9&lt;span class="hx:absolute hx:-mt-20" id="step-0-安裝與設定-red-hat-enterprise-linux-9"&gt;&lt;/span&gt;
&lt;a href="#step-0-%e5%ae%89%e8%a3%9d%e8%88%87%e8%a8%ad%e5%ae%9a-red-hat-enterprise-linux-9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://www.server-world.info/en/note?os=Other&amp;amp;p=rhel&amp;amp;f=5"target="_blank" rel="noopener"&gt;Install Red Hat Enterprise Linux 9 - server-world&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Step 1: 下載 &amp;ldquo;安裝 OCP 程式&amp;rdquo; 和 &amp;ldquo;管理 OpenShift 的 CLI 工具&amp;rdquo;&lt;span class="hx:absolute hx:-mt-20" id="step-1-下載-安裝-ocp-程式-和-管理-openshift-的-cli-工具"&gt;&lt;/span&gt;
&lt;a href="#step-1-%e4%b8%8b%e8%bc%89-%e5%ae%89%e8%a3%9d-ocp-%e7%a8%8b%e5%bc%8f-%e5%92%8c-%e7%ae%a1%e7%90%86-openshift-%e7%9a%84-cli-%e5%b7%a5%e5%85%b7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;至 &lt;a
href="https://access.redhat.com/downloads/content/290/ver=4.18/rhel---9/4.18.13/x86_64/product-software"target="_blank" rel="noopener"&gt;RedHat 官網連結&lt;/a&gt; 下載以下兩個項目的檔案 (一定要有帳號)&lt;span class="hx:absolute hx:-mt-20" id="至-redhat-官網連結-下載以下兩個項目的檔案-一定要有帳號"&gt;&lt;/span&gt;
&lt;a href="#%e8%87%b3-redhat-%e5%ae%98%e7%b6%b2%e9%80%a3%e7%b5%90-%e4%b8%8b%e8%bc%89%e4%bb%a5%e4%b8%8b%e5%85%a9%e5%80%8b%e9%a0%85%e7%9b%ae%e7%9a%84%e6%aa%94%e6%a1%88-%e4%b8%80%e5%ae%9a%e8%a6%81%e6%9c%89%e5%b8%b3%e8%99%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;OpenShift v4.18.13 Linux Installer&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;OpenShift v4.18.13 Linux Client&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;OVERSION=&amp;#34;4.18.13&amp;#34;
wget --show-progress -qO &amp;#34;openshift-install-linux-${OVERSION}.tar.gz&amp;#34; &amp;#34;&amp;lt;installer 的下載網址&amp;gt;&amp;#34; &amp;amp;&amp;amp; wget --show-progress -qO &amp;#34;oc-${OVERSION}-linux.tar.gz&amp;#34; &amp;#34;&amp;lt;Clinet 的下載網址&amp;gt;&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;oc-4.18.13-linux.tar.gz&lt;/code&gt;，是 OpenShift CLI 的壓縮檔&lt;/li&gt;
&lt;li&gt;&lt;code&gt;openshift-install-linux-4.18.13.tar.gz&lt;/code&gt;，是安裝 OCP 會用到的程式&lt;/li&gt;
&lt;li&gt;網址需用兩個雙引號包住，不然會報錯。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;解壓縮檔案，並將 oc、openshift-install 和 kubectl 加至 PATH 環境變數&lt;span class="hx:absolute hx:-mt-20" id="解壓縮檔案並將-ocopenshift-install-和-kubectl-加至-path-環境變數"&gt;&lt;/span&gt;
&lt;a href="#%e8%a7%a3%e5%a3%93%e7%b8%ae%e6%aa%94%e6%a1%88%e4%b8%a6%e5%b0%87-ocopenshift-install-%e5%92%8c-kubectl-%e5%8a%a0%e8%87%b3-path-%e7%92%b0%e5%a2%83%e8%ae%8a%e6%95%b8" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;tar -xvf oc-${OVERSION}-linux.tar.gz &amp;amp;&amp;amp; \
tar -xvf openshift-install-linux-${OVERSION}.tar.gz &amp;amp;&amp;amp; \
sudo mv oc kubectl openshift-install /usr/local/bin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;README.md
kubectl
oc
README.md
openshift-install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;確認 oc Command 版本&lt;span class="hx:absolute hx:-mt-20" id="確認-oc-command-版本"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d-oc-command-%e7%89%88%e6%9c%ac" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc version&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;pre&gt;
Client Version: &lt;font color=red&gt;4.18.13&lt;/font&gt;
Kustomize Version: &lt;font color=blue&gt;v5.4.2&lt;/font&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;確認 openshift-install Command 版本&lt;span class="hx:absolute hx:-mt-20" id="確認-openshift-install-command-版本"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d-openshift-install-command-%e7%89%88%e6%9c%ac" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openshift-install version&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;pre&gt;
openshift-install &lt;font color=red&gt;4.18.13&lt;/font&gt;
built from commit 9357b668a760d53a34f7094840d1e9f773127441
release image quay.io/openshift-release-dev/ocp-release@sha256:a93c65b0f9de1d2e29641fbeebc07178733db1cacc7bde178033d7b9183540bc
release architecture amd64
&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;確認 kubectl Command 版本&lt;span class="hx:absolute hx:-mt-20" id="確認-kubectl-command-版本"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d-kubectl-command-%e7%89%88%e6%9c%ac" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;kubectl version --client --output=yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;pre&gt;
clientVersion:
buildDate: "2025-05-06T22:17:45Z"
compiler: gc
gitCommit: 35f7af703663a7459e0bc494e69ed2cc80543d04
gitTreeState: clean
gitVersion: v1.31.1
goVersion: go1.22.12 (Red Hat 1.22.12-2.el9_5) X:strictfipsruntime
major: "1"
minor: "31"
platform: linux/amd64
kustomizeVersion: &lt;font color=blue&gt;v5.4.2&lt;/font&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;h2&gt;Step 2: 安裝 DNS Server&lt;span class="hx:absolute hx:-mt-20" id="step-2-安裝-dns-server"&gt;&lt;/span&gt;
&lt;a href="#step-2-%e5%ae%89%e8%a3%9d-dns-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum -y install bind&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...以上省略
Complete!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;編輯 DNS Server 設定檔 named.conf&lt;span class="hx:absolute hx:-mt-20" id="編輯-dns-server-設定檔-namedconf"&gt;&lt;/span&gt;
&lt;a href="#%e7%b7%a8%e8%bc%af-dns-server-%e8%a8%ad%e5%ae%9a%e6%aa%94-namedconf" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/named.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;要改的地方有兩個部分&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;將 &lt;code&gt;listen-on port 53&lt;/code&gt; 和 &lt;code&gt;allow-query&lt;/code&gt; 的值, 改成 &lt;strong&gt;&lt;code&gt;any&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;p&gt;檔案內容 :&lt;/p&gt;
&lt;pre&gt;
options {
listen-on port 53 { &lt;font color=red&gt;any&lt;/font&gt;; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
secroots-file "/var/named/data/named.secroots";
recursing-file "/var/named/data/named.recursing";
allow-query { &lt;font color=red&gt;any&lt;/font&gt;; };
&lt;/pre&gt;
&lt;/div&gt;
&lt;ol start="2"&gt;
&lt;li&gt;假設我 bastion 這台機器的 Hostname 是 &lt;code&gt;bastion.topgun.kubeantony.com&lt;/code&gt;
IP 是 &lt;code&gt;192.168.11.21&lt;/code&gt;，在 &lt;code&gt;/etc/named.conf&lt;/code&gt; 新增以下內容至檔案的最後面 :&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="indent-title-2"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;zone &amp;#34;kubeantony.com&amp;#34; {
type master;
file &amp;#34;/etc/named/zones/db.kubeantony.com&amp;#34;;
};
zone &amp;#34;11.168.192.in-addr.arpa&amp;#34; {
type master;
file &amp;#34;/etc/named/zones/db.kubeantony.com.reverse&amp;#34;;
};&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;在本次範例中&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cluster name 是 &lt;code&gt;topgun&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Base Domain Name 是 &lt;code&gt;kubeantony.com&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;設定 DNS Server 名稱解析&lt;span class="hx:absolute hx:-mt-20" id="設定-dns-server-名稱解析"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-dns-server-%e5%90%8d%e7%a8%b1%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo mkdir /etc/named/zones &amp;amp;&amp;amp; \
sudo nano /etc/named/zones/db.kubeantony.com&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;pre&gt;
$TTL 1W
@ IN SOA &lt;font color=red&gt;bastion.topgun.kubeantony.com.&lt;/font&gt; root (
2019070700 ; serial
3H ; refresh (3 hours)
30M ; retry (30 minutes)
2W ; expiry (2 weeks)
1W ) ; minimum (1 week)
IN NS &lt;font color=red&gt;bastion.topgun.kubeantony.com.&lt;/font&gt;
IN MX 10 smtp.kubeantony.com.
;
;
&lt;font color=red&gt;bastion.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.21&lt;/font&gt;
&lt;font color=red&gt;smtp.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.21&lt;/font&gt;
;
&lt;font color=red&gt;api.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.21&lt;/font&gt;
&lt;font color=red&gt;api-int.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.21&lt;/font&gt;
;
&lt;font color=red&gt;*.apps.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.21&lt;/font&gt;
;
&lt;font color=red&gt;master-1.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.23&lt;/font&gt;
&lt;font color=red&gt;master-2.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.24&lt;/font&gt;
&lt;font color=red&gt;master-3.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.25&lt;/font&gt;
;
&lt;font color=red&gt;worker-1.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.26&lt;/font&gt;
&lt;font color=red&gt;worker-2.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.27&lt;/font&gt;
&lt;font color=red&gt;worker-3.topgun.kubeantony.com.&lt;/font&gt; IN A &lt;font color=red&gt;192.168.11.28&lt;/font&gt;
;
;EOF
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note: 紅字部分為須依照環境的規劃來設定&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;設定 DNS Server 反解析&lt;span class="hx:absolute hx:-mt-20" id="設定-dns-server-反解析"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-dns-server-%e5%8f%8d%e8%a7%a3%e6%9e%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/named/zones/db.kubeantony.com.reverse&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;pre&gt;
$TTL 1W
@ IN SOA &lt;font color=red&gt;bastion.topgun.kubeantony.com.&lt;/font&gt; root (
2019070700 ; serial
3H ; refresh (3 hours)
30M ; retry (30 minutes)
2W ; expiry (2 weeks)
1W ) ; minimum (1 week)
IN NS &lt;font color=red&gt;bastion.topgun.kubeantony.com.&lt;/font&gt;
;
&lt;font color=red&gt;21.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;api.topgun.kubeantony.com.&lt;/font&gt;
&lt;font color=red&gt;21.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;api-int.topgun.kubeantony.com.&lt;/font&gt;
;
&lt;font color=red&gt;23.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;master-1.topgun.kubeantony.com.&lt;/font&gt;
&lt;font color=red&gt;24.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;master-2.topgun.kubeantony.com.&lt;/font&gt;
&lt;font color=red&gt;25.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;master-3.topgun.kubeantony.com.&lt;/font&gt;
;
&lt;font color=red&gt;26.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;worker-1.topgun.kubeantony.com.&lt;/font&gt;
&lt;font color=red&gt;27.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;worker-2.topgun.kubeantony.com.&lt;/font&gt;
&lt;font color=red&gt;28.11.168.192.in-addr.arpa.&lt;/font&gt; IN PTR &lt;font color=red&gt;worker-3.topgun.kubeantony.com.&lt;/font&gt;
;
;EOF
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note: 紅字部分為須依照環境的規劃來設定&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;啟動 DNS Server&lt;span class="hx:absolute hx:-mt-20" id="啟動-dns-server"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%9f%e5%8b%95-dns-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable named --now&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Created symlink /etc/systemd/system/multi-user.target.wants/named.service → /usr/lib/systemd/system/named.service.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢查&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status named&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;pre&gt;
● named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
Active: &lt;font color=grenn&gt;active (running)&lt;/font&gt; since Mon 2023-07-17 16:50:31 CST; 1s ago
...以下省略
&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;將 bastion 機器的 IP 新增為 DNS Server&lt;span class="hx:absolute hx:-mt-20" id="將-bastion-機器的-ip-新增為-dns-server"&gt;&lt;/span&gt;
&lt;a href="#%e5%b0%87-bastion-%e6%a9%9f%e5%99%a8%e7%9a%84-ip-%e6%96%b0%e5%a2%9e%e7%82%ba-dns-server" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nmcli connection modify &amp;#39;ens18&amp;#39; ipv4.dns &amp;#39;192.168.11.21&amp;#39; &amp;#43;ipv4.dns &amp;#39;8.8.8.8&amp;#39;
sudo systemctl restart NetworkManager&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢查&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo cat /etc/resolv.conf&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# Generated by NetworkManager
search topgun.kubeantony.com
nameserver 192.168.11.21
nameserver 8.8.8.8&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;關閉防火牆&lt;span class="hx:absolute hx:-mt-20" id="關閉防火牆"&gt;&lt;/span&gt;
&lt;a href="#%e9%97%9c%e9%96%89%e9%98%b2%e7%81%ab%e7%89%86" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl disable firewalld.service --now&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢查是否關閉&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status firewalld.service --no-pager&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
...以下省略&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;驗證 DNS Server 正解&lt;span class="hx:absolute hx:-mt-20" id="驗證-dns-server-正解"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-dns-server-%e6%ad%a3%e8%a7%a3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 定義 A Zone File
AZF=&amp;#34;/etc/named/zones/db.kubeantony.com&amp;#34;
# 從 DNS Zone File 中找出所有 A 記錄的主機名稱
ARecord=$(sudo grep -w &amp;#39;A&amp;#39; $AZF | cut -d &amp;#34; &amp;#34; -f 1)
# 對每個主機名稱進行查詢，使用系統中第一個 nameserver 為查詢伺服器
for i in $ARecord; do dig @$(awk &amp;#39;/^nameserver/ {print $2; exit}&amp;#39; /etc/resolv.conf) ${i} &amp;#43;short; done&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;192.168.11.21
192.168.11.21
192.168.11.21
192.168.11.21
192.168.11.21
192.168.11.23
192.168.11.24
192.168.11.25
192.168.11.26
192.168.11.27
192.168.11.28&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;驗證 DNS Server 反解&lt;span class="hx:absolute hx:-mt-20" id="驗證-dns-server-反解"&gt;&lt;/span&gt;
&lt;a href="#%e9%a9%97%e8%ad%89-dns-server-%e5%8f%8d%e8%a7%a3" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;# 指定 PTR Zone File 檔案路徑
PZF=&amp;#34;/etc/named/zones/db.kubeantony.com.reverse&amp;#34;
# 擷取所有 PTR 記錄，將其轉換為標準 IPv4 格式，並去除重複
PTRRecord=$(sudo grep &amp;#39;PTR&amp;#39; $PZF | awk &amp;#39;{split($1,a,&amp;#34;.&amp;#34;); print a[4]&amp;#34;.&amp;#34;a[3]&amp;#34;.&amp;#34;a[2]&amp;#34;.&amp;#34;a[1]}&amp;#39; | sort -u)
# 針對每個 IP 進行反解查詢（reverse DNS lookup），使用第一個 nameserver 查詢
for i in $PTRRecord; do dig -x ${i} @$(awk &amp;#39;/^nameserver/ {print $2; exit}&amp;#39; /etc/resolv.conf) &amp;#43;short; done&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;api-int.topgun.kubeantony.com.
api.topgun.kubeantony.com.
master-1.topgun.kubeantony.com.
master-2.topgun.kubeantony.com.
master-3.topgun.kubeantony.com.
worker-1.topgun.kubeantony.com.
worker-2.topgun.kubeantony.com.
worker-3.topgun.kubeantony.com.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step 3: 安裝 HAProxy 服務&lt;span class="hx:absolute hx:-mt-20" id="step-3-安裝-haproxy-服務"&gt;&lt;/span&gt;
&lt;a href="#step-3-%e5%ae%89%e8%a3%9d-haproxy-%e6%9c%8d%e5%8b%99" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum -y install haproxy&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...以上省略
Complete!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;設定 HAProxy&lt;span class="hx:absolute hx:-mt-20" id="設定-haproxy"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-haproxy" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;直接清掉預設的設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cat /dev/null | sudo tee /etc/haproxy/haproxy.cfg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;再編輯設定檔&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo nano /etc/haproxy/haproxy.cfg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;將以下內容複製到檔案中 :&lt;/p&gt;
&lt;pre&gt;
global
log 127.0.0.1 local2
pidfile /var/run/haproxy.pid
maxconn 4000
daemon
defaults
mode http
log global
option dontlognull
option http-server-close
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen api-server-6443
bind *:6443
mode tcp
server &lt;font color=red&gt;master-1 master-1.topgun.kubeantony.com:6443 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;master-2 master-2.topgun.kubeantony.com:6443 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;master-3 master-3.topgun.kubeantony.com:6443 check inter 1s&lt;/font&gt;
listen machine-config-server-22623
bind *:22623
mode tcp
server &lt;font color=red&gt;master-1 master-1.topgun.kubeantony.com:22623 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;master-2 master-2.topgun.kubeantony.com:22623 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;master-3 master-3.topgun.kubeantony.com:22623 check inter 1s&lt;/font&gt;
listen ingress-router-443
bind *:443
mode tcp
balance source
server &lt;font color=red&gt;worker-1 worker-1.topgun.kubeantony.com:443 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;worker-2 worker-2.topgun.kubeantony.com:443 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;worker-3 worker-3.topgun.kubeantony.com:443 check inter 1s&lt;/font&gt;
listen ingress-router-80
bind *:80
mode tcp
balance source
server &lt;font color=red&gt;worker-1 worker-1.topgun.kubeantony.com:80 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;worker-2 worker-2.topgun.kubeantony.com:80 check inter 1s&lt;/font&gt;
server &lt;font color=red&gt;worker-3 worker-3.topgun.kubeantony.com:80 check inter 1s&lt;/font&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note: 紅字部分為須依照環境的規劃來設定&lt;/strong&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h3&gt;設定允許 HAProxy 可以使用 TCP Port&lt;span class="hx:absolute hx:-mt-20" id="設定允許-haproxy-可以使用-tcp-port"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a%e5%85%81%e8%a8%b1-haproxy-%e5%8f%af%e4%bb%a5%e4%bd%bf%e7%94%a8-tcp-port" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo setsebool -P haproxy_connect_any=1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;If you are using HAProxy as a load balancer and SELinux is set to &lt;strong&gt;&lt;code&gt;enforcing&lt;/code&gt;&lt;/strong&gt;, you must ensure that the HAProxy service can bind to the configured TCP port by running &lt;strong&gt;&lt;code&gt;setsebool -P haproxy_connect_any=1&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;h3&gt;啟動 HAProxy 服務，並設為開機自動啟動&lt;span class="hx:absolute hx:-mt-20" id="啟動-haproxy-服務並設為開機自動啟動"&gt;&lt;/span&gt;
&lt;a href="#%e5%95%9f%e5%8b%95-haproxy-%e6%9c%8d%e5%8b%99%e4%b8%a6%e8%a8%ad%e7%82%ba%e9%96%8b%e6%a9%9f%e8%87%aa%e5%8b%95%e5%95%9f%e5%8b%95" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="indent-title-1"&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl enable --now haproxy.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Created symlink /etc/systemd/system/multi-user.target.wants/haproxy.service → /usr/lib/systemd/system/haproxy.service.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檢查&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo systemctl status haproxy.service&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;pre&gt;
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
Active: &lt;font color=grenn&gt;active (running)&lt;/font&gt; since Mon 2023-07-17 17:26:21 CST; 11min ago
...以下省略
&lt;/pre&gt;
&lt;/div&gt;
&lt;h2&gt;Step 4: 下載 pull-secret&lt;span class="hx:absolute hx:-mt-20" id="step-4-下載-pull-secret"&gt;&lt;/span&gt;
&lt;a href="#step-4-%e4%b8%8b%e8%bc%89-pull-secret" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;div class="indent-title-1"&gt;
&lt;p&gt;至以下連結下載，注意 : &lt;strong&gt;需先登入帳號&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://console.redhat.com/openshift/create/local"target="_blank" rel="noopener"&gt;Download Pull secret&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/H17Hqnfcn.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;div class="indent-title-2"&gt;
&lt;blockquote&gt;
&lt;p&gt;可點選 &amp;ldquo;&lt;strong&gt;Download pull secret&lt;/strong&gt;&amp;quot;，或是點 &amp;ldquo;&lt;strong&gt;Copy pull secret&lt;/strong&gt;&amp;rdquo; 直接將 pull-secret 複製到剪貼簿&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step5: 編輯必要叢集設定檔&lt;span class="hx:absolute hx:-mt-20" id="step5-編輯必要叢集設定檔"&gt;&lt;/span&gt;
&lt;a href="#step5-%e7%b7%a8%e8%bc%af%e5%bf%85%e8%a6%81%e5%8f%a2%e9%9b%86%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;產生目錄&lt;span class="hx:absolute hx:-mt-20" id="產生目錄"&gt;&lt;/span&gt;
&lt;a href="#%e7%94%a2%e7%94%9f%e7%9b%ae%e9%8c%84" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir ~/ocp4; cd ocp4&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;設定 install-config.yaml&lt;span class="hx:absolute hx:-mt-20" id="設定-install-configyaml"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-install-configyaml" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano ~/ocp4/install-config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1
baseDomain: kubeantony.com
compute:
- architecture: amd64
hyperthreading: Enabled
name: worker
replicas: 3
controlPlane:
architecture: amd64
hyperthreading: Enabled
name: master
replicas: 3
metadata:
name: topgun
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
machineNetwork:
- cidr: 192.168.11.0/24
networkType: OVNKubernetes
serviceNetwork:
- 172.30.0.0/16
platform:
none: {}
pullSecret: &amp;#39;{&amp;#34;auths&amp;#34;:{...}&amp;#39;
sshKey: &amp;#39;...&amp;#39;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;&lt;code&gt;install-config.yaml&lt;/code&gt; 欄位介紹&lt;span class="hx:absolute hx:-mt-20" id="install-configyaml-欄位介紹"&gt;&lt;/span&gt;
&lt;a href="#install-configyaml-%e6%ac%84%e4%bd%8d%e4%bb%8b%e7%b4%b9" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;區塊&lt;/th&gt;
&lt;th&gt;鍵名 / 值&lt;/th&gt;
&lt;th&gt;說明&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;版本與網域&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;apiVersion: v1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;設定檔格式版本&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;baseDomain: kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;集群基礎網域，與 metadata.name 組成完整 FQDN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;metadata.name: topgun&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;集群名稱，完整 FQDN 為 &lt;code&gt;topgun.kubeantony.com&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;控制平面&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;controlPlane.name: master&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;控制節點名稱&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;controlPlane.replicas: 3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;控制節點數量&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;controlPlane.architecture: amd64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;架構&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;controlPlane.hyperthreading: Enabled&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;是否啟用超執行緒&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;工作節點&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;compute[0].name: worker&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;工作節點名稱&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;compute[0].replicas: 3&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;工作節點數量&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;compute[0].architecture: amd64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;架構&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;compute[0].hyperthreading: Enabled&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;是否啟用超執行緒&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;網路設定&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;networking.networkType: OVNKubernetes&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CNI 使用 OVN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;clusterNetwork.cidr: 10.128.0.0/14&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pod 網段&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;clusterNetwork.hostPrefix: 23&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;每節點最大 Pod 數（約 512）&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;machineNetwork.cidr: 192.168.11.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;節點網路範圍&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;serviceNetwork: 172.30.0.0/16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Service 網段&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;平台&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;platform.none: {}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;表示為裸機或 Agent-based 安裝&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;憑證與金鑰&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pullSecret: {...}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Red Hat container registry 認證用&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sshKey: '...'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;安裝後 SSH 公鑰&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3&gt;設定 &lt;code&gt;agent-config.yaml&lt;/code&gt;&lt;span class="hx:absolute hx:-mt-20" id="設定-agent-configyaml"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-agent-configyaml" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;nano agent-config.yaml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;檔案內容如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;apiVersion: v1alpha1
kind: AgentConfig
metadata:
name: topgun
rendezvousIP: 192.168.11.13
additionalNTPSources:
- 192.168.11.11
hosts:
- hostname: master-1
role: master
interfaces:
- name: ens18
macAddress: BC:24:11:B9:6B:C1
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:B9:6B:C1
ipv4:
enabled: true
address:
- ip: 192.168.11.13
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda
- hostname: master-2
role: master
interfaces:
- name: ens18
macAddress: BC:24:11:5A:26:6D
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:5A:26:6D
ipv4:
enabled: true
address:
- ip: 192.168.11.14
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda
- hostname: master-3
role: master
interfaces:
- name: ens18
macAddress: BC:24:11:2B:C6:4B
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:2B:C6:4B
ipv4:
enabled: true
address:
- ip: 192.168.11.15
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda
- hostname: worker-1
role: worker
interfaces:
- name: ens18
macAddress: BC:24:11:7F:F2:B0
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:7F:F2:B0
ipv4:
enabled: true
address:
- ip: 192.168.11.16
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda
- hostname: worker-2
role: worker
interfaces:
- name: ens18
macAddress: BC:24:11:BE:DC:4E
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:BE:DC:4E
ipv4:
enabled: true
address:
- ip: 192.168.11.17
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda
- hostname: worker-3
role: worker
interfaces:
- name: ens18
macAddress: BC:24:11:05:55:16
networkConfig:
interfaces:
- name: ens18
type: ethernet
state: up
mac-address: BC:24:11:05:55:16
ipv4:
enabled: true
address:
- ip: 192.168.11.18
prefix-length: 24
dhcp: false
dns-resolver:
config:
server:
- 192.168.11.11
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 192.168.11.1
next-hop-interface: ens18
table-id: 254
rootDeviceHints:
deviceName: /dev/sda&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;備份設定檔&lt;span class="hx:absolute hx:-mt-20" id="備份設定檔"&gt;&lt;/span&gt;
&lt;a href="#%e5%82%99%e4%bb%bd%e8%a8%ad%e5%ae%9a%e6%aa%94" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;cp agent-config.yaml agent-config.yaml.bk
cp install-config.yaml install-config.yaml.bk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;產生安裝用 ISO&lt;span class="hx:absolute hx:-mt-20" id="產生安裝用-iso"&gt;&lt;/span&gt;
&lt;a href="#%e7%94%a2%e7%94%9f%e5%ae%89%e8%a3%9d%e7%94%a8-iso" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;需要先安裝 nmstae 套件&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;sudo yum install -y nmstate&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;再產生 ISO&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openshift-install --dir ~/ocp4/ agent create image&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;INFO Configuration has 3 master replicas and 3 worker replicas
INFO The rendezvous host IP (node0 IP) is 192.168.1.91
INFO Extracting base ISO from release payload
INFO Verifying cached file
INFO Using cached Base ISO /home/bbg/.cache/agent/image_cache/coreos-x86_64.iso
INFO Consuming Install Config from target directory
INFO Consuming Agent Config from target directory
INFO Generated ISO at /home/bbg/ocp4/agent.x86_64.iso.&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Step6: 開始安裝 RedHat OpenShift&lt;span class="hx:absolute hx:-mt-20" id="step6-開始安裝-redhat-openshift"&gt;&lt;/span&gt;
&lt;a href="#step6-%e9%96%8b%e5%a7%8b%e5%ae%89%e8%a3%9d-redhat-openshift" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;1. 將 ISO 上傳至虛擬化平台，並掛載到 VM 上&lt;span class="hx:absolute hx:-mt-20" id="1-將-iso-上傳至虛擬化平台並掛載到-vm-上"&gt;&lt;/span&gt;
&lt;a href="#1-%e5%b0%87-iso-%e4%b8%8a%e5%82%b3%e8%87%b3%e8%99%9b%e6%93%ac%e5%8c%96%e5%b9%b3%e5%8f%b0%e4%b8%a6%e6%8e%9b%e8%bc%89%e5%88%b0-vm-%e4%b8%8a" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;注意！如果是在 vsphere 的環境，需要幫&lt;strong&gt;每一台&lt;/strong&gt; VM 新增以下參數：&lt;/p&gt;
&lt;p&gt;點選 vm -&amp;gt; edit settings -&amp;gt; Advanced Parameters&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;Attribute: disk.EnableUUID
Value: true&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;然後點選 ADD&lt;/p&gt;
&lt;h3&gt;2. 在虛擬化平台將各節點透過 ISO 開機&lt;span class="hx:absolute hx:-mt-20" id="2-在虛擬化平台將各節點透過-iso-開機"&gt;&lt;/span&gt;
&lt;a href="#2-%e5%9c%a8%e8%99%9b%e6%93%ac%e5%8c%96%e5%b9%b3%e5%8f%b0%e5%b0%87%e5%90%84%e7%af%80%e9%bb%9e%e9%80%8f%e9%81%8e-iso-%e9%96%8b%e6%a9%9f" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/ByWzb8TXxe.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;h3&gt;3. 追蹤和驗證安裝進度 (在 Bastion 主機執行以下指令)&lt;span class="hx:absolute hx:-mt-20" id="3-追蹤和驗證安裝進度-在-bastion-主機執行以下指令"&gt;&lt;/span&gt;
&lt;a href="#3-%e8%bf%bd%e8%b9%a4%e5%92%8c%e9%a9%97%e8%ad%89%e5%ae%89%e8%a3%9d%e9%80%b2%e5%ba%a6-%e5%9c%a8-bastion-%e4%b8%bb%e6%a9%9f%e5%9f%b7%e8%a1%8c%e4%bb%a5%e4%b8%8b%e6%8c%87%e4%bb%a4" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;確認哪些節點已安裝完畢，並需要重新開機&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openshift-install --dir ~/ocp4/ agent wait-for bootstrap-complete --log-level=debug&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;注意! 以上指令會提示你哪台 VM 已將所有東西都安裝進硬碟裡面，然後進入自動重新開機的階段，當你看到類似的提示訊息後，大約過 30 秒 ~ 2 分鐘內，該主機會自動重開，請確保該 VM 會透過硬碟重新開機，不要再透過 ISO 又開機進去。&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;正確安裝的螢幕輸出如下 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
INFO Host: master-3, reached installation stage Writing image to disk: 100%
INFO Host: worker-3, reached installation stage Waiting for control plane
INFO Bootstrap Kube API Initialized
INFO Host: master-1, reached installation stage Waiting for control plane: Waiting for masters to join bootstrap control plane
INFO Uploaded logs for host master-2 cluster 84a2dfac-6f61-4de2-93e8-185d5e342f02
INFO Host: master-2, reached installation stage Rebooting
INFO Host: master-3, reached installation stage Rebooting
INFO Host: master-1, reached installation stage Waiting for bootkube
INFO Host: master-3, reached installation stage Done
INFO Node master-2 has been rebooted 1 times before completing installation
INFO Node master-3 has been rebooted 1 times before completing installation
INFO Host: worker-2, reached installation stage Rebooting
INFO Host: worker-1, reached installation stage Rebooting
INFO Host: master-1, reached installation stage Waiting for bootkube: waiting for ETCD bootstrap to be complete
INFO Bootstrap configMap status is complete
INFO Bootstrap is complete
INFO cluster bootstrap is complete&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;確認重開機後，OpenShift 自動安裝完成&lt;span class="hx:absolute hx:-mt-20" id="確認重開機後openshift-自動安裝完成"&gt;&lt;/span&gt;
&lt;a href="#%e7%a2%ba%e8%aa%8d%e9%87%8d%e9%96%8b%e6%a9%9f%e5%be%8copenshift-%e8%87%aa%e5%8b%95%e5%ae%89%e8%a3%9d%e5%ae%8c%e6%88%90" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;openshift-install --dir ~/ocp4 agent wait-for install-complete --log-level=debug&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;...
INFO Cluster is installed
INFO Install complete!
INFO To access the cluster as the system:admin user when using &amp;#39;oc&amp;#39;, run
INFO export KUBECONFIG=/home/bbg/ocp4/auth/kubeconfig
INFO Access the OpenShift web-console here: https://console-openshift-console.apps.topgun.kubeantony.com
INFO Login to the console with user: &amp;#34;kubeadmin&amp;#34;, and password: &amp;#34;JyAcY-VDp6D-DYdHp-T4Twr&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;設定 KubeConfig&lt;span class="hx:absolute hx:-mt-20" id="設定-kubeconfig"&gt;&lt;/span&gt;
&lt;a href="#%e8%a8%ad%e5%ae%9a-kubeconfig" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;mkdir ~/.kube &amp;amp;&amp;amp; \
cp ~/ocp4/auth/kubeconfig ~/.kube/config&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;檢查叢集節點狀態&lt;span class="hx:absolute hx:-mt-20" id="檢查叢集節點狀態"&gt;&lt;/span&gt;
&lt;a href="#%e6%aa%a2%e6%9f%a5%e5%8f%a2%e9%9b%86%e7%af%80%e9%bb%9e%e7%8b%80%e6%85%8b" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get nodes&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME STATUS ROLES AGE VERSION
master-1 Ready control-plane,master 25m v1.31.8
master-2 Ready control-plane,master 67m v1.31.8
master-3 Ready control-plane,master 66m v1.31.8
worker-1 Ready worker 29m v1.31.8
worker-2 Ready worker 32m v1.31.8
worker-3 Ready worker 24m v1.31.8&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;檢視整個叢集核心元件是否健康&lt;span class="hx:absolute hx:-mt-20" id="檢視整個叢集核心元件是否健康"&gt;&lt;/span&gt;
&lt;a href="#%e6%aa%a2%e8%a6%96%e6%95%b4%e5%80%8b%e5%8f%a2%e9%9b%86%e6%a0%b8%e5%bf%83%e5%85%83%e4%bb%b6%e6%98%af%e5%90%a6%e5%81%a5%e5%ba%b7" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;oc get co&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;螢幕輸出 :&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;pre&gt;&lt;code&gt;NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE
authentication 4.18.13 True False False 165m
baremetal 4.18.13 True False False 3h10m
cloud-controller-manager 4.18.13 True False False 3h13m
cloud-credential 4.18.13 True False False 3h14m
cluster-autoscaler 4.18.13 True False False 3h10m
config-operator 4.18.13 True False False 3h10m
console 4.18.13 True False False 172m
control-plane-machine-set 4.18.13 True False False 3h10m
csi-snapshot-controller 4.18.13 True False False 3h2m
dns 4.18.13 True False False 76s
etcd 4.18.13 True False False 3h8m
image-registry 4.18.13 True False False 3h1m
ingress 4.18.13 True False False 59s
insights 4.18.13 True False False 3h10m
kube-apiserver 4.18.13 True False False 3h7m
kube-controller-manager 4.18.13 True False False 3h7m
kube-scheduler 4.18.13 True False False 3h6m
kube-storage-version-migrator 4.18.13 True False False 3h2m
machine-api 4.18.13 True False False 3h9m
machine-approver 4.18.13 True False False 3h10m
machine-config 4.18.13 True False False 3h10m
marketplace 4.18.13 True False False 3h10m
monitoring 4.18.13 True False False 172m
network 4.18.13 True False False 3h10m
node-tuning 4.18.13 True False False 175m
olm 4.18.13 True False False 177m
openshift-apiserver 4.18.13 True False False 3h1m
openshift-controller-manager 4.18.13 True False False 3h6m
openshift-samples 4.18.13 True False False 3h1m
operator-lifecycle-manager 4.18.13 True False False 3h9m
operator-lifecycle-manager-catalog 4.18.13 True False False 3h9m
operator-lifecycle-manager-packageserver 4.18.13 True False False 3h2m
service-ca 4.18.13 True False False 3h10m
storage 4.18.13 True False False 3h10m&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Install</title><link>https://blog.kubeantony.com/archive/misc/install/</link><pubDate>Tue, 18 Nov 2025 08:15:14 +0800</pubDate><guid>https://blog.kubeantony.com/archive/misc/install/</guid><description>
&lt;h2&gt;Default monitoring stack components&lt;span class="hx:absolute hx:-mt-20" id="default-monitoring-stack-components"&gt;&lt;/span&gt;
&lt;a href="#default-monitoring-stack-components" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;img src="https://hackmd.io/_uploads/BJ4uqjte-x.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;元件 (Component)&lt;/th&gt;
&lt;th style="text-align: left"&gt;描述 (Description)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Cluster Monitoring Operator&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;CMO 是監控堆疊的核心元件。它負責部署、管理並自動更新 Prometheus 和 Alertmanager 執行個體、Thanos Querier、Telemeter Client 以及metrics targets。CMO 是由 Cluster Version Operator (CVO)所部署。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Prometheus Operator&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;位於 &lt;code&gt;openshift-monitoring&lt;/code&gt; 專案中的 Prometheus Operator，負責建立、設定和管理平台的 Prometheus 執行個體與 Alertmanager 執行個體。它還會根據 Kubernetes 標籤查詢 (label queries) 自動產生監控目標設定。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Prometheus&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;OpenShift Container Platform 監控堆疊是基於 Prometheus 監控系統。Prometheus 是一個時間序列資料庫 (time-series database) 和用於指標的規則評估引擎 (rule evaluation engine)。Prometheus 會將警示 (alerts) 傳送至 Alertmanager 進行處理。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Metrics Server&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Metrics Server 元件（上圖中的 MS）收集資源指標 (resource metrics)，並將它們公開在 &lt;code&gt;metrics.k8s.io&lt;/code&gt; Metrics API 服務中，以供其他工具和 API 使用，這使得核心平台的 Prometheus 堆疊無需處理此功能。請注意，自 OpenShift Container Platform 4.16 版本起，Metrics Server 取代了 Prometheus Adapter。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Alertmanager&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Alertmanager 服務處理從 Prometheus 接收到的警示。Alertmanager 還負責將警示傳送到外部通知系統。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;kube-state-metrics agent&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;kube-state-metrics 匯出器代理程式（exporter agent）（上圖中的 KSM）將 Kubernetes 物件 (objects) 轉換為 Prometheus 可以使用的指標。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;monitoring-plugin&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;monitoring-plugin dynamic plugin 元件，負責在 OpenShift Container Platform 網站主控台 (web console) 的「Observe」區塊中部署監控頁面。您可以使用 Cluster Monitoring Operator 的 config map 設定來管理網站主控台頁面的 monitoring-plugin 資源。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;openshift-state-metrics agent&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;openshift-state-metrics 匯出器（上圖中的 OSM）擴展了 kube-state-metrics 的功能，增加了 OpenShift Container Platform 特定資源的指標。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;node-exporter agent&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;node-exporter 代理程式（上圖中的 NE）收集叢集中每個節點 (node) 的指標。node-exporter 代理程式會部署在每個節點上。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Thanos Querier&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Thanos Querier 在一個單一的多租戶 (multi-tenant) 介面下，彙總 (aggregates) 核心 OpenShift Container Platform 指標和使用者定義專案的指標，並可選擇性地進行重複資料刪除 (deduplicates)。&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;&lt;strong&gt;Telemeter Client&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align: left"&gt;Telemeter Client 將來自平台 Prometheus 執行個體的資料子集傳送到 Red Hat，以實現叢集的遠端健康狀況監控。&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</description></item><item><title>Set up VMware Aria Operations configuration for third-party Prometheus exporters</title><link>https://blog.kubeantony.com/archive/virtualization/set-up-vmware-aria-operations-configuration-for-third-party-prometheus-exporters/</link><pubDate>Fri, 14 Nov 2025 08:12:42 +0800</pubDate><guid>https://blog.kubeantony.com/archive/virtualization/set-up-vmware-aria-operations-configuration-for-third-party-prometheus-exporters/</guid><description>
&lt;p&gt;The steps to set up the configuration file for the first time are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;點擊左側選單 -&amp;gt; Operations -&amp;gt; Configuration -&amp;gt; Management packs Configuration
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/r18Tg930ex.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;點擊 ADD
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1Trb93Agx.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;填入以下內容：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;k8s-custom-prom-metric-mappings.xml&lt;/code&gt;
注意，設定檔的名字不能更改，只能設定這名字
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1UYGch0lx.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;li&gt;設定值如下：
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;&amp;lt;MappingDefinitions&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;xmlns:xs=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;http://www.w3.org/2001/XMLSchema&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;CustomMetricConfig&lt;/span&gt; &lt;span class="na"&gt;collectCustomMetrics=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;enableAllLabels=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelNamesToExclude=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;beta_kubernetes_io_os,container_label_annotation_io_kubernetes_container_hash,container_label_annotation_io_kubernetes_container_ports,container_label_annotation_io_kubernetes_container_restartCount,container_label_annotation_io_kubernetes_container_terminationMessagePath,container_label_annotation_io_kubernetes_container_terminationMessagePolicy,container_label_annotation_io_kubernetes_pod_terminationGracePeriod,container_label_annotation_kubeadm_kubernetes_io_etcd_advertise_client_urls,container_label_annotation_kubeadm_kubernetes_io_kube_apiserver_advertise_address_endpoint,container_label_annotation_kubernetes_io_config_hash,container_label_annotation_kubernetes_io_config_seen,container_label_annotation_kubernetes_io_config_source,container_label_app,container_label_app_kubernetes_io_name,container_label_app_kubernetes_io_version,container_label_component,container_label_controller_revision_hash,container_label_description,container_label_io_kubernetes_container_logpath,container_label_io_kubernetes_docker_type,container_label_io_kubernetes_pod_uid,container_label_io_kubernetes_sandbox_id,container_label_k8s_app,container_label_maintainer,container_label_maintainers,container_label_pod_template_generation,container_label_pod_template_hash,container_label_purpose,container_label_tier,container_label_version,container_runtime_version,dockerVersion,goversion,image,image_id,instance,timezone,container_label_io_kubernetes_container_name,container_label_io_kubernetes_pod_name,container_label_io_kubernetes_pod_namespace,name&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;maxGroupNames=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;3&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/CustomMetricConfig&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;IdentifierMappings&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;NodeIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingNodeName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;nodename,node_name,node,kubernetes_node_name&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;NamespaceIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingNamespaceName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;namespace,kubernetes_namespace,container_label_io_kubernetes_pod_namespace,source_workload_namespace&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;PodIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingPodName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;pod,pod_name,podname,container_label_io_kubernetes_pod_name&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;ContainerIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContaingContainerID=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;id,container_id&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingContainerName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;container_name,container&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;DeploymentIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingDeploymentName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;deployment&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;ReplicasetIdentifierMapping&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;labelContainingReplicasetName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;replicaset&amp;#34;&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/IdentifierMappings&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MappingDefinition&lt;/span&gt; &lt;span class="na"&gt;resourceKind=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;namespace&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-PVC-Prometheus&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;persistentvolumeclaim&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Persistent Volume Claim Size in Bytes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Bytes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;kube_persistentvolumeclaim_resource_requests_storage_bytes{namespace=&amp;#34;$NAMESPACE_NAME&amp;#34;}&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;persistentvolumeclaim&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-ETCD-Prometheus&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;operation,resource&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Etcd Request Duration Seconds Sum&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_sum&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_sum&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;operation,resource&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Etcd Request Duration Seconds Count&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_count&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_count&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;operation,resource&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Average Per Request Latency&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sec&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;rate(etcd_request_duration_seconds_sum[5m]) / rate(etcd_request_duration_seconds_count[5m])&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_average_request_latency&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Average Request Latency&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sec&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;sum(rate(etcd_request_duration_seconds_sum[5m])) / sum(rate(etcd_request_duration_seconds_count[5m]))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_average_request_latency&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;operation,resource&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Etcd Request Duration Seconds bucket&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_bucket&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_duration_seconds_bucket&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD P95 Request Duration&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.95, sum by (le) (rate(etcd_request_duration_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_p95_request_duration&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD P99 Request Duration&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.99, sum by (le) (rate(etcd_request_duration_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_p99_request_duration&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Request Error Rate (%)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;( sum(rate(etcd_request_errors_total[5m])) / sum(rate(etcd_requests_total[5m])) ) * 100&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_error_rate&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Request Rate (RPS)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;sum(rate(etcd_requests_total[1m]))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_request_rate&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-API-Server-Prometheus&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server Request Execution Duration (p95)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.95, sum by (le) (rate(apiserver_flowcontrol_request_execution_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_request_execution_duration_p95&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server Request Execution Duration (p99)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.99, sum by (le) (rate(apiserver_flowcontrol_request_execution_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_request_execution_duration_p99&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server Request Wait Duration (p95)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.95, sum by (le) (rate(apiserver_flowcontrol_request_wait_duration_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_request_wait_duration_p95&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server Request Wait Duration (p99)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.99, sum by (le) (rate(apiserver_flowcontrol_request_wait_duration_seconds_bucket[5m])))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_request_wait_duration_p99&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server 5xx Error Rate (%)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;(sum(rate(apiserver_flowcontrol_dispatched_requests_total{code=~&amp;#34;5..&amp;#34;}[5m])) or vector(0)) / sum(rate(apiserver_flowcontrol_dispatched_requests_total[5m])) * 100&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_5xx_error_rate&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server In-flight Requests&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;100 * sum(apiserver_current_inflight_requests) / clamp_min(max_over_time((sum(apiserver_current_inflight_requests))[7d:5m]), 1)&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_in_flight_requests&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;API Server Long-running Requests&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;100 * sum(apiserver_longrunning_requests) / avg_over_time((sum(apiserver_longrunning_requests))[7d:5m])&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;api_server_long_running_requests&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-CoreDNS-Prometheus&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CoreDNS DNS Query P95 Latency&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;histogram_quantile(0.95, sum(rate(coredns_dns_request_duration_seconds_bucket[5m])) by (le))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;coredns-dns-query-p95-latency&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CoreDNS DNS Query Rate&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;sum(rate(coredns_dns_requests_total[1m]))&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;coredns-dns-query-rate&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MappingDefinition&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MappingDefinition&lt;/span&gt; &lt;span class="na"&gt;resourceKind=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;container&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-Prometheus&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Status Running&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;kube_pod_container_status_running&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;kube_pod_container_status_running&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Pod Restart Count&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;increase(kube_pod_container_status_restarts_total[1h])&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;pod-restart-count&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Container Cpu Usage Seconds Total[5m]&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;sec&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;sum(rate(container_cpu_usage_seconds_total{namespace=&amp;#34;$NAMESPACE_NAME&amp;#34;,container=&amp;#34;$CONTAINER_NAME&amp;#34;}[5m])) * 100&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;container_cpu_usage_seconds_total[5m]&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MappingDefinition&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MappingDefinition&lt;/span&gt; &lt;span class="na"&gt;resourceKind=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;node&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-filesystem&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;mountpoint&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Filesystem Avail Space&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Bytes&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;promMetricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;node_filesystem_avail_bytes&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;mountpoint&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Filesystem Size&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Bytes&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;promMetricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;node_filesystem_size_bytes&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;MetricGroup&lt;/span&gt; &lt;span class="na"&gt;groupName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;CXS-ETCD_metrics&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;isInstanced=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Database Used Size&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Bytes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_mvcc_db_total_size_in_bytes&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_mvcc_db_total_size_in_bytes&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Database Backend Size&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Bytes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_server_quota_backend_bytes&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_server_quota_backend_bytes&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;Metric&lt;/span&gt; &lt;span class="na"&gt;instancedLabelName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;ETCD Database Usage(%)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;metricUnit=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;isRate=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;false&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;rule=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;(etcd_mvcc_db_total_size_in_bytes / etcd_server_quota_backend_bytes) * 100&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;ruleName=&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;etcd_server_db_usage&amp;#39;&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MetricGroup&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;lt;/MappingDefinition&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;&amp;lt;/MappingDefinitions&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="複製程式碼"
aria-label="複製程式碼"
data-copied-label="已複製！"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;點擊左下角 SAVE 按鈕
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/H1DiET0y-x.png" alt="image" loading="lazy" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;讓 operations 重新套用設定檔 (1)&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1vlOaAyWl.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rJ2D_6Akbe.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/By28VR0y-g.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;讓 operations 重新套用設定檔 (2)
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BJ3vrACk-e.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/rk1oBCC1Ze.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;看 log
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/S1fUIA0yWe.png" alt="image" loading="lazy" /&gt;
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/B1zCUCRk-l.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;確認有收到 Metrics
&lt;img src="https://blog.kubeantony.com/images/hackmd-uploads/BkJQED4x-e.png" alt="image" loading="lazy" /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;參考文件&lt;span class="hx:absolute hx:-mt-20" id="參考文件"&gt;&lt;/span&gt;
&lt;a href="#%e5%8f%83%e8%80%83%e6%96%87%e4%bb%b6" class="subheading-anchor" aria-label="此章節的永久連結"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a
href="https://techdocs.broadcom.com/us/en/vmware-cis/aria/aria-operations-for-integrations/2-2/vrealize--operations-management-pack--for-pack-for-kubernetes-2-2/monitoring-kubernetes/monitoring-using-prometheus/set-up-vrops-configuration-for-third-party-prometheus-exporters.html"target="_blank" rel="noopener"&gt;Set up VMware Aria Operations configuration for third-party Prometheus exporters - Broadcom Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>