技能 istio-traffic-management
🔀

istio-traffic-management

安全

像专业人士一样管理 Istio 流量

也可从以下获取: wshobson

通过生产就绪的模板简化 Istio 服务网格配置,涵盖路由、金丝雀部署、断路器和流量切换。使用经过验证的模式消除试错过程。

支持: Claude Codex Code(CC)
🥉 75 青铜
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“istio-traffic-management”。 创建一个 10% 流量的金丝雀部署

预期结果:

生成带有基于权重路由的 VirtualService(90% 稳定版本,10% 金丝雀版本��和定义带有版本标签的两个 subset 的 DestinationRule

正在使用“istio-traffic-management”。 为订单服务添加重试和超时

预期结果:

创建带有 3 次重试尝试、每次尝试 3 秒超时和 10 秒总体超时的订单主机 VirtualService

正在使用“istio-traffic-management”。 为结账服务设置断路器

预期结果:

生成带有连接池限制和异常检测的 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
内容
50
社区
100
安全
100
规范符合性

你能构建什么

平台工程师配置金丝雀部署

配置从稳定版本到金丝雀版本的渐进式流量推送,通过加权路由实现故障时自动回滚。

DevOps 工程师实施弹性模式

添加断路器、重试和超时机制,防止级联故障并提高服务可靠性。

SRE 调试流量路由问题

使用 istioctl 命令分析和验证生产集群中的 VirtualService 和 DestinationRule 配置。

试试这些提示

创建基本服务路由
为 my-service 创建一个 VirtualService,根据 x-user header 路由流量。将 header 值为 'beta' 的用户发送到 v2 subset,其他所有用户发送到 v1。
配置金丝雀部署
为 payment-service 设置金丝雀部署。将 95% 的流量路由到稳定版本,5% 路由到金丝雀版本。包含带有两个 subset 的 DestinationRule。
添加断路器保护
为 api-service 创建带有断路器设置的 DestinationRule:最多 100 个连接,1000 个 HTTP 请求,5 次连续错误后弹出 pod,基础弹出时间 30 秒。
配置流量镜像
设置从生产到预发布环境的流量镜像。将 100% 的请求镜像到 v2 subset 进行测试,而不影响实时流量。

最佳实践

  • 在应用配置到生产环境之前,始终使用 istioctl analyze 测试 Istio 配置
  • 从简单的 VirtualService 规则开始,逐步增加复杂性
  • 部署新路由规则后,使用 Kiali 仪表板监控流量模式
  • 使用有意义的 subset 名称(stable、canary、v1、v2)并一致地为服务添��标签

避免

  • 不要配置无限制的重试 - 这可能导致级联故障
  • 避免将流量镜像到生产数据库 - 仅镜像到测试环境
  • 永远不要跳过 DestinationRule 中的 subset 验证 - 未定义的 subset 会导致路由失败
  • 不要立即使用 100% 金丝雀权重 - 始终从小百分比开始

常见问题

VirtualService 和 DestinationRule 有什么区别?
VirtualService 控制流量如何路由到目的地(路由规则)。DestinationRule 定义路由后应用的策略(负载均衡、断路器、subset)。
如何逐步增加金丝雀流量?
逐步更新 VirtualService 中的权重值(5%、10%、25%、50%、100%)。在继续之前监控每一步的指标。
为什么我的流量没有到达金丝雀 subset?
验证 pod 具有与 DestinationRule subset 匹配的正确版本标签。检查 istioctl proxy-config endpoints 以查看注册了哪些端点。
我可以在没有安装 Istio 的情况下使用此技能吗?
不可以。此技能提供 Istio 配置模板。在应用这些资源之前,您必须在 Kubernetes 集群中安装 Istio。
如何调试路由问题?
使用 istioctl analyze 验证配置,istioctl proxy-config routes 查看有效路由,istioctl proxy-config log 启用调试日志。
流量镜像用于什么?
流量镜像将实时请求的副本发送到镜像服务(通常是 v2 或 staging)进行测试,而不影响真实用户。镜像响应将被忽略。

开发者详情

文件结构

📄 SKILL.md