【发布时间】:2020-11-02 13:52:05
【问题描述】:
我正在尝试将反应应用程序设置为 Kubernetes 集群。我所有的 kubernetes 文件都位于 k8s/ 文件夹中。在 k8s/ 文件夹中,我有一个 deployment.yaml 和 service.yaml 文件。
下面是我的 cloudbuild.yaml 文件,它位于根文件夹中。这部分gcr.io/cloud-builders/kubectl 第 3 阶段失败。我收到以下错误
build step 2 "gcr.io/cloud-builders/kubectl" failed: step exited with non-zero status: 1
steps:
# Build the image - Stage 1
- name: 'gcr.io/cloud-builders/docker'
args: ['build','-t','gcr.io/${_PROJECT}/${_CONTAINERNAME}:${_VERSION}','.']
timeout: 1500s
# Push the image - Stage 2
- name: 'gcr.io/cloud-builders/docker'
args: ['push','gcr.io/${_PROJECT}/${_CONTAINERNAME}:${_VERSION}']
# Deploy changes to kubernetes config files - Stage 3
- name: "gcr.io/cloud-builders/kubectl"
args: ["apply", "-f", "k8s/"]
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_GKE_CLUSTER}'
# These are variable substitutions
substitutions:
#GCP Specific configuration. Please DON'T change anything
_PROJECT: my-projects-121212
_ZONE: us-central1-c
_GKE_CLUSTER: cluster-1
#Repository Specific configuration. DevOps can change this settings
_DEPLOYMENTNAME: react
_CONTAINERNAME: react
_REPO_NAME: react-app
# Developers ONLY change
_VERSION: v1.0
options:
substitution_option: 'ALLOW_LOOSE'
machineType: 'N1_HIGHCPU_8'
timeout: 2500s
【问题讨论】:
-
为什么你在第三阶段
- name: "gcr.io/cloud-builders/kubectl"有双引号? -
那应该是一个错字.. 让我试试不带"
-
感谢双引号是问题所在。现在可以使用了。
标签: docker kubernetes google-cloud-build