I have a node application running as a pod in a Kubernetes cluster, but it always takes around 8 minutes for the application to start executing.
The application logs only appear at around the 8 mins mark, I don't think it has anything to do with the application itself as the application doesn't throw any errors out at all.
My EKS cluster is at v1.18.
Would appreciate it if anyone can point me to any logs that I could use to investigate this issue.
cronjob.yaml
kind: CronJob
apiVersion: batch/v1beta1
metadata:
name: <name>
namespace: <namespace>
spec:
schedule: "*/4 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
jobTemplate:
spec:
template:
metadata:
labels:
app: <name>
spec:
restartPolicy: Never
containers:
- name: <name>
image: <container image>
env:
<env variables>
volumeMounts:
<mounts>
volumes:
<PVCs>
Application logs from pod
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/npm failed, reason: connect ETIMEDOUT 104.16.22.35:443
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
> <app name>>@1.0.0 start:<env>
> node src/app.js
Application ABC: starting
.
<application logs>
.
Application ABC: completed
Dockerfile
FROM node:15.14.0-alpine3.12
# Create app directory
WORKDIR /app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
#RUN npm ci --only=production
# Bundle app source
COPY . .
CMD [ "node", "src/app.js"]