Failed Kubernetes deployment due to wrong image architecture on Apple Silicon
You might deploy a service to Kubernetes with Pulumi and then see an error like this in the output
kubernetes:apps/v1:Deployment (nextjs-app-dep):
error: 5 errors occurred:
* resource default/nextjs-app-dep-95c03894 was successfully created, but the Kubernetes API server reported that it failed to fully initialize or become live: 'nextjs-app-dep-95c03894' timed out waiting to be Ready
* [MinimumReplicasUnavailable] Deployment does not have minimum availability.
* Minimum number of live Pods was not attained
* [Pod nextjs-app-dep-95c03894-7ff5d68b69-9p6rj]: containers with unready status: [nextjs-app] -- [CrashLoopBackOff] back-off 5m0s restarting failed container=nextjs-app pod=nextjs-app-dep-95c03894-7ff5d68b69-9p6rj_default(bd027f3f-0d74-4597-ae83-88ae0a1f760a)
* [Pod nextjs-app-dep-95c03894-7ff5d68b69-rc8rf]: containers with unready status: [nextjs-app] -- [CrashLoopBackOff] back-off 5m0s restarting failed container=nextjs-app pod=nextjs-app-dep-95c03894-7ff5d68b69-rc8rf_default(31f298ba-851a-47ec-990c-7dc8449d7796)
When you try to get the logs you also get an error
> kubectl logs nextjs-app-dep-95c03894-7ff5d68b69-9p6rj
standard_init_linux.go:228: exec user process caused: exec format error
It could be because you are on Apple Silicon (eg M1 Mac) and you built a container for ARM architecture but then deployed it to an Intel/AMD Kubernetes cluster. You can fix this by setting an environment variable for Docker before running pulumi up
(assuming that you are building the container within your Pulumi code eg with buildAndPushImage
DOCKER_DEFAULT_PLATFORM=linux/amd64 pulumi up