如何规避 Compute Engine 在容器部署期间的停机时间?
How to circumvent Compute Engine's downtime during container deployments?
我计划将 Compute Engine 与容器一起使用,但每次我通过 gcloud compute instances update-container ...
更新容器映像时,都需要一些(停机)时间来停止和准备实例,这会导致我的应用程序的生产环境停机.您会采用什么管道或云策略来减轻这种行为?
来自 Updating a container on a VM instance 文档,
When you update a VM running a container, Compute Engine performs two
steps:
- Updates container declaration on the instance. Compute Engine stores the updated container declaration in instance metadata
under the gce-container-declaration metadata key.
- Stops and restarts the instance to actuate the updated configuration, if the instance is running. If the instance is stopped,
update the container declaration and keep the instance stopped. The VM
instance downloads the new image and launches the container on VM
start.
为避免应用程序停机,请使用托管实例组。
托管实例组通过主动保持您的实例可用来保持应用程序的高可用性,这意味着处于 运行 状态。 MIG 自动重新创建不是 运行.
的实例
所以,Deploy a container on a managed instance group and Update a MIG to a new version of a container image。
我计划将 Compute Engine 与容器一起使用,但每次我通过 gcloud compute instances update-container ...
更新容器映像时,都需要一些(停机)时间来停止和准备实例,这会导致我的应用程序的生产环境停机.您会采用什么管道或云策略来减轻这种行为?
来自 Updating a container on a VM instance 文档,
When you update a VM running a container, Compute Engine performs two steps:
- Updates container declaration on the instance. Compute Engine stores the updated container declaration in instance metadata under the gce-container-declaration metadata key.
- Stops and restarts the instance to actuate the updated configuration, if the instance is running. If the instance is stopped, update the container declaration and keep the instance stopped. The VM instance downloads the new image and launches the container on VM start.
为避免应用程序停机,请使用托管实例组。
托管实例组通过主动保持您的实例可用来保持应用程序的高可用性,这意味着处于 运行 状态。 MIG 自动重新创建不是 运行.
所以,Deploy a container on a managed instance group and Update a MIG to a new version of a container image。