In k8s, it is not possible to start the container directly. The container must be started in the form of a pod. When the pod fails to start, you can debug like this.
1. Find the image started by the pod, re-encapsulate the image, and modify the entry of the image
FROM xxxxx //pod启动的镜像
ENTRYPOINT ["python", "-m", "SimpleHTTPServer", "8080"] //修改镜像的入口
2. Upload the image to the image library
3. Modify the yaml file of the pod, modify the mirror address, modify the probe
containers:
- name: containers_name
image: image_path
//这里要注意要把levenesspoint给屏蔽了,要不会一直kill掉containers,然后重启
4. Use kubectl exec -it -n <namespaces> <podname> /bin/sh to enter the containers to run your own code and debug.