Good evening, first of all, sorry if I don't respect all of the StackOverflow codes, this is the first time I've published one of my problems.
For a project, I developed an application with a node server and a React client, and I have some problems deploying the react on Kubernetes.
After several researches I learned that in order to use react docker, I had to launch the docker in interactive mode with the flag -it.
So here are the queries I use to dockersize my front.
docker build -t front-end .
docker run -it -p 3000:3000 -d front-end
And here is the dockerfile.
FROM node:12-slim
ENV NODE_ENV production
WORKDIR /usr/src/app/front-end
COPY ./package.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
On the docker application, this setup works correctly. However I have some problems when using Kubernetes. I can't launch the pods with a container in interactive mode, I tried several methods, but here is my last one:
apiVersion: apps/v1
kind: Deployment
metadata:
name: front
spec:
replicas: 1
selector:
matchLabels:
app: webapps-front-test
version: v01
template:
metadata:
labels:
app: webapps-front-test
version: v01
spec:
volumes:
containers:
- name: front
image: myRep/do_front
stdin: true
tty: true
ports:
- containerPort: 3000
args:
- "-it"
edit : This happen on kubernetes :
kubectl get pods
NAME READY STATUS RESTARTS AGE
front-76998f6794-xx 0/1 CrashLoopBackOff 11 33m
This happen when i run on docker ( which is not a problem since a use -it)
> react-scripts start
ℹ 「wds」: Project is running at http://1xx.x.x.x/
ℹ 「wds」: webpack output is served from
ℹ 「wds」: Content not from webpack is served from /usr/src/app/front-end/public
ℹ 「wds」: 404s will fallback to /
Do you know how to solve this problem? Thank you, Good evening/day
stdin,ttyorargsfor this. Once the pod is up and running, you then can start a shell withkubectl exec -it POD_NAME -- /bin/bash.CrashLoopBackOffstatus.kubectl describe pod front-76998f6794-xxor logs usingkubectl logs front-76998f6794-xxreact-scripts startentrypoint of your image myRep/do_front?