簡體   English   中英

我無法為 Pulumi 創建集群,因為代碼正在標記,請協助

[英]I cannot create cluster for Pulumi because the code is flagging, please assist

我正在通過 VScode 平台上的 Pulumi 在 Google 雲上創建一個集群,它是用 Typescript 編寫的,但“集群”標記為紅色。

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const cluster = new gcp.container.Cluster("cluster", {
    zone: "us-central1-a"
    initialNodeCount: 3,
});

export const clusterId = cluster.id;

請協助使用 Pulumi 和 IAC for google cloud 來幫助成功創建集群。 謝謝。

顯示 Typescript 代碼和相應的錯誤

看起來 Pulumi 無法找到要部署到的 GCP 項目。

您需要按照以下方式在工作站上登錄谷歌雲: https://www.pulumi.com/docs/get-started/gcp/begin/#configure-gcp

或者,您可以設置相關的環境變量: https://www.pulumi.com/docs/intro/cloud-providers/gcp/setup/#optional-settings

假設您已經安裝了Google Cloud SDK ,然后 初始化了 Cloud SDK

運行gcloud auth application-default login

這將導致以下結果;

Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=000000000000-abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud......

Credentials saved to file: [/Users/$HOME/.config/gcloud/application_default_credentials.json]

These credentials will be used by any library that requests Application Default Credentials (ADC).
/Users/$HOME/.bin/google-cloud-sdk/lib/third_party/google/auth/_default.py:69: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. We recommend you rerun `gcloud auth application-default login` and make sure a quota project is added. Or you can use service accounts instead. For more information about service accounts, see https://cloud.google.com/docs/authentication/
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)

Quota project "<PROJECT_NAME>" was added to ADC which can be used by Google client libraries for billing and quota. Note that some services may still bill the project owning the resource.

然后,運行pulumi preview

看起來zone:現在已棄用,以下配置對我有用:

const cluster = new gcp.container.Cluster("cluster", {
    initialNodeCount: 1,

    loggingService: "logging.googleapis.com/kubernetes",
    monitoringService: "monitoring.googleapis.com/kubernetes",

    removeDefaultNodePool: true,

    enableLegacyAbac: false,
    enableBinaryAuthorization: true,

    addonsConfig: {
        horizontalPodAutoscaling: {
            disabled: false,
        },
        istioConfig: {
            disabled: false,
            auth: "AUTH_MUTUAL_TLS",
        },
        cloudrunConfig: {
            disabled: true
        }
    },
},  {
    customTimeouts: {
        create: "30m",
        update: "30m",
        delete: "30m"
    }
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM