云 运行 部署到 GKE 时出错,适用于云 运行 托管
Cloud Run error when deploying to GKE, works with cloud run managed
我有一个问题,将 Angular 8 应用程序部署到 Google Cloud 运行 Managed 运行良好。将相同的应用程序部署到 Google Cloud 运行 Kubernetes 集群时出错。
任何关于两者之间可能不同的帮助将不胜感激?
基本上,我正在尝试复制 google 教程,用我的 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;
}
}
感谢 中的回答,这在云 运行 托管实例 运行 中部署和 运行 很好
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 问题 link and link。
我有一个问题,将 Angular 8 应用程序部署到 Google Cloud 运行 Managed 运行良好。将相同的应用程序部署到 Google Cloud 运行 Kubernetes 集群时出错。 任何关于两者之间可能不同的帮助将不胜感激?
基本上,我正在尝试复制 google 教程,用我的 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;
}
}
感谢
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 问题 link and link。