[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[],[],null,["| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis document is for platform administrators that run virtual machines (VMs) in\nGoogle Distributed Cloud. This document shows you how to configure the eviction policy\nthat controls how VMs that use VM Runtime on GDC can automatically\nmigrate to other hosts during maintenance events. These configuration settings\nlet you VMs continue to run on other hosts when you upgrade a cluster or perform\nmaintenance on a host.\n\nBefore you begin\n\nTo complete this document, you need access to Google Distributed Cloud version 1.12.0\n(`anthosBareMetalVersion: 1.12.0`) or higher cluster. You can use any cluster\ntype capable of running workloads. If needed,\n[try Google Distributed Cloud on Compute Engine](/kubernetes-engine/distributed-cloud/bare-metal/docs/try/gce-vms)\nor see the\n[cluster creation overview](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-clusters-overview).\n\nEviction policy settings\n\nGoogle Distributed Cloud lets you configure node behavior when you perform cluster\nupgrades or place nodes into maintenance mode. VM Runtime on GDC uses\nan *eviction policy* that controls how the cluster handles VMs that run during\nthese events.\n\nWhen enabled, VM Runtime on GDC uses live migration to move VM\nworkloads to another host by default. This behavior minimizes potential\ndisruption to the VM workloads. With live migration, migratable VMs move from\none host to another without disruption to the guest OS.\n| **Note:** If you're upgrading to Google Distributed Cloud 1.12 from a previous version, you can't take advantage of migration-based eviction during the upgrade to version 1.12. Migration-based eviction for cluster upgrades is only supported for Google Distributed Cloud version 1.12 and higher.\n\nThe following eviction policy settings can be configured:\n\n| Property | Default | Valid values |\n|----------------------------------------|---------------|-----------------------------------------------------------|\n| `evictionStrategy` | `LiveMigrate` | `LiveMigrate`, `Restart` |\n| `maxMigrationAttemptsPerVM` | `3` | Integers in the range \\[`1`,`5`\\] |\n| `migrationTargetInitializationTimeout` | `30s` | Any valid duration string, such as `1m`, `2h`, or `1h30m` |\n\n`evictionStrategy`\n\nIf this value is set to `LiveMigrate`, VM Runtime on GDC attempts to\nmigrate any migratable VM away from a node to evict it. The VM is placed on\nanother node in the cluster and continues to run.\n| **Note:** The `VirtualMachineDisk` for a VM must use the `ReadWriteMany` access mode for the VM to use live migration. If the `VirtualMachineDisk` access mode is `ReadWriteOnce`, the VM can't live migrate.\n\nIf this value is set to `Restart`, VM Runtime on GDC makes no attempt\nto migrate VMs. Instead, VMs are stopped when the node is put into maintenance\nmode, and the VMs start again when the node is brought out of maintenance mode.\nThe VM is unavailable during the host maintenance event.\n\nWhen you choose the `LiveMigrate` strategy, VM Runtime on GDC falls\nback to the `Restart` strategy for non-migratable VMs.\n\n`maxMigrationAttemptsPerVM`\n\nThis setting controls the maximum number of migration attempts that can occur\nfor a particular VM before the `Restart` strategy applies.\n\nThis setting is ignored if `evictionStrategy` is set to `Restart`.\n\n`migrationTargetInitializationTimeout`\n\nThis setting controls the maximum amount of time a migration can take to start\nbefore it's considered to have failed. A migration that takes too long to start\ncounts toward the failed migration budget for a VM workload.\n\nThis setting is ignored if `evictionStrategy` is set to `Restart`.\n\nEnable and configure the eviction policy\n\nTo use the eviction policy in VM Runtime on GDC, the\n`evictionPolicy` setting must be defined in your cluster's `VMRuntime` object.\nThis setting is enabled by default. If you upgrade from a previous version, you\nmust enable this setting manually.\n\nAn empty object, such as `evictionPolicy: {}`, enables the eviction policy with\ndefault settings. To change the default behavior, add additional configuration\noptions to the `evictionPolicy` object.\n\nTo enable and configure the eviction policy, complete the following steps:\n\n1. Edit the `VMRuntime` custom resource:\n\n kubectl edit vmruntime vmruntime\n\n2. Add or update the `evictionPolicy` section with an empty object to use\n the default eviction policy settings, or add your desired settings:\n\n apiVersion: vm.cluster.gke.io/v1\n kind: VMRuntime\n metadata:\n name: vmruntime\n spec:\n disableCDIUploadProxyVIP: false\n enabled: true\n evictionPolicy: {}\n useEmulation: false\n\n If the `evictionPolicy` isn't populated, such as `evictionPolicy: null` or\n isn't included in the manifest, no special action is taken. VMs are forcefully\n evicted.\n\n The following example manifests show how to enable live migration of VMs, or\n restart the VMs on the same host after maintenance is complete: \n\n Live migrate\n\n The following example eviction policy enables live migration of VMs. The\n cluster can retry the live migration up to 3 times, with a 30-second\n timeout on the process each time to start: \n\n apiVersion: vm.cluster.gke.io/v1\n kind: VMRuntime\n metadata:\n name: vmruntime\n spec:\n disableCDIUploadProxyVIP: false\n enabled: true\n evictionPolicy:\n evictionStrategy: LiveMigrate\n maxMigrationAttemptsPerVM: 3\n migrationTargetInitializationTimeout: 30s\n useEmulation: false\n\n Restart\n\n The following example eviction policy makes no attempt at migration for\n any VMs during eviction. VMs are stopped on their current host, and start\n again when the host finishes its maintenance event: \n\n apiVersion: vm.cluster.gke.io/v1\n kind: VMRuntime\n metadata:\n name: vmruntime\n spec:\n disableCDIUploadProxyVIP: false\n enabled: true\n evictionPolicy:\n evictionStrategy: Restart\n useEmulation: false\n\n3. Save and close the `VMRuntime` custom resource in your editor.\n\n VM Runtime on GDC now applies the eviction policy to VMs in your\n cluster.\n\nWhat's next\n\n- [Schedule VMs that use VM Runtime on GDC](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/schedule-vms)"]]