代码之家  ›  专栏  ›  技术社区  ›  JustStarted

节点应用程序未立即启动

  •  0
  • JustStarted  · 技术社区  · 4 年前

    我有一个节点应用程序在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"]
    
    0 回复  |  直到 4 年前
    推荐文章