duanfen1992 2019-04-19 18:28
浏览 237

运行时是否可以在POD的容器中替换可执行文件?

I'm developing a Go executable on Ubuntu and running a kubernetes cluster in minikube. The pod+container that's running in minikube is based on Ubuntu, and I just want to replace the executable in the container. More or less bypassing the need to remake the container because executable is the only thing that needs to change. When my changes are 'ready' I plan to remake the image the container is based on, etc., but that's down the road.

I'm looking to iterate a bit quicker really.

Is this possible? Is there a better way?

  • 写回答

1条回答

  • duanlie4621 2019-04-20 03:57
    关注

    For development purposes ONLY (quite hacky solution), you can have your Ubuntu-Go container running tail -f /dev/null to keep it from finishing, and use a hostPath to mount the path containing your executable to your container. You can run your Go application by running a kubectl exec and any changes you make to your application on your host will be reflected in the container. You can restart the application, again with kubectl exec whenever the executable is updated.

    Here is a good readme on how to use minikube's hostPath.

    REMEMBER IN PRODUCTION to rebuild your container with the correct binary, define the correct entrypoint, and fix your deployment/pod definition to exclude the hostPath.

    Hope this helps!

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记