knative-tutorial icon indicating copy to clipboard operation
knative-tutorial copied to clipboard

quay.io/rhdevelopers/blue-green-canary crashloops

Open maschmid opened this issue 3 years ago • 1 comments

Describe the bug

Running the quay.io/rhdevelopers/blue-green-canary from the example from the tutorial:

kn service create blue-green-canary \
   --image=quay.io/rhdevelopers/blue-green-canary \
   --env BLUE_GREEN_CANARY_COLOR="#6bbded" \
   --env BLUE_GREEN_CANARY_MESSAGE="Hello"

crashloops

oc logs blue-green-canary-00001-deployment-7675bb595d-5q74s shows

exec /deployments/run-java.sh: permission denied

To Reproduce Steps to reproduce the behavior:

  1. Install Serverless operator and Knative Serving
  2. Run
kn service create blue-green-canary \
   --image=quay.io/rhdevelopers/blue-green-canary \
   --env BLUE_GREEN_CANARY_COLOR="#6bbded" \
   --env BLUE_GREEN_CANARY_MESSAGE="Hello"
  1. Notice the ksvc doesn't become Ready and the pod crashloops

Expected behavior The example image should start and work as described in the tutorial

Additional context Serverless 1.25.0-1 on OpenShift 4.11

maschmid avatar Sep 23 '22 06:09 maschmid

@lordofthejars can you help us here ? Who is currently the best PoC for getting fixes for the Knative tutorial ?

rhuss avatar Sep 23 '22 07:09 rhuss

@rhuss I've encountered this as well. It is caused by incorrect permissions of the script run-java.sh on the container image:

# ls -la /deployments/
-r-xr-----. 1 1001 root    19272 Apr 19  2020 run-java.sh 

Since on OpenShift a container is executed with an arbitrary user, it will not have the permission to execute the shell script. This can be fixed by creating a new image based on the original one with this Dockerfile:

FROM quay.io/rhdevelopers/blue-green-canary
USER root
RUN chown -R 1001:0 /deployments && chgrp -R 0 /deployments && chmod -R g=u /deployments && chmod a+x /deployments/run-java.sh
USER 1001

You can also directly try quay.io/rh_ee_fcharett/blue-green-canary (built from the above), but since the base image from 2020 now has a few critical vulnerabilities, I guess it should be preferable to build a new one from the original sources.

fc7 avatar Aug 08 '23 12:08 fc7

Updating now

lordofthejars avatar Aug 10 '23 12:08 lordofthejars