问题描述
这是我的dockerfile,用于为kubernetes / openshift部署构建映像:
FROM node:8.11.4
RUN mkdir /app
workdir /app
copY package.json .
RUN npm install
copY src src
copY public public
EXPOSE 3000
CMD ["npm","start"]
此应用的源代码克隆自:https://github.com/nodeshift-starters/react-web-app
这是我的部署Yaml:
apiVersion: v1
kind: DeploymentConfig
Metadata:
name: 'react-app'
labels:
app: 'react-app'
spec:
template:
spec:
initContainers:
- name: init-react
imagePullPolicy: IfNotPresent
image: "docker-registry.default.svc:5000/${NAMESPACE}/react-app"
command: ["sh","-c"]
args: ["cp -n -r /app/* /tmp/app; sleep 1; ls -al"]
volumeMounts:
- mountPath: /tmp/app
name: react-storage-volume
containers:
- image: 'react-app:latest'
name: 'react-app'
securityContext:
privileged: false
ports:
- containerPort: 3000
name: http
protocol: TCP
resources:
limits:
memory: 500Mi
volumeMounts:
- name: react-storage-volume
mountPath: /app
volumes:
- name: react-storage-volume
persistentVolumeClaim:
claimName: "${pv_react}-claim"
Metadata:
labels:
app: 'react-app'
replicas: 1
selector:
app: 'react-app'
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- 'react-app'
from:
kind: imagestreamTag
name: 'react-app:latest'
/app
已安装到nfs的安装路径:/mnt/k8sMount/react-data/
。
观察结果是,每当对NFS装载路径中的src/App.js
进行更改时,它就会更新到pod(我已对exec执行并检查了其内容),但是刷新了Web UI浏览器中未显示更改。
另一个观察结果是,如果对pod内的src/App.js
进行了更改,则在浏览器中刷新Web UI时,就会显示更改。
由于我希望对NFS装入路径中的src/App.js
进行更改以反映在Web UI中,因此请向我建议是否有任何错误的部署或实现此目的的替代方法。预先感谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)