gcloud managed vm starts too many instances

2019-08-15 07:31发布

问题:

Worked through the quickstart for Node.js, then deployed the app to production:

gcloud preview app deploy app.yaml --set-default

After deploying, there are ~12 instances in my dashboard. The exact number seems to vary for each deploy attempt.

I killed all of these, deleted them, and deployed again. ~12 more are created. I tried both manual_scaling and automatic_scaling with no improvement.

My app.yaml:

# [START runtime]
runtime: nodejs
vm: true
api_version: 1
# [END runtime]

# [START resources]
resources:
  cpu: .5
  memory_gb: 1.3
  disk_size_gb: 10
# [END resources]

# [START scaling]
manual_scaling:
  instances: 1
#automatic_scaling:
#  min_num_instances: 1
#  max_num_instances: 1
#  cool_down_period_sec: 60
#  cpu_utilization:
#    target_utilization: 0.5
# [END scaling]

env_variables:
  NODE_ENV: 'production'

# Temporary workaround for a Cloud SDK bug.
# Ensures that node_modules directory and any .log files are not uploaded (the
# other entries are the default values for skip_files). This will skip any Unix
# hidden files (such as the .git directory)
skip_files:
 - ^(.*/)?#.*#$
 - ^(.*/)?.*~$
 - ^(.*/)?.*\.py[co]$
 - ^(.*/)?.*/RCS/.*$
 - ^(.*/)?\..*$
 - ^(.*/)?.*/node_modules/.*$
 - ^(.*/)?.*\.log$

For brevity, I pasted the output of the deploy command, version info, and other non-essentials here.

What am I doing wrong here? What do I need to do to start exactly one instance?

回答1:

Your screenshot shows twelve different versions of your application has been deployed. The numerical part of the instances names yyyymmddtxxxxxx will be same for the same version.

On the Developers Console, go to Compute > App Engine > Versions , and delete those versions of the application that you don't need anymore.