本主題說明如何刪除環境。如需簡介,請參閱「關於環境和環境群組」。
關於刪除環境
如要正確刪除環境,您必須進行多項設定變更,並將這些變更套用至叢集。這些變更包括從覆寫檔案中移除環境定義、刪除 synchronizer、runtime 和 udca 元件,最後重新套用覆寫,還原叢集,但不包含要刪除的環境。
您無法只刪除環境,是因為其他元素 (synchronizer、runtime 和 udca) 會透過內部設定連結至每個環境。您只能透過刪除並重新套用這些項目,才能正確刪除環境。
如何刪除環境
假設您有兩個環境,分別是 test 和 prod。在覆寫檔案中,定義可能如下所示:
...
envs:
- name: test
sslCertPath: "your_certpath/ingress-cert.crt"
sslKeyPath: "your_keypath/ingress-key.key"
hostAlias: "apitest.example.com"
serviceAccountPaths:
synchronizer: "your_keypath/synchronizer-manager-service-account.json
udca: "your_keypath/analytic-agent-service-account.json
- name: prod
sslCertPath: "your_certpath/ingress-cert.crt"
sslKeyPath: "your_keypath/ingress-key.key"
hostAlias: "apiprod.example.com"
serviceAccountPaths:
synchronizer: "your_keypath/synchronizer-manager-service-account.json
udca: "your_keypath/analytic-agent-service-account.json
...如要刪除 prod 環境,請按照下列步驟操作:
- 將原始覆寫檔案 (包含 prod 和 test 環境定義) 複製到新檔案,例如
prod-delete.yaml。 - 開啟
prod-delete.yaml。 - 從
envs中刪除test環境定義,只保留 prod 定義。例如:... envs: - name: prod sslCertPath: "your_certpath/ingress-cert.crt" sslKeyPath: "your_keypath/ingress-key.key" hostAlias: "apitest.example.com" serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json - 從
prod-delete.yaml移除所有其他內容,但cassandra設定 (如有) 除外:完成上述變更後,覆寫檔案應如下所示:
... envs: - name: prod sslCertPath: "your_certpath/ingress-cert.crt" sslKeyPath: "your_keypath/ingress-key.key" hostAlias: "apitest.example.com" serviceAccountPaths: synchronizer: "your_keypath/synchronizer-manager-service-account.json udca: "your_keypath/analytic-agent-service-account.json cassandra: replicaCount: 3 resources: requests: cpu: 3500m memory: 7Gi storage: storageClass: pd-ssd capacity: 10Gi - Run this command to delete the specified components:
apigeectl delete -f prod-delete.yaml -c runtime, udca, synchronizer
- 開啟原始覆寫檔案 (包含測試和正式環境定義的檔案)。
- 從
envs元素中刪除prod環境定義。您只希望檔案中存在test環境定義。 - 將修改後的覆寫檔案套用至叢集。這項指令會重新建立已刪除的元素,但由於省略了
prod環境,因此不會重新建立。apigeectl apply -f prod-delete.yaml -c runtime, udca, synchronizer
儲存變更。
- 開啟瀏覽器,然後前往 Apigee UI 的 Hybrid UI。
- 按照「在 Hybrid UI 中刪除現有環境」一文所述步驟移除環境。
您尚未完成設定。您現在必須更新混合式 UI 中的環境。