操作 GDC 網路

除了 Kubernetes 叢集資源、API 和預設 Kubernetes Pod 網路,GDC 還可讓您在 GDC 區域中佈建額外網路,並將這些網路與您的網路連線。舉例來說,如果使用使用者平面功能 (UPF),您可能會建立無線電存取網路 (RAN) 和資料平面網路,各自具有連線至 UPF Pod 的不同子網路。

如要進一步瞭解 Edge Network 資源,請參閱「網路」。

EdgeNetwork 藍圖

這個藍圖包含多個自訂資源,目的是讓使用者在 GDC 區域中佈建及設定額外網路,並將這些網路與您的網路連線。舉例來說,您可以建立作業、管理和維護 (OAM) 網路和訊號網路,每個網路都有多個不同的子網路,可連線至網路功能 Pod 的次要介面。EdgeNetwork 藍圖會使用下列資源:

  • EdgeNetwork:GDC 區域中的虛擬私人網路。封包會在 EdgeNetwork 內獨立路由。
  • EdgeRouter:GDC 區域中的邏輯資源,可設定 EdgeNetwork 的 BGP 相關參數。
  • EdgeSubnet:GDC 區域中的第 2 層網域和第 3 層子網路。EdgeSubnet 會建立為 VLAN,並在網路中具有相關聯的 VLAN ID。
  • EdgeInterconnectAttachment:在 GDC 區域路由器和其中一個 Provider Edge (PE) 路由器之間設定新的虛擬連結。您可以使用附件,將資源與網路 (例如網路上的虛擬路由和格式化 (VRF)) 連結。EdgeNetwork

建立部署作業時,您可以使用 setters.yaml 檔案中的下列參數自訂藍圖:

參數 說明
project-id 管理 EdgeNetwork 相關資源的專案 ID。您必須將 Edge 連結至這個特定專案 ID。
network-name 資源的名稱。EdgeNetwork
location GDC 區域的 Google Cloud 區域。例如:us-west-1
zone 要建立 EdgeNetwork 的 GDC 區域。
mtu EdgeNetwork 的 IP 最大傳輸單位 (MTU)。有效選項介於 15009000 之間。
interconnect-attachment-name 互連附件的名稱。
interconnect-attachment-vlanid 指派給互連網路連結的封包標記 VLAN ID。
interconnect-attachment-interface-ipv4cidr 連線至 EdgeInterconnectAttachment 資源的 EdgeRouter 介面 IP 位址。
interconnect-attachment-bgppeer-ipv4cidr BGP 工作階段的 GDC 區域對等互連端 IPv4 位址。
subnet-name 資源的名稱。EdgeSubnet
subnet-vlan-id 指派給 EdgeSubnet 資源的 VLAN ID。
subnet-ipv4cidr EdgeSubnet 資源的 IPv4 子網路。無類別跨網域路由 (CIDR) 中的第一個 IP 位址會保留做為子網路閘道。
subnet-bgppeer-ipv4cidr 對等互連端 BGP 的 IP 位址。IP 位址必須與 EdgeSubnet 資源位於同一個子網路。

設定具有兩個子網路的網路

本節說明如何設定包含兩個子網路的網路。舉例來說,範例網路 ran-network 有兩個子網路,分別是 ranaccess-1ranaccess-2。對於北向連線,ran-network 會為互連網路 cbae0a11-5d97-4bd6-8a09-e5133bb541caa52e2c74-84f2-4a6d-8cd2-7c5b0fc1c031 設定兩個互連網路連結。

匯入 EdgeNetwork 藍圖

  1. 按一下導覽選單中的「藍圖」
  2. 從下拉式選單中,選取偏好的 Orchestration 叢集。
  3. 按一下「從圖書館匯入」
  4. 選取藍圖「GDCE EdgeNetwork setup」
  5. 按一下「新增藍圖」
  6. 在下一個頁面中,指定藍圖名稱。例如 GDCE EdgeNetwork 設定
    1. 視需要新增標籤。
  7. 點按「Create」(建立)。藍圖會顯示在「草稿藍圖」清單中。

編輯藍圖

  1. 在導覽選單中,依序點選「藍圖」>「草稿藍圖」
  2. 選取要編輯的藍圖。藍圖編輯器隨即開啟。
  3. 根據規格編輯資源。
  4. 然後按一下「儲存檔案」

提出藍圖

  1. 在導覽選單中,依序點選「藍圖」>「草稿藍圖」。藍圖編輯器隨即顯示。
  2. 按一下「提議」。藍圖更新的狀態為「已提出」

核准藍圖

  1. 在導覽選單中,依序點選「藍圖」>「草稿藍圖」
  2. 按一下藍圖名稱旁的「動作」圖示。
  3. 選取「核准」。藍圖會顯示在「已核准的藍圖」中。

擷取互連資訊

如要擷取互連資訊,請執行下列操作:

  1. 設定及匯出環境變數:

    export networkName=NETWORK_NAME
    export MACHINES_LOCATION=MACHINE_LOCATION # value where machines or rack is located. Can be different from cluster location.
    export MACHINES_PROJECT_ID=PROJECT_ID # project in which machines or rack is registered. Can be different from cluster project
    export EDGE_ZONE=ZONE # Edge zone in which machines or rack is located
    

    更改下列內容:

    • NETWORK_NAME:網路名稱。
    • MACHINE_LOCATION:機器或機架的位置。這個值可能與叢集位置不同。
    • PROJECT_ID:註冊機器或機架的專案。這個值可能與叢集專案不同。
    • ZONE:機器或機架所在的 Edge 區域。
  2. 擷取互連資訊:

    gcloud alpha edge-cloud networking interconnects list --zone=$EDGE_ZONE --location=$MACHINES_LOCATION --project=$MACHINES_PROJECT_ID
    

    輸出結果大致如下。請記下互連網路的名稱和實體連接埠,以便套用至與網路的互連網路連結。

    NAME UUID
    DEVICECLOUDRESOURCENAME
    PHYSICALPORTS
    cbae0a11-5d97-4bd6-8a09-e5133bb541ca cbae0a11-5d97-4bd6-8a09-e5133bb541ca projects/81907970660/locations/us-central1-edge-den8/switches/et19.den97
    
    HundredGigE0/0/0/0,HundredGigE0/0/0/23
    a52e2c74-84f2-4a6d-8cd2-7c5b0fc1c031 a52e2c74-84f2-4a6d-8cd2-7c5b0fc1c031 projects/81907970660/locations/us-central1-edge-den8/switches/et19.den97 HundredGigE0/0/0/1,HundredGigE0/0/0/22
    37e5da97-1a3f-4935-9d9b-0a8cea589644 37e5da97-1a3f-4935-9d9b-0a8cea589644 projects/81907970660/locations/us-central1-edge-den8/switches/et20.den97 HundredGigE0/0/0/0,HundredGigE0/0/0/23
    71b54ef5-6b12-4b03-b8ce-eb88196f8a93 71b54ef5-6b12-4b03-b8ce-eb88196f8a93 projects/81907970660/locations/us-central1-edge-den8/switches/et20.den97 HundredGigE0/0/0/1,HundredGigE0/0/0/22
    

EdgeNetwork 部署作業

建立 EdgeNetwork 部署作業

  1. 依序點選導覽選單中的「藍圖」>「已核准的藍圖」
  2. 按一下要部署的 EdgeNetwork 藍圖。
  3. 按一下「建立部署作業」
  4. 提供部署作業的名稱。
  5. 按一下「建立部署作業」。部署作業會顯示在「草稿部署」中。

編輯 EdgeNetwork 部署作業

  1. 按一下導覽選單中的「藍圖」
  2. 按一下要編輯的 EdgeNetwork 藍圖。系統隨即會顯示部署編輯器。
  3. 編輯 setters.yaml 檔案。如要瞭解檔案中各個欄位的詳細資料,請參閱EdgeNetwork藍圖。以下 setters.yaml 檔案範例顯示完整設定:

    apiVersion: v1
    kind: ConfigMap
    metadata: # kpt-merge: /setters
      name: setters
      annotations:
        config.kubernetes.io/local-config: "true"
        internal.kpt.dev/upstream-identifier:'|ConfigMap|default|setters'
    data:
      # The project managing the GDC Edge machines.
      project-id: tna-testing-01
      # Name of the network
      network-name: ranprod
      # Location in which to create the resources
      location: us-central1
      # Zone to create in the resources
      zone: us-central1-edge-den8
      # Details of subnets for southbound peering
      # Details of subnet 1
      # Name of the subnet
      subnet1-name: ranaccess-prod1
      # vlanId for the subnet
      subnet1-vlanid: 2142
      # ipv4cidr for the subnet
      subnet1-ipv4cidr: 10.142.0.0/24
      # ipv4cidr for the subnet bgppeer
      subnet1-bgppeer-ipv4cidr: 10.142.0.0/24
      # Details of subnets for southbound peering
      # Details of subnet 1
      # Name of the subnet
      subnet2-name: ranaccess-prod2
      # vlanId for the subnet
      subnet2-vlanid: 2132
      # ipv4cidr for the subnet
      subnet2-ipv4cidr: 10.132.0.0/24
      # ipv4cidr for the subnet bgppeer
      subnet2-bgppeer-ipv4cidr: 10.132.0.0/24
      # Interconnect attachments for northbound peering
      # Details of interconnect attachment 1
      # Name of the interconnect
      interconnect1-name: cbae0a11-5d97-4bd6-8a09-e5133bb541ca
      # Name of the interconnect attachment
      interconnect1-attachment-name: prod1-ran
      # valnId of the interconnect attachment
      interconnect1-attachment-vlanid: 2010
      # ip4vcidr for the interconnect attachment interface
      interconnect1-attachment-interface-ipv4cidr:10.65.128.17/31  # ipv4cidr for the interconnect attachment bgppeer
      interconnect1-attachment-bgppeer-ipv4cidr: 10.65.128.16/31
      # Interconnect attachments for northbound peering
      # Details of interconnect attachment 1
      # Name of the interconnect
      interconnect2-name: a52e2c74-84f2-4a6d-8cd2-7c5b0fc1c031
      # Name of the interconnect attachment
      interconnect2-attachment-name: prod2-ran
      # valnId of the interconnect attachment
      interconnect2-attachment-vlanid: 2020
      # ip4vcidr for the interconnect attachment interface
      Interconnect2-attachment-interface-ipv4cidr:10.65.128.13/31 # ipv4cidr for the interconnect attachment bgppeer
      interconnect2-attachment-bgppeer-ipv4cidr: 10.65.128.12/31
    
  4. 然後按一下「儲存檔案」

套用 EdgeNetwork 部署作業

  1. 按一下導覽選單中的「部署」
  2. 選取要套用的 EdgeNetwork 部署作業。
  3. 點選「Deploy」(部署)
  4. 確認部署作業。部署作業會顯示在「已套用的部署作業」中。

驗證 EdgeNetwork 藍圖

如要驗證 EdgeNetwork 資源的建立狀態,請執行下列操作:

kubectl

  1. 為自動化調度管理叢集產生 kube-credentials,以便使用 kubectlCLI:

    gcloud anthos config controller get-credentials ORCHESTRATION_CLUSTER_NAME
    

    ORCHESTRATION_CLUSTER_NAME 替換為 Orchestration 叢集的名稱。

  2. 等待 30 到 40 分鐘,讓系統處理資源。

  3. 查看資源狀態:

    kubectl describe EdgeNetwork ${networkName} --namespace=tna-config-control
    

    輸出結果大致如下。請注意 status.conditions 中的 messagereason

    Name: ranprod
    Namespace: tna-config-control
    ....
    API Version: config.cloud.google.com/v1alpha1
    Kind: EdgeNetwork
    ....
    Spec:
      Mtu: 9000
      Network Location: us-central1
      Network Zone: us-central1-edge-den8
    Status:
      Conditions:
        Last Transition Time: 2023-03-23T10:08:40Z
        Message: The resource is up to date
        Reason: UpToDate
        Status: True
        Type: Ready
      Create Time: 2023-03-23T10:08:36.582479587Z
      Self Link:
      //gkehub.googleapis.com/v1/projects/tna-testing-01/locations/us-central1/zone s/us-central1-edge-den8/networks/ranprod
      Update Time: 2023-03-23T10:08:40.010036655Z
    Events: <none>
    
  4. 取得建立的 Edge 路由器資訊:

    kubectl describe EdgeRouter router-${networkName} --namespace=tna-config-control
    

    輸出結果會與下列內容相似:

    Name: router-ranprod
    Namespace: tna-config-control
    ...
    API Version: config.cloud.google.com/v1alpha1
    Kind: EdgeRouter
    ....
    Spec:
    .....
      Network:
        External: projects/tna-testing-01/locations/us-central1/zones/us-central1-edge-den8/net works/ranprod
        Object Ref:
          API Group:
          Kind:
          Name:
          Namespace:
      Router Location: us-central1
      Router Zone: us-central1-edge-den8
    Status:
      Bgp Peer:
        Interface: inf-ranaccess-prod1
        Name: 2142-bgp0
        Peer Asn: 3300
        peerIpv4Cidr: 10.142.0.0/24
        Interface: inf-ranaccess-prod2
        Name: 2132-bgp0
        Peer Asn: 3300
        peerIpv4Cidr: 10.132.0.0/24
        Interface: vlan-2010-prod1-ran
        interfaceIpv4Cidr: 10.65.128.17/31
        Name: vlan-2010-bgp0
        Peer Asn: 577
        peerIpv4Cidr: 10.65.128.16/31
        Interface: vlan-2020-prod2-ran
        interfaceIpv4Cidr: 10.65.128.13/31
        Name: vlan-2020-bgp1
        Peer Asn: 577
        peerIpv4Cidr: 10.65.128.12/31
      Conditions:
        Last Transition Time: 2023-03-23T10:47:12Z
        Message: The resource is up to date
        Reason: UpToDate
        Status: True
        Type: Ready
      Create Time: 2023-03-23T10:08:38.995964419Z
      Interface:
        Name: inf-ranaccess-prod1
        Subnetwork:
          API Group: config.cloud.google.com
          Kind: EdgeSubnet
          Name: ranaccess-prod1
          Namespace: tna-config-control
        Name: inf-ranaccess-prod2
        Subnetwork:
          API Group: config.cloud.google.com
          Kind: EdgeSubnet
          Name: ranaccess-prod2
          Namespace: tna-config-control
        ipv4Cidr: 10.65.128.17/31
        Linked Interconnect Attachment:
          API Group: config.cloud.google.com
          Kind: EdgeInterconnectAttachment
          Name: prod1-ran
          Namespace: tna-config-control
        Name: vlan-2010-prod1-ran
        ipv4Cidr: 10.65.128.13/31
        Linked Interconnect Attachment:
          API Group: config.cloud.google.com
          Kind: EdgeInterconnectAttachment
          Name: prod2-ran
          Namespace: tna-config-control
        Name: vlan-2020-prod2-ran
      Self Link: //gkehub.googleapis.com/v1/projects/tna-testing-01/locations/us-central1/zone s/us-central1-edge-den8/routers/router-ranprod
      State: STATE_RUNNING
      Update Time: 2023-03-23T10:36:58.126306756Z
    Events: <none>
    

gcloud

  • 取得建立的 Edge 路由器資訊:

    gcloud edge-cloud networking routers describe router-${networkName} \ --zone=$EDGE_ZONE \
    --location=$LOCATION \
    --project=GDCE_MACHINES_PROJECT
    

    GDCE_MACHINES_PROJECT 替換為 GDC 機器的註冊專案 ID。

    如要為使用者平面功能 (UPF) 設定網路,請針對每個網路重複執行這個步驟。

刪除 EdgeNetwork 部署作業

  1. 在導覽選單中,依序點選「Deployments」>「Applied Deployments」
  2. 選取要刪除的藍圖 EdgeNetwork
  3. 點選「刪除」。
  4. 確認刪除。
  5. 等待 30 到 45 分鐘,讓系統處理刪除作業。
  6. 如要確認資源已刪除,請重複「編輯 EdgeNetwork 部署作業」一節中的步驟。