I have a simple Dockerfile:
FROM nodered/node-red
# Copy package.json to the WORKDIR so npm builds all
COPY package.json .
COPY node-red-static .
COPY defaults .
RUN npm install --unsafe-perm --no-update-notifier --no-fund --only=production
# NodeRED configuration
COPY .node-red/settings.js /usr/src/node-red/.node-red/settings.js
COPY .node-red/flows.json /data/flows.json
That I turned into an image and run it using:
docker run -it --rm -p 1880:1880/tcp ghcr.io/myorg/myImage:latest
Works like a charm. Now I tried to deploy that to a MicroK8S Kubernetes instance using a deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nodered-deployment
labels:
app: core
spec:
replicas: 2
selector:
matchLabels:
app: core
template:
metadata:
labels:
app: core
spec:
containers:
- name: core
image: ghcr.io/myorg/myImage:latest
ports:
- containerPort: 1880
imagePullPolicy: Always
volumeMounts:
- name: facility-volume
mountPath: '/opt/facility/facility.json'
subPath: facility.json
- name: core-export
mountPath: "/export"
resources:
limits:
memory: "8Mi"
cpu: "500m"
envFrom:
- secretRef:
name: core-secret
imagePullSecrets:
- name: regcred
volumes:
- name: facility-volume
configMap:
name: facility-map
- name: core-export
persistentVolumeClaim:
claimName: export-pv-claim
K8S indicates a successful deployment, but port 1880 is silent.
So I checked the log of the pod. It contains exactly 2 lines:
core@0.1.0 start /usr/src/node-red
node-red --settings ./.node-red/settings.js --userDir ./.node-red "--userDir" "/data"
Then I checked ps -A and get
PID USER TIME COMMAND
1 node-red 0:09 npm
16 node-red 2:08 node /usr/src/node-red/node_modules/.bin/node-red --settin
30 node-red 0:00 /bin/sh
35 node-red 0:00 ps -A
Which would indicate, the application is running? (Or stuck?)
What do I miss?
