Should I pass any memory options to nodejs application running on Kubernetes pod with limits?

12/1/2019

I have nodejs application running on Kubernetes with limits:

apiVersion: apps/v1
kind: Deployment
..
spec:
  ..
  template:
    ..
    spec:
      containers:
      - name: mynodejsapp
        ..
        resources:
          requests:
            memory: "1000Mi"
            cpu: "500m"
          limits:
            memory: "2000Mi"
            cpu: "1000m"
        ..

And my Dockerfile for my nodejs application is based on node:10-slim:

FROM node:10-slim
..    
COPY . .
RUN npm run build
EXPOSE 3000
ENTRYPOINT ["dumb-init", "--"]
CMD [ "node", "./build/index.js" ]

I find some older posts that --max_old_space_size should be set. Is that correct? Or will nodejs process automatically find existing memory limitations?

-- Maksim Sorokin
docker
kubernetes
memory
node.js

0 Answers