gpt4 book ai didi

angular - 部署到 GKE 时出现 Cloud Run 错误,适用于托管的云运行

转载 作者:行者123 更新时间:2023-12-04 04:20:28 25 4
gpt4 key购买 nike

我遇到一个问题,将 Angular 8 应用程序部署到 Google Cloud Run Managed 效果很好。将相同的应用程序部署到 Google Cloud Run Kubernetes 集群时出错。任何关于两者之间可能不同的帮助将不胜感激?

基本上,我正在尝试复制谷歌教程,用我的 Angular 应用程序替换前端。 [ https://cloud.google.com/solutions/authenticating-cloud-run-on-gke-end-users-using-istio-and-identity-platform ]

我的Dockerfile如下

FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build --prod

ENV PORT=8080

FROM nginx:alpine
COPY --from=node /app/dist/streamin-app/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

我的nginx.conf如下:

# on alpine, copy to /etc/nginx/nginx.conf
user root;
worker_processes auto;

error_log /var/log/nginx/error.log warn;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile off;
access_log off;
keepalive_timeout 3000;
server {
listen 8080;
root /usr/share/nginx/html;
index index.html;
server_name 0.0.0.0;
client_max_body_size 16m;
}
}

感谢Cloud Run error: Container failed to start中的回答, 这在云运行托管实例中部署和运行良好

gcloud run deploy frontend --image gcr.io/$GOOGLE_PROJECT/$IMAGE --platform managed

但是,当我尝试部署到 GKE 集群时失败了。因此,如果有人有想法,我对 gke 缺少一些东西。

ZONE=us-central1-c
CLUSTER=cloud-run-gke-auth-tutorial

gcloud config set compute/zone $ZONE
gcloud config set run/cluster $CLUSTER
gcloud config set run/cluster_location $ZONE

kubectl create namespace public

gcloud run deploy frontend --namespace public --image gcr.io/$GOOGLE_PROJECT/$IMAGE --platform gke

错误是

Configuration "frontend" does not have any ready Revision.

日志中有一些额外的细节

[emerg] 1#1: open() "/var/log/nginx/error.log" failed (2: No such file or directory)

谢谢,罗南

最佳答案

错误表明 /var/log/nginx/error.log 不存在。

您应该尝试创建文件或 nginx 目录:

 cd /var/log/nginx/
sudo touch error.log
sudo chmod 750 *.log

在这里您可以找到相关的 SO 问题 linklink .

关于angular - 部署到 GKE 时出现 Cloud Run 错误,适用于托管的云运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59524703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com