hgop / syllabus-2022

0 stars 1 forks source link

Running connect-4-client in Kubernetes #11

Closed piotr20a closed 2 years ago

piotr20a commented 2 years ago

I am trying to run the connect-4-client in Kubernetes, where I apply deployment, service, and ingress. The issue happens when I check the deployment, pods, and logs. We changed the ports to match the docker container, so we are pretty sure that is correct also.

The issue I am receiving from the logs, is due to the docker image crashing, with the error: standard_init_linux.go:219: exec user process caused: exec format error

For more context: -> error is caused by some architecture error, docker running image on linux arm64 -> one teammate using macOS with Intel chip -> one teammate using macOS with M1 chip(he deployed the container to the Docker Hub)

Issue seems to be happening with the image built on the M1 chip

Could reproduce the error by:

  1. Applying the kubectl deployment, service and ingress files.
  2. Running the kubectl get pods
  3. Checking the logs of the latest pod´s logs
kthorri commented 2 years ago

Images built on M1 at least seem to fail when applied to k8s ran on the provided ec2 machines.

Day 4 is used to set up CircleCI, and the images will be built in the CI when it's ready. So moving forward this shouldn't work against you.

If possible I would suggest you build the image from another computer, or setup CI before completing this step

finnure commented 2 years ago

Edit: changed from x86_64 to amd64 as I believe that's the correct platform When building images on Apple Silicon, you can use --platform=linux/amd64 as a parameter to force docker to build it for x86 linux platforms.

docker build --platform=linux/amd64 -t <image_name> .
kthorri commented 2 years ago

When building images on Apple Silicon, you can use --platform=linux/x86_64 as a parameter to force docker to build it for x86 linux platforms.

docker build --platform=linux/x86_64 -t <image_name> .

This sounds way smarter than my suggestions! 😍

finnure commented 2 years ago

Edit: changed from x86_64 to amd64 as I believe that's the correct platform Running containers built on x86 linux on Apple Silicon can also be a problem. You can do the same there, add the --platform=linux/amd64 parameter to tell docker you want to run an x86 image.

docker run --platform=linux/amd64 -d <image_name>

If you want to use linux/x86_64 as default platform, there is an environment variable you can set. Here are instructions on how to do that. After setting this environment variable, you can skip the --platform parameter.

Fanneyyy commented 2 years ago

Thank you all, closing since resolved 💯