<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>apisix的部署方式 on 又LAG隨性筆記</title><link>https://www.lagagain.com/tags/apisix%E7%9A%84%E9%83%A8%E7%BD%B2%E6%96%B9%E5%BC%8F/</link><description>Recent content in apisix的部署方式 on 又LAG隨性筆記</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><lastBuildDate>Mon, 30 Nov 2026 06:30:00 +0800</lastBuildDate><atom:link href="https://www.lagagain.com/tags/apisix%E7%9A%84%E9%83%A8%E7%BD%B2%E6%96%B9%E5%BC%8F/index.xml" rel="self" type="application/rss+xml"/><item><title>Ch15 - APISIX 部署解密：全面解析「傳統」、「解耦」、「無中心獨立」部署策略</title><link>https://www.lagagain.com/post/2025-it%E9%90%B5%E4%BA%BA%E8%B3%BD-apisix%E4%BD%BF%E7%94%A8%E7%B6%93%E9%A9%97%E5%88%86%E4%BA%AB21/</link><pubDate>Mon, 30 Nov 2026 06:30:00 +0800</pubDate><guid>https://www.lagagain.com/post/2025-it%E9%90%B5%E4%BA%BA%E8%B3%BD-apisix%E4%BD%BF%E7%94%A8%E7%B6%93%E9%A9%97%E5%88%86%E4%BA%AB21/</guid><description>&lt;blockquote>
&lt;p>本系列文章於2025年，已在&lt;a href="https://ithelp.ithome.com.tw/users/20112470/ironman/8791">iT邦幫忙：【與雲原生精靈共舞：APISIX使用者的兩年旅程】&lt;/a>發布過。&lt;/p>
&lt;/blockquote>
&lt;h1 id="傳統模式與-etcdapisix-的經典架構">傳統模式與 etcd：APISIX 的經典架構&lt;/h1>
&lt;p>&lt;img src="https://i.ibb.co/FqYx1qVN/201124708-Qve6-Zsh-Vh.jpg" alt="傳統模式 with Dashboard">&lt;/p>
&lt;p>從「Quick Start」到目前為止，並沒有區分「資料平面(Data Plane)」和「控制平面(Control Plane)」。所建立的APISIX服務節點：都同時提供處理請求路由的能力外，也接受Admin API更新設定。這種運作模式下稱作「傳統模式(Traditional)」。至版本&lt;code>3.13&lt;/code>為止，APISIX有三種運作模式和一個實驗性模式。&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th align="left">&lt;/th>
&lt;th align="left">模式&lt;/th>
&lt;th align="left">角色&lt;/th>
&lt;th align="left">配置中心&lt;/th>
&lt;th align="left">設定來源&lt;/th>
&lt;th align="left">管理方式&lt;/th>
&lt;th align="left">適用情境&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td align="left">1&lt;/td>
&lt;td align="left">&lt;strong>傳統模式 (Traditional)&lt;/strong>&lt;/td>
&lt;td align="left">資料平面 + 控制平面&lt;/td>
&lt;td align="left">etcd&lt;/td>
&lt;td align="left">Admin API&lt;/td>
&lt;td align="left">Admin API&lt;/td>
&lt;td align="left">處理使用者請求與管理配置都在同一實例上。&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td align="left">2&lt;/td>
&lt;td align="left">&lt;strong>解耦模式 (Decoupled)&lt;/strong>&lt;/td>
&lt;td align="left">資料平面 / 控制平面&lt;/td>
&lt;td align="left">etcd&lt;/td>
&lt;td align="left">Admin API&lt;/td>
&lt;td align="left">Admin API&lt;/td>
&lt;td align="left">將資料處理與配置管理分開，適合大型部署或高可用性需求。&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td align="left">3&lt;/td>
&lt;td align="left">&lt;strong>獨立模式：檔案驅動 (File-driven)&lt;/strong>&lt;/td>
&lt;td align="left">資料平面&lt;/td>
&lt;td align="left">無&lt;/td>
&lt;td align="left">本地 YAML / JSON 檔案&lt;/td>
&lt;td align="left">本地檔案更新&lt;/td>
&lt;td align="left">不需要 etcd，配置從本地檔案加載並熱更新，適合 Kubernetes 或 CI/CD 自動化部署。&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td align="left">4&lt;/td>
&lt;td align="left">&lt;strong>獨立模式：API 驅動 (API-driven)&lt;/strong>&lt;/td>
&lt;td align="left">傳統&lt;/td>
&lt;td align="left">無&lt;/td>
&lt;td align="left">記憶體&lt;/td>
&lt;td align="left">Standalone Admin API&lt;/td>
&lt;td align="left">&lt;strong>實驗性功能&lt;/strong>，配置完全透過 API 進行，即時更新並儲存在記憶體中，不依賴任何檔案或外部配置中心。&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>(以上表格由AI協助整理)&lt;/p>
&lt;p>傳統模式下，&lt;code>apisix_config/config.yaml&lt;/code>實際包含這樣的預設設定：&lt;/p>
&lt;div class="highlight">&lt;pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">&lt;code class="language-yaml" data-lang="yaml">deployment: &lt;span style="color:#75715e"># Deployment configurations&lt;/span>
role: traditional &lt;span style="color:#75715e"># Set deployment mode: traditional, control_plane, or data_plane.&lt;/span>
role_traditional:
config_provider: etcd &lt;span style="color:#75715e"># Set the configuration center.&lt;/span>
&lt;/code>&lt;/pre>&lt;/div>&lt;p>其中&lt;code>deployment.role&lt;/code>申明了使用&lt;code>traditional&lt;/code>(傳統)作爲部署運作方式，並且&lt;code>deployment.role_traditional.config_provider&lt;/code>指定了&lt;code>etcd&lt;/code>作爲設定提供者。實際上ETCD是一個分散式鍵值對資料庫，並且如果將其視作傳統資料庫，整個架構就像是傳統軟體架構：AP+Database。&lt;/p>
&lt;p>類似無狀態但依賴資料庫的應用服務，如果直接變更資料庫內容，下次處理請求的結果也會有所不同。實際上Dashboard Web UI就是直接變更ETCD群集儲存的內容，間接反應回服務節點。且不同的是，APISIX並非完全無狀態應用服務，他會保留一份副本在記憶體，並訂閱ETCD群集好取得變更。&lt;/p>
&lt;h1 id="解構模式資料平面與控制平面的拆分">解構模式：「資料平面」與「控制平面」的拆分&lt;/h1>
&lt;p>&lt;img src="https://i.ibb.co/x0XDsn4/20112470-HGc-JXYVPUO.jpg" alt="解構模式">&lt;/p>
&lt;p>APISIX部署方式也可以將「資料平面」和「控制平面」拆分開來，這個模式下ETCD仍是兩個平面溝通的橋樑。「資料平面」專注在處理請求，並且可以依需求使用量做節點縮放；這種模式下，「控制平面」並不需要隨者資料平面共同縮放，可控的數量也讓Admin API的存取控制可以更容易管理。同樣地，Dashboard服務本身雖然不提供Admin API，但依然可以做到更新設定的效果。&lt;/p>
&lt;p>&lt;img src="https://i.ibb.co/jk6RmtJH/20112470-KAcq-Jqbtyh.jpg" alt="解構模式with Dashboard">&lt;/p></description></item></channel></rss>