Google Cloud Platform (GCP)

Google Cloud Platform (GCP)#

简介#

此模块将 AIBrix 集群完整部署到 Google 容器集群上。这是使用 AIBrix 启动和运行的最快方式。此模块的目的是既允许开发人员快速启动堆栈,又允许团队在 Google Cloud Platform 上进行测试。

警告

  1. 创建此模块是为了允许用户在 GCP 上快速启动 AIBrix。它目前不适用于生产部署。用户应对运行此模块所产生的所有费用负责。

  2. 此模块使用 Terraform 作为基础设施即代码工具。如果您正在寻找其他方法,请随时提出问题

快速入门#

先决条件#

步骤#

  1. 更改目录到模块位置:cd /deployment/terraform/gcp

  2. 运行 gcloud auth application-default login 以设置 Google 凭据。

  3. 使用 gcloud components install gke-gcloud-auth-plugin 安装集群身份验证插件。

  4. terraform.tfvars.example 重命名为 terraform.tfvars 并填写所需的变量。您也可以在此处添加任何可选的覆盖。

  5. 运行 terraform init 初始化模块。

  6. 运行 terraform plan 以查看此模块创建的资源的详细信息。

  7. 当您对计划满意并希望创建资源时,运行 terraform apply

    注意

    如果在运行脚本时收到 NodePool aibrix-gpu-nodes was created in the error state "ERROR",请检查您的 GPU 配额以及您尝试部署的特定实例。

  8. 等待模块运行完成。它将输出一个命令以接收 Kubernetes 配置文件和一个公共 IP 地址。

  9. 针对公共 IP 运行命令

    ENDPOINT="<YOUR PUBLIC IP>"
    
    curl http://${ENDPOINT}/v1/chat/completions \
        -H "Content-Type: application/json" \
        -d '{
            "model": "deepseek-r1-distill-llama-8b",
            "messages": [
                {"role": "system", "content": "You are a helpful assistant."},
                {"role": "user", "content": "help me write a random generator in python"}
            ]
        }'
    
  10. 当您完成测试并且不再需要资源时,运行 terraform destroy

警告

请务必在尝试完成后执行此步骤,因为 GPU 成本高昂。

输入#

名称

描述

类型

默认

必需

aibrix_release_version

要部署的 AIBrix 版本。

string

“v0.2.0”

cluster_name

GKE 集群的名称。

string

“aibrix-inference-cluster”

cluster_zone

部署集群的区域。如果未提供,将部署到默认区域。

string

“”

default_region

部署资源的默认区域。

string

不适用

deploy_example_model

是否部署示例模型。

bool

true

node_pool_machine_count

节点池的机器数量。

number

1

node_pool_machine_type

节点池的机器类型。必须是 A3、A2 或 G2 系列。

string

“g2-standard-4”

node_pool_name

GPU 节点池的名称。

string

“aibrix-gpu-nodes”

node_pool_zone

部署 GPU 节点池的区域。如果未提供,将部署到默认区域中具有机器类型容量的区域。

string

“”

project_id

部署资源的 GCP 项目。

string

不适用

输出#

名称

描述

aibrix_service_public_ip

AIBrix 服务的公共 IP 地址。

configure_kubectl_command

运行该命令将允许 kubectl 访问。

模块#

名称

来源

版本

aibrix

deployment/terraform/kubernetes

不适用

cluster

deployment/terraform/gcp/cluster

不适用

提供商#

名称

版本

google

6.22.0

kubernetes

2.36.0