Deploy NodeJS Docer to QiO Edge Coud using Kubenetes


クリアーアプリand build dockerイメージ
Create a file of the name Dockerfile with the content below and put into your project root folder.
# specify the node base image with your desired version node:
FROM node:8

WORKDIR /app

RUN chown -R node:node /usr/local/lib/node_modules
RUN chown -R node:node /usr/local/bin
USER node

RUN npm install node-red -g
RUN npm install node-red-node-mongodb -g
RUN npm i node-red/node-red-dashboard -g

# port 1880 for node-red-dashboard
EXPOSE 1880

CMD node-red
Build using docker build -t nodejs .Tag&Push docker image to the privte registry
docker tag nodejs qio01:5000/nodejs:1.0.1
docker push qio01:5000/nodejs:1.0.1
Deploy in Kubennetes
  • Goto default Stock.
  • Add a service,fill in Name,Hostname,Select Image,and rote Port Map.
  • Goto nginx load balancer in Rancher.
  • Add a port rule,select Protocol and Targetイメージ,fill in host Port and target Port.
  • Enjoy