ksync speeds up developers who build applications for Kubernetes. It transparently updates containers running on the cluster from your local checkout. This enables developers to use their favorite IDEs, such as Atom or Sublime Text to work from inside a cluster instead of from outside it. There is no reason to wait minutes to test code changes when you can see the results in seconds.

If you’ve been wanting to do something like docker run -v /foo:/bar with Kubernetes, ksync is for you!

Using ksync is as simple as:

  1. ksync create --pod=my-pod local_directory remote_directory to configure a folder you’d like to sync between your local system and a specific container running on the cluster.
  2. ksync watch to connect to the cluster and start updating the container.
  3. Use your favorite editor, like Atom or Sublime Text to modify the application. It will auto-reload for you remotely, in seconds.


See it in action, below or try it out in your browser using this Katacoda scenario:



You can also download the latest release and install it yourself.


curl https://ksync.github.io/gimme-that/gimme.sh | bash


Download the latest release and install it yourself.


Grab the source and build the binary.

go get github.com/ksync/ksync/cmd/ksync

More detailed information is in the development documentation.


To update to (or check for) a newer version of ksync, you can use the built in updater.

ksync update

Once a newer ksync binary has been downloaded, the cluster portion can be updated with ksync init.

ksync init --upgrade

You can check the current versions by running ksync version.

ksync version


Getting Started

You can run through this via. a katacoda scenario in your browser as well.

  1. Install ksync. This will fetch the binary and put it at /usr/local/bin. Feel free to just download the release binary for your platform and install it yourself.

     curl https://ksync.github.io/gimme-that/gimme.sh | bash
  2. Initialize ksync and install the server component on your cluster. The server component is a DaemonSet that provides access to each node’s filesystem. This will also go through a set of pre and postflight checks to verify that everything is working correctly. You can run these yourself by using ksync doctor.

     ksync init
  3. Startup the local client. It watches your local config to start new jobs and the kubernetes API to react when things change. This will just put it into the background. Feel free to run in a separate terminal or add as a service to your host.

     ksync watch &
  4. Add the demo app to your cluster. This is a simple python app made with flask. Because ksync moves files around, it would work for any kind of data you’d like to move between your local system and the cluster.

     kubectl apply -f https://ksync.github.io/ksync/example/app/app.yaml
  5. Make sure that the app is ready and running.

     kubectl get po --selector=app=app
  6. Create a new spec that describes a folder to sync between a local directory and a directory inside a running container on the remote cluster. The local directory is empty and that is okay. Because ksync is bi-directional, it will move all the files from the running container locally. This is just a convenient way to get the code from the container and skip a couple steps. If you’re working with a local copy already, only the most recently updated files will be transfered between the container and your local machine.

     mkdir -p $(pwd)/ksync
     ksync create --selector=app=app $(pwd)/ksync /code
  7. Check on the status. You should see a watching state with a pod name in the list.

     ksync get
  8. Forward the remote port to your local system.

     kubectl get po --selector=app=app -o=custom-columns=:metadata.name --no-headers | \
         xargs -IPOD kubectl port-forward POD 8080:80 &
  9. Take a look at what the app’s response is now. You’ll see all the files in the remote container, their modification times and when the container was last restarted.

     curl localhost:8080
  10. Open up the code in your favorite editor. For demo purposes, this assumes you’ve configured EDITOR. You really can open it however you’d like though.

     open ksync/server.py
  11. Add a new key to the JSON response by editing the return value.

     return jsonify({
         "ksync": True,
         "restart": LAST_RESTART,
         "pod": os.environ.get('POD_NAME'),
         "files": file_list,
  12. Take a look at the status now. It should be reloading the remote container.

     ksync get
  13. After about 10 seconds, hit the container again and you should see your new response.

     curl localhost:8080

Further Exploration


Tested Configurations





By default ksync create a PodSecurityPolicy (to allow it to use HostPath). If for some reason this PodSecurityPolicy is not suitable, it can be disabled by using the --psp=false of ksync init. ksync would still create and assign a service account, so another PodSecurityPolicy can be applied.



More detailed documentation can be found in the docs directory.