2

I'm building a Cloud Run service with Cloud Code for Intellij (PyCharm) and the ide is not able to access the deployment error logs prior to failing to deploy locally:

...
Step 7/8 : COPY . .
 ---> d239cd803bb2
Step 8/8 : CMD exec uvicorn main:app --host 0.0.0.0 --port $PORT --workers 1
 ---> Running in 1b76770ca2db
 ---> 60404f7887c5
Successfully built 60404f7887c5
Successfully tagged directory:latest
Tags used in deployment:
 - directory -> directory:60404f7887c5697f9d89b5c5d670803028042c8f7963a220193501416cfe470f
Starting deploy...
 - deployment.apps/directory created
 - service/directory created
Waiting for deployments to stabilize...
 - deployment/directory: container directory-container terminated with exit code 1
    - pod/directory-d7cb9b968-cndxx: container directory-container terminated with exit code 1
      > Error retrieving logs for pod directory-d7cb9b968-cndxx. Try `kubectl logs directory-d7cb9b968-cndxx -n default -c directory-container`
 - deployment/directory failed. Error: container directory-container terminated with exit code 1.
Cleaning up...
 - deployment.apps "directory" deleted
 - service "directory" deleted
exiting dev mode because first deploy failed: 1/1 deployment(s) failed

Anyone know how to access these logs so I can figure out why the service is failing? I tried the kubectl command suggested by opening a CLI to the 'cloud-run-dev-internal' docker container but it seems that kubectl is not installed there, and running it from the host OS (MacOS) connection is refused.

Michael
  • 1,428
  • 3
  • 15
  • 34
  • This may indicate that the container never started, so there are no logs. One thing you might try is running `kubectl describe` on the pod and checking the "events" section. Cloud Code also has a Kubernetes tool window that lets you describe different cluster resources by right-clicking on resources in the cluster tree. Curious to know what the cause of the error is if you do find out. – Matthew Mar 11 '21 at 16:06
  • Are you perhaps running out of disk space? I was getting the same intermittent error when running out of disk space and it didn't always warn about running out of space. Try `gcloud beta code clean-up` and then try again. – George S Mar 11 '21 at 17:04
  • Thanks Matt I'll try that the next time I run into this problem. I think you're right that it never started, it just wasn't clear why. Hi George no my system has a lot of disk space free, I think there was a misconfiguration in my dockerfile or entrypoint but it wasn't clear exactly what was wrong so I had to fix through educated guesses. – Michael Mar 12 '21 at 07:49

0 Answers0