我在将Angular 8应用程序部署到Google Cloud Run Managed时效果很好。将同一应用程序部署到Google Cloud Run Kubernetes集群时出错。任何对两者之间可能有所不同的帮助将不胜感激?
基本上,我想复制Google教程,用我的Angular App取代前端。[ 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错误中的答案:容器无法启动,它可以在云运行托管实例中部署并正常运行
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)
谢谢罗南
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句