Reputation: 707
My Kubernetes deployment is failing. Can anybody advise what could be going wrong.
My observation: When I remove the volume mount things the service bounce back
volumeMounts:
- name: my-volume
mountPath: /app
volumes:
- name: my-volume
hostPath:
path: /tmp/vpath
Remove the above piece of the code
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: ContainerCannotRun
Message: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "./main": stat ./main: no such file or directory: unknown
Here is my deployment file
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: stservice
name: stservice
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: stservice
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: stservice
spec:
containers:
- image: stservice
name: stservice
imagePullPolicy: Never
ports:
- containerPort: 5001
- containerPort: 5002
volumeMounts:
- name: my-volume
mountPath: /app
volumes:
- name: my-volume
hostPath:
path: /tmp/vpath
status: {}
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: stservice
name: stservice
spec:
ports:
- name: "5001"
port: 5001
targetPort: 5001
- name: "5002"
port: 5002
targetPort: 5002
selector:
io.kompose.service: stservice
status:
loadBalancer: {}
Can anyone advice why having volume mount causes this failure
Message: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "./main": stat ./main: no such file or directory: unknown
Upvotes: 0
Views: 93
Reputation: 170
I think you might be mounting the volume over the Dockerfile WORKDIR, so you are overwriting the file that it is looking for and throwing this error: "... /main: no such file or directory:".
If that is the issue update the docker WORKDIR or the mount path. If that is not the issue please include the Dockerfile.
Upvotes: 2