Untuk menghapus lingkungan dengan benar, Anda harus melakukan beberapa perubahan konfigurasi dan menerapkannya ke cluster. Perubahan ini mencakup penghapusan definisi lingkungan dan
referensi ke lingkungan tersebut dari
file penggantian Anda, menghapus komponen synchronizer, runtime,
dan udca, dan terakhir menerapkan kembali penggantian untuk
memulihkan cluster tanpa
menyertakan lingkungan yang ingin Anda hapus.
Alasan Anda tidak dapat hanya menghapus lingkungan dalam satu langkah adalah karena elemen lain,
synchronizer, runtime,
dan udca terhubung ke setiap lingkungan melalui konfigurasi internalnya. Anda hanya dapat menghapus lingkungan dengan benar dengan menghapusnya dan menerapkannya kembali.
Cara menghapus lingkungan
Anggaplah Anda memiliki dua lingkungan, test dan prod. Dalam
file penggantian, definisinya mungkin terlihat seperti ini:
Buka file penggantian asli (file yang menyertakan definisi lingkungan pengujian dan produksi).
Hapus definisi lingkungan prod dari elemen envs dan
virtualhosts. Anda hanya ingin definisi lingkungan test ada dalam file.
Terapkan file penggantian yang diubah ke cluster Anda. Perintah ini akan membuat ulang elemen yang dihapus dan, karena dihilangkan, tidak akan membuat ulang lingkungan prod.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-05 UTC."],[[["\u003cp\u003eThis document details the process for deleting an environment in Apigee hybrid, which involves multiple steps due to interconnected configurations.\u003c/p\u003e\n"],["\u003cp\u003eDeleting an environment requires removing its definition and references from the overrides file, which include \u003ccode\u003esynchronizer\u003c/code\u003e, \u003ccode\u003eruntime\u003c/code\u003e, and \u003ccode\u003eudca\u003c/code\u003e components.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves creating a temporary overrides file, deleting specific component definitions, and then applying a modified original file to exclude the environment in question.\u003c/p\u003e\n"],["\u003cp\u003eAfter applying changes in the cluster, you must also delete the environment through the Apigee Hybrid UI to fully remove it from the system.\u003c/p\u003e\n"],["\u003cp\u003eThe current version of the documentation is out of date and should be upgraded to a supported version as noted at the top of the documentation page.\u003c/p\u003e\n"]]],[],null,["# Delete environments\n\n| You are currently viewing version 1.2 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n\n\nThis topic explains how to delete environments. For an introduction, see\n[About environments and environment groups](/apigee/docs/api-platform/fundamentals/environments-overview).\n\nAbout deleting environments\n---------------------------\n\n\nTo delete an environment properly, you must make several configuration changes and\napply them to your cluster. These changes include removing the environment definition and\nreferences to it from\nyour overrides file, deleting the `synchronizer`, `runtime`,\nand `udca` components, and finally re-applying your overrides to\nrestore your cluster without\nincluding the environment you wish to delete.\n\n\nThe reason you can't only delete the environment in one step is because the other elements,\n`synchronizer`, `runtime`,\nand `udca` are connected to each environment through their internal configurations. Only by\ndeleting them and re-applying them can you properly delete an environment.\n\nHow to delete an environment\n----------------------------\n\nAssume that you have two environments, **test** and **prod**. In\nyour overrides file, the definitions might look something like this:\n\n```\n...\nvirtualhosts:\n - name: default-test\n hostAliases: [\"api-test.example.com\"]\n sslCertPath: ./certs/fullchain-test.pem\n sslKeyPath: ./certs/privkey-test.pem\n env: test\n - name: default-prod\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n env: prod\n...\nenvs:\n - name: test\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n - name: prod\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n...\n```\n\nTo delete the **prod** environment, follow these steps:\n\n1. Copy your original overrides file -- the one that contains both the **prod** and **test** environment definitions -- to a new file called, for example, `prod-delete.yaml`.\n2. Open `prod-delete.yaml`.\n3. Delete the `test` environment definition from `envs` and `virtualhosts`, leaving only the **prod** definitions. For example: \n\n ```\n ...\n virtualhosts:\n - name: default-prod\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n env: prod\n ...\n envs:\n - name: prod\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n ...\n ```\n4. Remove everything else from `prod-delete.yaml` ***except*** the `cassandra` config, if present:\n\n\n After making the above changes, your overrides file should look something\n like this: \n\n ```\n ...\n virtualhosts:\n - name: default-prod\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n env: prod\n\n envs:\n - name: prod\n serviceAccountPaths:\n synchronizer: \"your_keypath/synchronizer-manager-service-account.json\n udca: \"your_keypath/analytic-agent-service-account.json\n\n cassandra:\n replicaCount: 3\n resources:\n requests:\n cpu: 3500m\n memory: 7Gi\n storage:\n storageClass: pd-ssd\n capacity: 10Gi\n ```\n5. Run this command to delete the specified components: \n\n ```\n apigeectl delete -f prod-delete.yaml -c runtime, udca, synchronizer\n ```\n6. Open your **original** overrides file (the one that includes both the test and prod environment definitions).\n7. Delete the `prod` environment definition from the `envs` and `virtualhosts` elements. You only want the `test` environment definition to be present in the file.\n8. Apply the modified overrides file to your cluster. This command will recreate the deleted elements and, because it is omitted, not recreate the `prod` environment. \n\n ```\n apigeectl apply -f original-overrides.yaml -c runtime, udca, synchronizer\n ```\n9. Save your changes.\n\n10. You're not quite done. You must now update the environments in the hybrid UI.\n11. Open a browser and navigate to the hybrid UI at [Apigee UI](https://apigee.google.com).\n12. Remove the environment using the steps described [Delete an existing environment in the Hybrid UI](/apigee/docs/hybrid/v1.2/manage-environments#delete)."]]