创建和使用云资源

    本教程将主要集中在通过 Terraform 插件创建云资源,KubeVela 也支持使用 ,你可以参考这个教程

    请平台工程师启用云资源 Terraform 插件并授权目标云服务商的认证信息。 我们将使用阿里云作为示例。

    KubeVela 支持的所有由 Terraform 编排的云资源请见,你也可以通过命令 查看。

    你可以使用一下任意方式来检查云资源的使用参数:

    • 通过命令 vela show <component type name>

    你也可以使用 --web 参数来在本地浏览器中查看使用说明。

    比如,你可以在查看阿里云 OSS 的使用参数。

    For different vendors, these parameters update accordingly. All cloud resources have the following common parameters.

    • writeConnectionSecretToRef: struct Type, represents the outputs of Terraform will become key/values in the secret with the name specified here.
      • name, specifies the name of the secret.
      • namespace, specifies the namespace of the secret.
    • : struct Type, represents the Provider which is referenced by a cloud service.
    • deleteResource: bool Type, specify whether to delete the corresponding cloud service when the app is deleted. By Default it’s true.
    • customRegion: Type, specify region for resources, it will override the default region from providerRef.

    我们以 OSS bucket 为例展示如何部署云资源。

    alibaba-oss 类型的组件的参数在上面文档有清晰的描述,包括每一个 property 的名字、类型、描述、是否必填和默认值。

    当应用程序处于 runninghealthy状态。你也可以在阿里云控制台查看。

    除了命令行以外,使用 UI 控制台也可以很方便的创建云资源。

    • Enable addon.

    • Enable Terraform addon, just like the prerequisites in CLI part above. VelaUX can also enable these addons in UI console.

    The UI console operations are the same, you can refer to this guide.

    Firstly, Create an application and choose the type of your cloud service, they will always has a prefix of vendor such as aws-, azure or .

    Set the above parameters according to your needs to complete creating the application, and then deploy the application. The resources will be provisioned after the application become ready.

    • 查看云实例列表

    与其他应用程序一样,云服务应用程序也需要切换到相应的环境页面来查看实例信息。默认情况下,一个环境中有多个目标,云服务会生成相应数量的实例。

    在实例列表中,会显示实例名称、状态、资源类型和位置。在开始时,名称是空的。 因为云服务实例的生成需要一定的时间,当实例正常生成后,名称会出现。

    • 在云提供商的控制台中查看云资源

    您可以在云提供商的控制台中访问该实例。例如,您可以检查名称或控制台来访问它。

    创建和使用云资源 - 图3

    创建出的云资源也会自动跳转到云资源的官方网站控制台,例如,这里的云资源会自动跳转到阿里云官网的 RDS 实例控制台。

    • 检查云实例的细节和状态

    点击 “检查细节 “按钮来查看应用程序的细节。

    你会发现,每个实例都会生成一个Secret资源,一般来说,它记录了服务的访问地址和密钥信息。秘密资源将被分配到目标所在的集群和命名空间,而 控制集群存在。因此,同一环境中的其他应用程序可以直接使用资源中的环境变量来获取访问地址和密钥。

    env-secret

    在最后一节 Component Status 中,显示了云服务实例的健康状态和信息。

    更多

    更多云资源使用方法,比如如何使用和消费云资源,请参见云资源管理场景