Whatever mount path i add for PVC it is creating lost+found folder and deleting all other content.
I am trying to setup deployment with PVC
FROM python:3.5 AS python-build
ADD . /test
WORKDIR /test
CMD [ "python3", "./run.py" ]
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: test-core
labels:
app: test-core
spec:
selector:
matchLabels:
app: test-core
tier: frontend
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: test-core
tier: frontend
spec:
containers:
- image: <My image>
securityContext:
privileged: true
runAsUser: 1000
resources:
requests:
memory: "128Mi"
cpu: .05
limits:
memory: "256Mi"
cpu: .10
name: test-core
ports:
- containerPort: 9595
name: http
- containerPort: 443
name: https
readinessProbe:
httpGet:
path: /
port: 9595
initialDelaySeconds: 5
periodSeconds: 3
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 4
envFrom:
- secretRef:
name: test-secret
- configMapRef:
name: test-new-configmap
volumeMounts:
- name: core-data
mountPath: /test
imagePullPolicy: Always
volumes:
- name: core-data
persistentVolumeClaim:
claimName: core-claim
When i apply this file from kubernetes it's giving an error in the log cannot find file run.py that mean PVC going empty.
Whatever mount path a add it is creating lsot+found folder and deleting all other content.
Thanks
According your Dockerfile
, when you run docker build -t <imagename> .
, it will copy all files on your current directory to container image. And when you start this container, it will look for run.py
.
If one of theese files is run.py
, which actually should be, then your deployment yaml file is not correct, because you mount another PV to that directory, which will overwrite your files which you copied before and it won't able to find run.py
Hope it helps.