為 Gemini Enterprise Agent Platform 資源設定 Private Service Connect 介面

本指南說明如何為 Gemini Enterprise Agent Platform 資源設定「Private Service Connect 介面」

您可以為 Gemini Enterprise Agent Platform 中的特定資源設定 Private Service Connect 介面連線,包括:

VPC 對等互連連線不同,Private Service Connect 介面連線是遞移性連線。這樣一來,消費者虛擬私有雲網路中需要的 IP 位址就會減少。因此您可以更彈性地連線至 Google Cloud 專案和地端部署環境中的其他虛擬私有雲網路。

本指南適用於熟悉 Google Cloud 網路概念的網路管理員。

目標

本指南涵蓋下列工作:

  • 設定消費者虛擬私有雲 網路、子網路和網路連結。
  • 在 Google Cloud 網路主專案中新增防火牆規則。
  • 建立 Agent Platform 資源,並指定網路附件,以使用 Private Service Connect 介面。

事前準備

按照下列操作說明建立或選取 Google Cloud 專案,並設定專案,以便搭配 Gemini Enterprise Agent Platform 和 Private Service Connect 使用。

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Gemini Enterprise Agent Platform, Compute Engine, and Cloud Storage APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  5. 安裝 Google Cloud CLI。

  6. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  7. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  8. 初始化 gcloud CLI 後,請更新 gcloud CLI 並安裝必要元件:

    gcloud components update
    gcloud components install beta
  9. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  10. Verify that billing is enabled for your Google Cloud project.

  11. Enable the Gemini Enterprise Agent Platform, Compute Engine, and Cloud Storage APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  12. 安裝 Google Cloud CLI。

  13. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  14. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  15. 初始化 gcloud CLI 後,請更新 gcloud CLI 並安裝必要元件:

    gcloud components update
    gcloud components install beta
  16. 如果您不是專案擁有者,且沒有專案 IAM 管理員 (roles/resourcemanager.projectIamAdmin)角色,請要求擁有者授予您包含 compute.networkAttachments.updatecompute.networkAttachments.updatecompute.regionOperations.get 權限的 IAM 角色,例如 Compute 網路管理員 (roles/compute.networkAdmin) 角色,以便管理網路資源。
  17. 將必要角色指派給 AI Platform 服務代理。如要瞭解在不同情境下應授予哪些角色,請參閱本文的「Gemini Enterprise Agent Platform 服務代理程式的必要角色」一節。

設定虛擬私有雲網路和子網路

如果沒有現有網路,請按照設定步驟建立新的虛擬私有雲網路。

  1. 建立虛擬私有雲網路:

    gcloud compute networks create NETWORK \
        --subnet-mode=custom
    

    NETWORK 替換為虛擬私有雲網路的名稱。

  2. 建立子網路:

    gcloud compute networks subnets create SUBNET_NAME \
        --network=NETWORK \
        --range=PRIMARY_RANGE \
        --region=REGION
    

    更改下列內容:

    • SUBNET_NAME:子網路名稱。
    • PRIMARY_RANGE:新子網路的主要 IPv4 範圍,採用 CIDR 標記法。

      以下是 Agent Platform 的 IP 規定和限制:

      • Agent Platform 建議使用 /28 子網路。
      • 網路附件的子網路支援 RFC 1918 和非 RFC 1918 位址,但 100.64.0.0/20 和 240.0.0.0/4 子網路除外。
      • Agent Platform 只能連線至可從指定網路路由傳輸的 RFC 1918 IP 位址範圍。
      • Agent Platform 無法連線至私用公開 IP 位址,或下列非 RFC 1918 範圍:

        • 100.64.0.0/20
        • 192.0.0.0/24
        • 192.0.2.0/24
        • 198.18.0.0/15
        • 198.51.100.0/24
        • 203.0.113.0/24
        • 240.0.0.0/4

      詳情請參閱「IPv4 子網路範圍」。

    • REGION:建立新子網路的 Google Cloud 區域。

建立網路連結

在 Shared VPC 部署作業中,請在主專案中建立用於網路附件的子網路,然後在服務專案中建立 Private Service Connect 網路附件。

以下範例說明如何建立網路附件,自動接受連線。

   gcloud compute network-attachments create NETWORK_ATTACHMENT_NAME \
       --region=REGION \
       --connection-preference=ACCEPT_AUTOMATIC \
       --subnets=SUBNET_NAME

NETWORK_ATTACHMENT_NAME 替換為網路附件的名稱。

如果網路連結是在與服務專案不同的專案中建立,呼叫 Gemini Enterprise 時,您需要傳遞完整的網路連結路徑。

Gemini Enterprise Agent Platform 服務代理角色

在建立網路連結的專案中,將 compute.networkAdmin 角色授予給同一個專案的 Gemini Enterprise Agent Platform 服務代理。如果這個專案與您使用 Agent Platform 的服務專案不同,請預先啟用 Agent Platform API。

如果您為 Agent Platform 指定要使用的Shared VPC 網路,並在服務專案中建立網路連結,請在您使用 Agent Platform 的服務專案中,將 VPC 主專案的 compute.networkUser 角色授予Agent Platform 服務代理

設定防火牆規則

系統會在用戶端虛擬私有雲中套用輸入防火牆規則,允許運算和地端部署端點與 Private Service Connect 介面網路連結子網路通訊。

您可以視需要設定防火牆規則。不過,我們建議您設定常見的防火牆規則,如下列範例所示。

  1. 建立防火牆規則,允許透過 TCP 通訊埠 22 進行 SSH 存取:

    gcloud compute firewall-rules create NETWORK-firewall1 \
        --network NETWORK \
        --allow tcp:22
    
  2. 建立防火牆規則,允許 TCP 通訊埠 443 上的 HTTPS 流量:

    gcloud compute firewall-rules create NETWORK-firewall2 \
        --network NETWORK \
        --allow tcp:443
    
  3. 建立允許 ICMP 流量 (例如 ping 要求) 的防火牆規則:

    gcloud compute firewall-rules create NETWORK-firewall3 \
        --network NETWORK \
        --allow icmp
    

設定私人 DNS 對等互連

如要讓透過 PSC-I 設定的 Vertex AI 訓練 工作或 Agent Runtime 代理程式,解析客戶管理的 Cloud DNS 區域中的私人 DNS 記錄,Agent Platform API 提供使用者可設定的機制,指定要與 Google 內部資源對等互連的 DNS 網域。進行下列額外設定:

  1. 將 DNS Peer(roles/dns.peer) 角色指派給您使用 Vertex AI 訓練或 Agent Runtime 服務的專案的 AI Platform 服務代理程式帳戶。如果您指定 Gemini Enterprise Agent Platform 使用「共用虛擬私有雲」網路,並在服務專案中建立網路連結,請在您使用 Agent Platform 的服務專案中,將 VPC 主專案的 DNS Peer(roles/dns.peer) 角色授予「AI Platform 服務代理」

  2. 建立防火牆規則,允許所有 ICMP、TCP 和 UDP 流量 (選用):

    gcloud compute firewall-rules create NETWORK-firewall4 \
        --network NETWORK
        --allow tcp:0-65535,udp:0-65535,icmp
        --source-ranges IP_RANGES
    
  3. 設定私人 DNS 區域,用於 DNS 解析和流量轉送。如要將 DNS 記錄新增至私人 DNS 區域,請參閱「新增資源記錄集」。

疑難排解

本節說明設定 Private Service Connect 時,與 Gemini Enterprise Agent Platform 相關的常見問題。

使用 Shared VPC 設定 Agent Platform 時,請在您使用 Agent Platform 的服務專案中建立網路附件。這種做法有助於避免特定錯誤訊息,例如:

_Please make sure that the Agent Platform API is enabled for the
project_, by ensuring the
necessary permissions and APIs are enabled in the correct project.

後續步驟