In one of my containers I am getting the error
Warning Failed 7m52s (x4 over 8m33s) kubelet Error: failed to start container "xxx-xxx": Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/src/application/entrypoint.sh": stat /src/application/entrypoint.sh: no such file or directory: unknown
I can't figure out why this is an issue, as running my docker-compose file outside of kube.netes hasn't presented any issues.
The yaml section for this looks like:
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: xxx-xxx
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: xxx-xxx
spec:
containers:
- env:
- name: BEARER_TOKEN
valueFrom:
configMapKeyRef:
key: BEARER_TOKEN
name: xxx-xxx-env-dev
- name: PGADMIN_DEFAULT_EMAIL
valueFrom:
configMapKeyRef:
key: PGADMIN_DEFAULT_EMAIL
name: xxx-xxx-env-dev
- name: PGADMIN_DEFAULT_PASSWORD
valueFrom:
configMapKeyRef:
key: PGADMIN_DEFAULT_PASSWORD
name: xxx-xxx-env-dev
- name: PGADMIN_LISTEN_PORT
valueFrom:
configMapKeyRef:
key: PGADMIN_LISTEN_PORT
name: xxx-xxx-env-dev
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
key: POSTGRES_DB
name: xxx-xxx-env-dev
- name: POSTGRES_HOST_NAME
valueFrom:
configMapKeyRef:
key: POSTGRES_HOST_NAME
name: xxx-xxx-env-dev
- name: POSTGRES_PASSWORD
valueFrom:
configMapKeyRef:
key: POSTGRES_PASSWORD
name: xxx-xxx-env-dev
- name: POSTGRES_PORT
valueFrom:
configMapKeyRef:
key: POSTGRES_PORT
name: xxx-xxx-env-dev
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
key: POSTGRES_USER
name: xxx-xxx-env-dev
image: x/xx-xxx-xxx:prod
name: xxx-xxx
ports:
- containerPort: 5000
resources: {}
volumeMounts:
- mountPath: /src/application
name: xxx-xxx-claim0
restartPolicy: Always
volumes:
- name: xxx-xxx-claim0
persistentVolumeClaim:
claimName: xxx-xxx-claim0
It seems kube.netes can't locate the entrypoint file, what can I do to make it accessible? Is this persisten volume related? Sorry but I am a beginner at Kube.netes.
In docker-compose was the entrypoint.sh mounted from the host, eg $PWD/app? If yes, this setup would be hard to replicate with kube.netes, kompose does have an option to use hostPath
but this would work only for a local dev setup like minikube or docker desktop.
For a dev workflow which works well with kube.netes tools like https://skaffold.dev/ or https://devspace.sh/ can be used, both have a file sync feature so that dev artifacts are synced inside the container, as it is said in some comments the entrypoint should not stay in a volume, it shuld be part of the image and the dev tools should allow the local copy to be deployed quickly during the dev+test cycles.
Another option is to keep docker-compose for dev and use k8s/helm for production, although I am not a big fan of this approach since it will add a big overhead when troubleshooting prod.
To workaround the error and be able to check the contents of the volume from inside the container add command: [ "/bin/bash", "-c", "sleep 1000000" ]
to your pod definition, then use kubectl exec
to get an interactive shell.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.