CodexBloom - Programming Q&A Platform

AWS EKS Pod CrashLoopBackOff When Using Custom Docker Image with Alpine Base

πŸ‘€ Views: 17 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-12
aws eks docker kubernetes alpine yaml

I'm relatively new to this, so bear with me. I'm following best practices but I'm upgrading from an older version and I'm experiencing a `CrashLoopBackOff` behavior with my Kubernetes pods on AWS EKS when I deploy a custom Docker image based on Alpine Linux... The application runs perfectly when I test it locally using Docker, but upon deployment to EKS, it fails immediately. The logs indicate that the container exits with code `1`, but they don't provide enough information to diagnose the scenario. Here’s the relevant section of my `deployment.yaml`: ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: my-app spec: replicas: 2 selector: matchLabels: app: my-app template: metadata: labels: app: my-app spec: containers: - name: my-app image: myrepo/my-app:latest ports: - containerPort: 8080 env: - name: DATABASE_URL value: "postgres://user:password@db:5432/mydb" ``` I've tried adding a `command` and `args` in the container spec to ensure the application starts with the right parameters, like this: ```yaml command: ["/bin/sh"] args: ["-c", "./start.sh"] ``` However, I'm still working with the same scenario. Additionally, I checked the security group settings and they seem fine, allowing traffic on the required ports. I am using EKS version 1.23 and I’ve ensured that the IAM roles are properly configured. Any insights into why my pods are crashing on EKS while working locally would be greatly appreciated. I've also looked through the AWS console for event logs but didn't find any clear indicators of what might be wrong. Could it be related to the Alpine image or misconfiguration in my Dockerfile? Here is a snippet of it: ```Dockerfile FROM alpine:3.15 RUN apk add --no-cache openjdk11-jre COPY ./target/my-app.jar /app/my-app.jar WORKDIR /app CMD ["java", "-jar", "my-app.jar"] ``` I would appreciate any help to identify what might be causing this scenario. Thanks in advance! This is part of a larger API I'm building. This issue appeared after updating to Yaml 3.10. Thanks in advance! I'm on Debian using the latest version of Yaml.