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.

  • Deploying Docker Swarm mode services across multiple failure domains
  • Docker port mapping not working, “connection refused”
  • ADD command not working Docker
  • Alternatives to debug a docker + gunicorn app in production
  • How can i persist my logs/data to local filesystem in docker
  • How to determine IP for containers in host ubuntu machine docker?
  • So how can i reboot the pod and just keep the data in it?

    The kubernetes was offered my Bluemix

  • How to back up docker swarm mode service configuration for disaster recovery
  • Docker container DHCP like bridged VirtualBox
  • Starting a process in the Dockerfile
  • Swarm container not getting started with created overlay network
  • How can I have nginx in one container and php-fpm in another?
  • meteor up listen tcp 0.0.0.0:80: bind: address already in use
  • 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.