节点应用程序没有立即启动

问题描述

我有一个节点应用程序作为 Kubernetes 集群中的 Pod 运行,但应用程序开始执行总是需要大约 8 分钟。

应用程序日志只出现在大约 8 分钟的标记处,我认为这与应用程序本身没有任何关系,因为应用程序根本不会抛出任何错误

我的 EKS 集群是 v1.18。

如果有人能指出我可以用来调查此问题的任何日志,我们将不胜感激。

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>

来自 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"]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)