跳到正文

Review the New Project ​

Let's review some of the generated project files:

  • index.ts is the Pulumi program that defines our stack resources. Let's examine it.
typescript
import * as k8s from "@pulumi/kubernetes";

const appLabels = { app: "nginx" };
const deployment = new k8s.apps.v1.Deployment("nginx", {
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: "nginx", image: "nginx" }] }
        }
    }
});
export const name = deployment.metadata.name;

This Pulumi program creates an NGINX deployment and exports the name of the deployment.

Next, we'll deploy the stack.

文档内容翻译自 Pulumi 官方文档。