Cloud Run error when deploying to GKE, works with cloud run managed

12/30/2019

I have an issue where deploying an Angular 8 App to Google Cloud Run Managed works well. While deploying the same app to Google Cloud Run Kubernetes cluster is in error. Any help on what could be different between the 2 would be appreciated?

Basically, I am trying to replicate the google tutorial, replacing the frontend with my Angular App. [ https://cloud.google.com/solutions/authenticating-cloud-run-on-gke-end-users-using-istio-and-identity-platform ]

My Dockerfile is as follows

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;"]

My nginx.conf is as follows:

# 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;
    }
}

Thanks to the answers in Cloud Run error: Container failed to start, this deploys and runs well in cloud run managed instance

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

However, when I try and deploy to the GKE cluster it fails. So there is something I am missing for gke if anybody has an idea.

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

The error is

Configuration "frontend" does not have any ready Revision.

With some extra details in the logs

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

Thanks, Ronan

-- Ronan Hughes
angular
dockerfile
google-cloud-run
google-kubernetes-engine

1 Answer

12/30/2019

The error states that the /var/log/nginx/error.log does not exists.

You should try to create the file or the nginx directory:

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

Here you can find a related SO question link and link.

-- marian.vladoi
Source: StackOverflow