How to reboot kubernetes pod and keep the data

I’m now using kubernetes to run the Docker container.I just create the container and i use SSH connect to my pods.

I need to do some system config change so i need to reboot the container but when i`reboot the container it will lose all the data in the pod. kubernetes will run a new pod just like the Docker image original.

  • Meteor Up deployment error
  • Visual Studio docker app: error mounting source path
  • Docker container for application binaries only
  • How to build docker source code after modifying it?
  • Getting all open connections within a docker image
  • Doing dpkg-reconfigure wireshark-common inside of a Dockerfile
  • So how can i reboot the pod and just keep the data in it?

    The kubernetes was offered my Bluemix

  • docker: unauthorized: authentication required
  • Can't install memcached package in PHP5.6-apache container
  • How to set a specfic ip address with docker-compose who's accessible
  • Jenkins docker - running a container, executing shell script etc
  • Docker volume option create folder as “root” user
  • Vagrant and Docker not playing nice
  • One Solution collect form web for “How to reboot kubernetes pod and keep the data”

    You need to learn more about containers as your question suggests that you are not fully grasping the concepts.

    1. Running SSH in a container is an anti-pattern, a container is not a virtual machine. So remove the SSH server from it.
    2. the fact that you run SSH indicates that you may be running more than one process per container. This is usually bad practice. So remove that supervisor and call your main process directly in your entrypoint.
    3. Setup your container image main process to use environment variables or configuration files for configuration at runtime.

    The last item means that you can define environment variables in your Pod manifest or use Kubernetes configmaps to store configuration file. Your Pod will read those and your process in your container will get configured properly. If not your Pod will die or your process will not run properly and you can just edit the environment variable or config map.

    My main suggestion here is to not use Kubernetes until you have your docker image properly written and your configuration thought through, you should not have to exec in the container to get your process running.

    Finally, more generally, you should not keep state inside a container.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.