Hi All, My node.js app is failing while I am trying to deploy it in Kubernetes using a docker image. The container in Kubernetes pod is getting created but it's immediately getting terminated, after executing the command "npm start" Here is the content of my dockerfile:
FROM node:13.12.0-alpine
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY nodejs/package.json ./
RUN npm install
RUN npm update
COPY nodejs/ .
COPY . ./
CMD ["npm", "start"]
Here is the content of the yaml file:
kind: Service
apiVersion: v1
metadata:
name: nodejs-service
spec:
selector:
app: nodejs
type: NodePort
ports:
- port: 3000
targetPort: 3000
nodePort: 30016
selector:
app: nodejs
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nodejs
name: nodejs-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nodejs
template:
metadata:
labels:
app: nodejs
spec:
containers:
- image: 336319716199.dkr.ecr.ap-south-1.amazonaws.com/ddp/nodejs-frontend:106
name: frontend-nodejs
command: ["npm", "start"]
ports:
- containerPort: 3000
Any suggestion will be highly appreciated ! Thanks in advance !