0

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"]
JustStarted
  • 199
  • 4
  • 13
  • We deploy node applications in K8s, but don't see this behavior. To start with, can you share your deployment configuration and the pod logs please. – rock'n rolla Apr 11 '21 at 13:02
  • Updated the original post with the yaml file and application logs – JustStarted Apr 11 '21 at 13:35
  • This looks very much like an `npm i` in the cmd/entrypoint/startup script. can you share your dockerfile and package.json/startup script – Thomas Apr 11 '21 at 15:00
  • hmm, the startup script is pointing to my main class and it was running fine before I upgrade the eks version to v1.18 – JustStarted Apr 11 '21 at 15:54
  • Can you provide your Dockerfile ? What is your npm version ? – matt_j Apr 12 '21 at 15:22
  • Added the dockerfile, npm version: 7.7.6. I tried using node:14.16.1-alpine3.12. it seems to resolve the issue. I don't quite understand what is causing it – JustStarted Apr 13 '21 at 15:12
  • We are experiencing exactly the same behavior with node 15.14 have you found any solution for that ? or just use 14 or 16 image ? – Martin Hudec Jan 11 '22 at 12:02
  • @MartinHudec, I have not found another solution so far. I stick to the latest node version that was available at that point in time. node:14.16.1-alpine3.12 – JustStarted Jan 12 '22 at 07:21

0 Answers0