AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1059673
Accepted
solr
solr
Asked: 2021-04-08 12:44:07 +0800 CST2021-04-08 12:44:07 +0800 CST 2021-04-08 12:44:07 +0800 CST

GCP 部署管理器:在哪里可以找到正确创建 YAML 配置和模板文件的参考指南?

  • 772

我应客户的要求开始使用谷歌云部署管理器,使用 YAML 配置文件,但我在任何地方都找不到如何映射https://cloud.google.com/deployment-manager/docs/configuration中显示的参考/supported-resource-types我实际使用的。

特别是,我需要在创建时将现有的外部弹性 IP 附加到实例,但我无法在任何地方找到这样做的配置文件架构(即,就像在https://eksctl.xmleksctl找到的配置文件架构文档一样) io/用法/模式/):

resources:
- type: compute.v1.instance
  name: nextcloud-vm
  properties:
    natIP: nextcloud-vm
    # The properties of the resource depend on the type of resource. For a list
    # of properties, see the API reference for the resource.
    zone: us-west1-a
    # Replace martin-dev-391362 with your project ID
    machineType: https://www.googleapis.com/compute/v1/projects/martin-dev-391362/zones/us-west1-a/machineTypes/n2-standard-4
    disks:
    - deviceName: boot
      type: PERSISTENT
      boot: true
      autoDelete: true
      initializeParams:
        # See a full list of image families at https://cloud.google.com/compute/docs/images#os-compute-support
        # The format of the sourceImage URL is: https://www.googleapis.com/compute/v1/projects/[IMAGE_PROJECT]/global/images/family/[FAMILY_NAME]
        sourceImage: https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts
        diskSizeGb: 20
    # Replace martin-dev-391362 with your project ID
    networkInterfaces:
    - network: https://www.googleapis.com/compute/v1/projects/martin-dev-391362/global/networks/default
      # Access Config required to give the instance a public IP address
      accessConfigs:
      - name: nextcloud-vm
        type: ONE_TO_ONE_NAT

上面的代码不起作用,因为它尝试使用该名称创建一个新的 IP 地址,而不是使用已经存在的弹性 IP 地址。问题是我在任何地方都找不到正确的符号:)

如果有人能指出正确的方向,我将不胜感激,因为解决这个很小的问题只是冰山一角,因为我将与 Deployment Manager 进行大量工作,因此我需要全面了解如何使用它。

google-cloud-platform yaml deployment-manager
  • 1 1 个回答
  • 149 Views

1 个回答

  • Voted
  1. Best Answer
    Alex G
    2021-04-09T01:35:15+08:002021-04-09T01:35:15+08:00

    您可以按照下面的 yaml 作为参考,只需替换mystatic为您在 VPC 网络上保留的外部 IP 的名称。但是,当您删除部署时,它也会将您的静态 IP作为部署的一部分删除。

    resources:
    - name: mystatic
      type: compute.v1.address
      properties:
        region: us-central1
      
    - name: vm-created-by-deployment-manager
      type: compute.v1.instance
      properties:
        zone: us-central1-a
        machineType: zones/us-central1-a/machineTypes/n1-standard-1
        disks:
        - deviceName: boot
          type: PERSISTENT
          boot: true
          autoDelete: true
          initializeParams:
            sourceImage: projects/debian-cloud/global/images/family/debian-10
        networkInterfaces:
        - network: global/networks/default
          accessConfigs:
          - name: External NAT
            type: ONE_TO_ONE_NAT
            natIP: $(ref.mystatic.address)
    

    您需要查看Compute API Reference以获取可在用例中使用的属性列表。

    • 1

相关问题

  • 带有 OpenVPN 的 Google Compute Engine 上的 VPN 服务器

  • 如果您失去了 Google Apps 的管理员权限,如何恢复?

  • 云有多大?[关闭]

  • 谷歌应用引擎中的 joomla

  • 无需短信即可注册 Google AppEngine?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve