如何使用Pulumi管理DigitalOcean和Kubernetes基础架构

发布时间:2024-07-06 18:01

The author selected the Diversity in Tech Fund to receive a donation as part of the Write for DOnations program.

作者选择了“技术多元化”基金来接受捐赠,这是Write for DOnations计划的一部分。

介绍 (Introduction)

Pulumi is a tool for creating, deploying, and managing infrastructure using code written in general purpose programming languages. It supports automating all of DigitalOcean’s managed services—such as Droplets, managed databases, DNS records, and Kubernetes clusters—in addition to application configuration. Deployments are performed from an easy-to-use command-line interface that also integrates with a wide variety of popular CI/CD systems.

Pulumi是使用通用编程语言编写的代码创建,部署和管理基础结构的工具。 除应用程序配置外,它还支持自动化DigitalOcean的所有托管服务,例如Droplet,托管数据库,DNS记录和Kubernetes群集。 通过易于使用的命令行界面进行部署,该界面还与各种流行的CI / CD系统集成。

Pulumi supports multiple languages but in this tutorial you will use TypeScript, a statically typed version of JavaScript that uses the Node.js runtime. This means you will get IDE support and compile-time checking that will help to ensure you’ve configured the right resources, used correct slugs, etc., while still being able to access any NPM modules for utility tasks.

Pulumi支持多种语言,但是在本教程中,您将使用TypeScript ,它是使用Node.js运行时的JavaScript的静态类型。 这意味着您将获得IDE支持和编译时检查,这将有助于确保您配置了正确的资源,使用了正确的子弹等,同时仍然能够访问任何NPM模块来执行实用程序任务。

In this tutorial, you will provision a DigitalOcean Kubernetes cluster, a load balanced Kubernetes application, and a DigitalOcean DNS domain that makes your application available at a stable domain name of your choosing. This can all be provisioned in 60 lines of infrastructure-as-code and a single pulumi up command-line gesture. After this tutorial, you’ll be ready to productively build powerful cloud architectures using Pulumi infrastructure-as-code that leverages the full surface area of DigitalOcean and Kubernetes.

在本教程中,您将提供一个DigitalOcean Kubernetes集群,一个负载平衡的Kubernetes应用程序和一个DigitalOcean DNS域,该域可以使您的应用程序以您选择的稳定域名提供。 所有这些都可以通过60行基础架构代码和一个单一的pulumi up命令行手势进行配置。 学习完本教程后,您将准备使用Pulumi基础架构代码有效地构建强大的云架构,该基础架构利用了DigitalOcean和Kubernetes的整个表面积。

先决条件 (Prerequisites)

To follow this tutorial, you will need:

要遵循本教程,您将需要:

  • A DigitalOcean Account to deploy resources to. If you do not already have one, register here.

    一个用于部署资源的DigitalOcean帐户。 如果您还没有,请在这里注册 。

  • A DigitalOcean API Token to perform automated deployments. Generate a personal access token here and keep it handy as you’ll use it in Step 2.

    用于执行自动部署的DigitalOcean API令牌。 在此处生成一个个人访问令牌,并在步骤2中使用它时方便使用。

  • Because you’ll be creating and using a Kubernetes cluster, you’ll need to install kubectl. Don’t worry about configuring it further — you’ll do that later.

    因为您将要创建和使用Kubernetes集群,所以需要安装kubectl 。 不用担心进一步配置它-稍后再做。

  • You will write your infrastructure-as-code in TypeScript, so you will need Node.js 8 or later. Download it here or install it using your system’s package manager.

    您将使用TypeScript编写基础结构代码,因此需要Node.js 8或更高版本。 在此处下载或使用系统的软件包管理器进行安装 。

  • You’ll use Pulumi to deploy infrastructure, so you’ll need to install the open source Pulumi SDK.

    您将使用Pulumi来部署基础结构,因此您需要安装开源Pulumi SDK 。

  • To perform the optional Step 5, you will need a domain name configured to use DigitalOcean nameservers. This guide explains how to do this for your registrar of choice.

    要执行可选的步骤5,您将需要配置一个域名以使用DigitalOcean名称服务器。 本指南说明了如何为您选择的注册商执行此操作。

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号