我们正在使用基于队列的托管实例扩展。我们需要按实例组在虚拟机上设置环境变量(以便可以使用相同的虚拟机映像来订阅不同实例组中的不同队列)。创建实例组时,我没有看到\xe2\x80\x99t 定义环境变量的选项。
\n\n有没有办法在多个实例组中使用相同的映像,并且仍然根据实例组级别的不同环境变量或其他方式实现不同的虚拟机行为?
\n\n示例:使用相同的 VM 映像创建 2 个托管实例组。一个将环境变量“queue-name”设置为“queue-1”,另一个将“queue-name”设置为“queue-2”。部署到第一个实例组中的虚拟机的应用程序从发布/订阅队列“queue-1”中提取任务,而在其他组中从“queue-1”中提取任务。
\ngoogle-compute-engine google-cloud-platform google-kubernetes-engine gce-instance-group
如何将自动扩展托管实例组添加到目标池?
通过以下方式将现有实例添加到目标池非常容易
$ gcloud compute target-pools create mypool --region us-central1
$ gcloud compute target-pools add-instances mypool \
--instances existing-instance1 existing-instance2 --zone us-central1-b
Run Code Online (Sandbox Code Playgroud)
但是,我希望自动扩展组中出现的所有实例都自动添加到我的目标池中。
GCE 实例组是否可以根据 Google Cloud PubSub 队列计数或其他异步任务队列(例如 PSQ)进行扩展/缩减?
google-compute-engine google-cloud-pubsub gce-instance-group
gcloud ×1