【问题标题】:Is it possible to deploy kustomize command with cloud build on GKE of GCP?是否可以在 GCP 的 GKE 上使用云构建部署 kustomize 命令?
【发布时间】:2021-05-01 23:13:19
【问题描述】:

如果在 GKE 上使用文件名部署,Supported builder images provided by Cloud Build 可以从官方找到。

也可以找到full list

但是gke-deploykubectl 都不能满足我的要求。我想运行类似的命令

kustomize build ./overlays/production | kubectl apply -f -

因为我需要先用 kustomize 构建一个完整的文件,然后再使用 kubectl。

来自Running inline bash scripts,我可以试试

steps:
...
- name: gcr.io/cloud-builders/gcloud
  entrypoint: bash
  args:
    - kustomize
    - build
    - ./overlays/production
    - |
    - kubectl
    - apply
    - -f
    - -

但我认为它无法在 GKE 上找到要使用的集群。那么在这种情况下如何将它与 Cloud Build 一起使用,而不是在本地 shell 上运行呢?

【问题讨论】:

标签: kubernetes google-cloud-platform google-kubernetes-engine google-cloud-build kustomize


【解决方案1】:

一种方法是在安装了 kubectl 的机器上安装 kustomize。另一种选择是在集群外部运行 kustomize,然后在 AWS 的情况下将生成的 yaml 存储在 S3 等对象存储中的某个位置,然后在机器中从对象存储下载 yaml 文件并运行 kubectl apply。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-14
    • 1970-01-01
    • 2021-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-02
    • 2021-04-13
    相关资源
    最近更新 更多