0

Say I have a /src directory which I copy onto a pod in my Dockerfile. I can modify source files locally but I need to run kubectl cp in order to place every single file on the pod. Any way to temporarily link my local storage to a running pod?

It can be as easy as a file system watcher that runs kubectl cp, which is what I'd probably implement if there's no existing tool, but I really doubt there isn't.

I came across https://github.com/ksync/ksync but this is an advanced solution that requires me to install something on my cluster, which I can't/won't do.

1 Answer 1

1

The best way is to use something like Azure DevOps that monitors your GitHub, automatically build a new image with the new source code, and handles the rollout of the new image into k8s. It sounds like a lot of new setup, but it is not that bad at all. Here is a write-up on it: https://cloudblogs.microsoft.com/opensource/2018/11/27/tutorial-azure-devops-setup-cicd-pipeline-kubernetes-docker-helm/

An option to consider if you just want to stick with the source tree sync out to existing pods is Shipit (https://github.com/shipitjs/shipit). You'd need to configure a SSH ingress to your pods for it to be a solution but it is a very slick way to manage things. Not just for pushing code but also managing easy rollbacks.

2
  • Hey :). Thanks for your answer. I actually don't want to redeploy the pod. I want to patch files inside it WITHOUT redeploying it. I know the entire idea of pods is to kill them without mercy, but I cached data on it that I don't want to wipe.
    – Axonn
    Mar 17, 2021 at 22:32
  • Gotcha - every situation is unique so I get it. I definitely think ShipIt is a worthwhile option for you to consider then if you can get the SSH routing to work for you. Best wishes!
    – Adam Ellis
    Mar 18, 2021 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .