技能 istio-traffic-management
🔀

istio-traffic-management

安全

專業管理 Istio 流量

也可從以下取得: wshobson

透過生產就緒的模板簡化服務網格配置,涵蓋路由、金絲雀部署、斷路器和流量轉移。使用經過驗證的模式消除反覆試錯。

支援: Claude Codex Code(CC)
🥉 72 青銅
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「istio-traffic-management」。 建立具有 10% 流量的金絲雀部署

預期結果:

生成 VirtualService 進行加權路由(90% 穩定,10% 金絲雀),以及 DestinationRule 定義兩個帶有版本標籤的 subsets

正在使用「istio-traffic-management」。 為 orders 服務新增重試和超時

預期結果:

建立 VirtualService,包含 3 次重試、每次 3 秒超時,以及 orders 主機總體 10 秒超時

正在使用「istio-traffic-management」。 為 checkout 服務設定斷路器

預期結果:

生成 DestinationRule,包含連線池限制和異常檢測,包括 consecutive5xxErrors 和 baseEjectionTime

安全審計

安全
v1 • 2/25/2026

All static analysis findings are false positives. The skill contains only YAML configuration templates and documentation for Istio traffic management. The 'external commands' flagged are bash commands in markdown documentation blocks (istioctl commands). The 'weak cryptographic algorithm' warnings are triggered by Istio API version strings (v1beta1) in YAML headers, not actual crypto. The 'hardcoded URLs' are legitimate links to official Istio documentation. No executable code, no security risks, no prompt injection attempts detected.

1
已掃描檔案
340
分析行數
1
發現項
1
審計總數
低風險問題 (1)
Static Analysis False Positives
All 44 detected patterns are false positives from documentation and YAML templates. The 'external_commands' patterns are bash commands in markdown code blocks (istioctl). The 'weak cryptographic algorithm' patterns are Istio API version strings (v1beta1). The 'hardcoded URLs' are official documentation links.
審計者: claude

品質評分

38
架構
100
可維護性
87
內容
32
社群
100
安全
100
規範符合性

你能建構什麼

平台工程師設定金絲雀部署

配置從穩定版本到金絲雀版本的漸進式流量轉移,包含加權路由和失敗時自動回滾。

DevOps 工程師實作韌性模式

新增斷路器、重試和超時以防止連鎖故障並提高服務可靠性。

SRE 偵錯流量路由問題

使用 istioctl 命令分析和驗證生產叢集中的 VirtualService 和 DestinationRule 配置。

試試這些提示

建立基本服務路由
為 my-service 建立 VirtualService,根據 x-user header 路由流量。將 header 值為 'beta' 的使用者發送到 v2 subset,其他所有發送到 v1。
配置金絲雀部署
為 payment-service 設定金絲雀部署。將 95% 流量路由到穩定版本,5% 到金絲雀版本。包含帶有兩個 subsets 的 DestinationRule。
新增斷路器保護
為 api-service 建立 DestinationRule,包含斷路器設定:最大 100 個連線、1000 個 HTTP 請求、連續 5 次錯誤後移除 pods、30 秒基礎移除時間。
配置流量鏡像
設定從生產環境到 staging 環境的流量鏡像。鏡像 100% 請求到 v2 subset 進行測試,不影響即時流量。

最佳實務

  • 在套用至生產環境前,始終使用 istioctl analyze 測試 Istio 配置
  • 從簡單的 VirtualService 規則開始,逐步增加複雜性
  • 部署新路由規則後,使用 Kiali 儀表板監控流量模式
  • 使用有意義的 subset 名稱(stable、canary、v1、v2)並一致性地標籤服務

避免

  • 不要配置無限制的重試 - 這可能導致連鎖故障
  • 避免將流量鏡像到生產資料庫 - 僅鏡像到測試環境
  • 切勿跳過 DestinationRules 中的 subset 驗證 - 未定義的 subsets 會導致路由失敗
  • 不要立即使用 100% 金絲雀權重 - 始終從小百分比開始

常見問題

VirtualService 和 DestinationRule 之間有什麼區別?
VirtualService 控制流量如何路由到目的地(路由規則)。DestinationRule 定義路由後套用的策略(負載均衡、斷路器、subsets)。
如何逐漸增加金絲雀流量?
逐步更新 VirtualService 中的 weight 值(5%、10%、25%、50%、100%)。在每個步驟監控指標後再繼續。
為什麼我的流量沒有到達金絲雀 subset?
驗證 pods 具有與 DestinationRule subsets 匹配的正確版本標籤。檢查 istioctl proxy-config endpoints 以查看哪些 endpoints 已註冊。
我可以在未安裝 Istio 的情況下使用此技能嗎?
不可以。此技能提供 Istio 配置模板。在套用這些資源之前,必須在 Kubernetes 叢集中安裝 Istio。
如何偵錯路由問題?
使用 istioctl analyze 驗證配置,使用 istioctl proxy-config routes 查看有效路由,使用 istioctl proxy-config log 啟用偵錯記錄。
流量鏡像用於什麼目的?
流量鏡像將即時請求的副本發送到鏡像服務(通常是 v2 或 staging)進行測試,不影響真實使用者。鏡像響應會被忽略。

開發者詳情

檔案結構

📄 SKILL.md