Token导航 LogoToken导航TokenDH.com
运维和基础设施external-servicegithub未标认证来源可访问clear审计未展示

kafka-iac-deploymentKafka IAC 部署

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

416

周安装

17

GitHub Stars

127

下载量

133
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:kafka-iac-deployment(Kafka IAC 部署)
来源仓库:https://github.com/anton-abyzov/specweave
仓库路径:skills/kafka-iac-deployment
安装命令:
npx skills add https://github.com/anton-abyzov/specweave --skill kafka-iac-deployment
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/anton-abyzov/specweave --skill kafka-iac-deployment

简介

使用基础设施即代码方式部署和管理 Kafka 集群。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中的自动化运维。
  • 通过 GitHub 仓库安装,使用 npx skills add 命令添加技能。
  • Terraform 或 Ansible 脚本需经过沙箱环境测试后再上线。
  • 敏感参数如密码应通过 secrets manager 注入。

SKILL.md

Kafka Infrastructure as Code (IaC) Deployment

Expert guidance for deploying Apache Kafka using Terraform across multiple platforms.

When to Use This Skill

I activate when you need help with:

  • Terraform deployments: "Deploy Kafka with Terraform", "provision Kafka cluster"
  • Platform selection: "Should I use AWS MSK or self-hosted Kafka?", "compare Kafka platforms"
  • Infrastructure planning: "How to size Kafka infrastructure", "Kafka on AWS vs Azure"
  • IaC automation: "Automate Kafka deployment", "CI/CD for Kafka infrastructure"

What I Know

Available Terraform Modules

This plugin provides 3 production-ready Terraform modules:

1. Apache Kafka (Self-Hosted, KRaft Mode)

  • Location: plugins/specweave-kafka/terraform/apache-kafka/
  • Platform: AWS EC2 (can adapt to other clouds)
  • Architecture: KRaft mode (no ZooKeeper dependency)
  • Features:

- Multi-broker cluster (3-5 brokers recommended) - Security groups with SASL_SSL - IAM roles for S3 backups - CloudWatch metrics and alarms - Auto-scaling group support - Custom VPC and subnet configuration

  • Use When:

- ✅ You need full control over Kafka configuration - ✅ Running Kafka 3.6+ (KRaft mode) - ✅ Want to avoid ZooKeeper operational overhead - ✅ Multi-cloud or hybrid deployments

  • Variables: module "kafka" {source = "../../plugins/specweave-kafka/terraform/apache-kafka" environment = "production" broker_count = 3 kafka_version = "3.7.0" instance_type = "m5.xlarge" vpc_id = var.vpc_id subnet_ids = var.subnet_ids domain = "example.com" enable_s3_backups = true enable_monitoring = true}

2. AWS MSK (Managed Streaming for Kafka)

  • Location: plugins/specweave-kafka/terraform/aws-msk/
  • Platform: AWS Managed Service
  • Features:

- Fully managed Kafka service - IAM authentication + SASL/SCRAM - Auto-scaling (provisioned throughput) - Built-in monitoring (CloudWatch) - Multi-AZ deployment - Encryption in transit and at rest

  • Use When:

- ✅ You want AWS to manage Kafka operations - ✅ Need tight AWS integration (IAM, KMS, CloudWatch) - ✅ Prefer operational simplicity over cost - ✅ Running in AWS VPC

  • Variables: module "msk" {source = "../../plugins/specweave-kafka/terraform/aws-msk" cluster_name = "my-kafka-cluster" kafka_version = "3.6.0" number_of_broker_nodes = 3 broker_node_instance_type = "kafka.m5.large" vpc_id = var.vpc_id subnet_ids = var.private_subnet_ids enable_iam_auth = true enable_scram_auth = false enable_auto_scaling = true}

3. Azure Event Hubs (Kafka API)

  • Location: plugins/specweave-kafka/terraform/azure-event-hubs/
  • Platform: Azure Managed Service
  • Features:

- Kafka 1.0+ protocol support - Auto-inflate (elastic scaling) - Premium SKU for high throughput - Zone redundancy - Private endpoints (VNet integration) - Event capture to Azure Storage

  • Use When:

- ✅ Running on Azure cloud - ✅ Need Kafka-compatible API without Kafka operations - ✅ Want serverless scaling (auto-inflate) - ✅ Integrating with Azure ecosystem

  • Variables: module "event_hubs" {source = "../../plugins/specweave-kafka/terraform/azure-event-hubs" namespace_name = "my-event-hub-ns" resource_group_name = var.resource_group_name location = "eastus" sku = "Premium" capacity = 1 kafka_enabled = true auto_inflate_enabled = true maximum_throughput_units = 20}

Platform Selection Decision Tree

Need Kafka deployment? START HERE:

├─ Running on AWS?
│  ├─ YES → Want managed service?
│  │  ├─ YES → Use AWS MSK module (terraform/aws-msk)
│  │  └─ NO → Use Apache Kafka module (terraform/apache-kafka)
│  └─ NO → Continue...
│
├─ Running on Azure?
│  ├─ YES → Use Azure Event Hubs module (terraform/azure-event-hubs)
│  └─ NO → Continue...
│
├─ Multi-cloud or hybrid?
│  └─ YES → Use Apache Kafka module (most portable)
│
├─ Need maximum control?
│  └─ YES → Use Apache Kafka module
│
└─ Default → Use Apache Kafka module (self-hosted, KRaft mode)

Deployment Workflows

Workflow 1: Deploy Self-Hosted Kafka (Apache Kafka Module)

Scenario: You want full control over Kafka on AWS EC2

# 1. Create Terraform configuration
cat > main.tf <<EOF
module "kafka_cluster" {
  source = "../../plugins/specweave-kafka/terraform/apache-kafka"

  environment         = "production"
  broker_count        = 3
  kafka_version       = "3.7.0"
  instance_type       = "m5.xlarge"

  vpc_id     = "vpc-12345678"
  subnet_ids = ["subnet-abc", "subnet-def", "subnet-ghi"]
  domain     = "kafka.example.com"

  enable_s3_backups = true
  enable_monitoring = true

  tags = {
    Project     = "MyApp"
    Environment = "Production"
  }
}

output "broker_endpoints" {
  value = module.kafka_cluster.broker_endpoints
}
EOF

# 2. Initialize Terraform
terraform init

# 3. Plan deployment (review what will be created)
terraform plan

# 4. Apply (create infrastructure)
terraform apply

# 5. Get broker endpoints
terraform output broker_endpoints
# Output: ["kafka-0.kafka.example.com:9093", "kafka-1.kafka.example.com:9093", ...]

Workflow 2: Deploy AWS MSK (Managed Service)

Scenario: You want AWS to manage Kafka operations

# 1. Create Terraform configuration
cat > main.tf <<EOF
module "msk_cluster" {
  source = "../../plugins/specweave-kafka/terraform/aws-msk"

  cluster_name           = "my-msk-cluster"
  kafka_version          = "3.6.0"
  number_of_broker_nodes = 3
  broker_node_instance_type = "kafka.m5.large"

  vpc_id     = var.vpc_id
  subnet_ids = var.private_subnet_ids

  enable_iam_auth     = true
  enable_auto_scaling = true

  tags = {
    Project = "MyApp"
  }
}

output "bootstrap_brokers" {
  value = module.msk_cluster.bootstrap_brokers_sasl_iam
}
EOF

# 2. Deploy
terraform init && terraform apply

# 3. Configure IAM authentication
# (module outputs IAM policy, attach to your application role)

Workflow 3: Deploy Azure Event Hubs (Kafka API)

Scenario: You're on Azure and want Kafka-compatible API

# 1. Create Terraform configuration
cat > main.tf <<EOF
module "event_hubs" {
  source = "../../plugins/specweave-kafka/terraform/azure-event-hubs"

  namespace_name      = "my-kafka-namespace"
  resource_group_name = "my-resource-group"
  location            = "eastus"

  sku                  = "Premium"
  capacity             = 1
  kafka_enabled        = true
  auto_inflate_enabled = true
  maximum_throughput_units = 20

  # Create hubs (topics) for your use case
  hubs = [
    { name = "user-events",    partitions = 12 },
    { name = "order-events",   partitions = 6 },
    { name = "payment-events", partitions = 3 }
  ]
}

output "connection_string" {
  value = module.event_hubs.connection_string
  sensitive = true
}
EOF

# 2. Deploy
terraform init && terraform apply

# 3. Get connection details
terraform output connection_string

Infrastructure Sizing Recommendations

Small Environment (Dev/Test)

# Self-hosted: 1 broker, m5.large
broker_count  = 1
instance_type = "m5.large"

# AWS MSK: 1 broker per AZ, kafka.m5.large
number_of_broker_nodes = 3
broker_node_instance_type = "kafka.m5.large"

# Azure Event Hubs: Basic SKU
sku = "Basic"
capacity = 1

Medium Environment (Staging/Production)

# Self-hosted: 3 brokers, m5.xlarge
broker_count  = 3
instance_type = "m5.xlarge"

# AWS MSK: 3 brokers, kafka.m5.xlarge
number_of_broker_nodes = 3
broker_node_instance_type = "kafka.m5.xlarge"

# Azure Event Hubs: Standard SKU with auto-inflate
sku = "Standard"
capacity = 2
auto_inflate_enabled = true
maximum_throughput_units = 10

Large Environment (High-Throughput Production)

# Self-hosted: 5+ brokers, m5.2xlarge or m5.4xlarge
broker_count  = 5
instance_type = "m5.2xlarge"

# AWS MSK: 6+ brokers, kafka.m5.2xlarge, auto-scaling
number_of_broker_nodes = 6
broker_node_instance_type = "kafka.m5.2xlarge"
enable_auto_scaling = true

# Azure Event Hubs: Premium SKU with zone redundancy
sku = "Premium"
capacity = 4
zone_redundant = true
maximum_throughput_units = 20

Best Practices

Security Best Practices

  1. Always use encryption in transit

- Self-hosted: Enable SASL_SSL listener - AWS MSK: Set encryption_in_transit_client_broker = "TLS" - Azure Event Hubs: HTTPS/TLS enabled by default

  1. Use IAM authentication (when possible)

- AWS MSK: enable_iam_auth = true - Azure Event Hubs: Managed identities

  1. Network isolation

- Deploy in private subnets - Use security groups/NSGs restrictively - Azure: Enable private endpoints for Premium SKU

High Availability Best Practices

  1. Multi-AZ deployment

- Self-hosted: Distribute brokers across 3+ AZs - AWS MSK: Automatically multi-AZ - Azure Event Hubs: Enable zone_redundant = true (Premium)

  1. Replication factor = 3

- Self-hosted: default.replication.factor=3 - AWS MSK: Configured automatically - Azure Event Hubs: N/A (fully managed)

  1. min.insync.replicas = 2

- Ensures durability even if 1 broker fails

Cost Optimization

  1. Right-size instances

- Use ClusterSizingCalculator utility (in kafka-architecture skill) - Start small, scale up based on metrics

  1. Auto-scaling (where available)

- AWS MSK: enable_auto_scaling = true - Azure Event Hubs: auto_inflate_enabled = true

  1. Retention policies

- Set log.retention.hours based on actual needs (default: 168 hours = 7 days) - Shorter retention = lower storage costs

Monitoring Integration

All modules integrate with monitoring:

Self-Hosted Kafka

  • CloudWatch metrics (via JMX Exporter)
  • Prometheus + Grafana dashboards (see kafka-observability skill)
  • Custom CloudWatch alarms

AWS MSK

  • Built-in CloudWatch metrics
  • Enhanced monitoring available
  • Integration with CloudWatch Alarms

Azure Event Hubs

  • Built-in Azure Monitor metrics
  • Diagnostic logs to Log Analytics
  • Integration with Azure Alerts

Troubleshooting

"Terraform destroy fails on security groups"

Cause: Resources using security groups still exist Fix:

# 1. Find dependent resources
aws ec2 describe-network-interfaces --filters "Name=group-id,Values=sg-12345678"

# 2. Delete dependent resources first
# 3. Retry terraform destroy

"AWS MSK cluster takes 20+ minutes to create"

Cause: MSK provisioning is inherently slow (AWS behavior) Fix: This is normal. Use --auto-approve for automation:

terraform apply -auto-approve

"Azure Event Hubs: Connection refused"

Cause: Kafka protocol not enabled OR incorrect connection string Fix:

  1. Verify kafka_enabled = true in Terraform
  2. Use Kafka connection string (not Event Hubs connection string)
  3. Check firewall rules (Premium SKU supports private endpoints)

Integration with Other Skills

  • kafka-architecture: For cluster sizing and partitioning strategy
  • kafka-observability: For Prometheus + Grafana setup after deployment
  • kafka-kubernetes: For deploying Kafka on Kubernetes (alternative to Terraform)
  • kafka-cli-tools: For testing deployed clusters with kcat

Quick Reference Commands

# Terraform workflow
terraform init          # Initialize modules
terraform plan          # Preview changes
terraform apply         # Create infrastructure
terraform output        # Get outputs (endpoints, etc.)
terraform destroy       # Delete infrastructure

# AWS MSK specific
aws kafka list-clusters # List MSK clusters
aws kafka describe-cluster --cluster-arn <arn> # Get cluster details

# Azure Event Hubs specific
az eventhubs namespace list # List namespaces
az eventhubs eventhub list --namespace-name <name> --resource-group <rg> # List hubs

Next Steps After Deployment:

  1. Use kafka-observability skill to set up Prometheus + Grafana monitoring
  2. Use kafka-cli-tools skill to test cluster with kcat
  3. Deploy your producer/consumer applications
  4. Monitor cluster health and performance

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.36%
按下载量换算36

Cursor

23.49%
按下载量换算31

Antigravity

16.59%
按下载量换算22

Gemini CLI

13.66%
按下载量换算18

OpenCode

7.31%
按下载量换算10

Codex

3.28%
按下载量换算4

安全审计

暂无安全审计结果可展示。

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills