snippets > mysql-dumps-via-kubectl

March 13, 2020

Get MySQL/MariaDB dumps directly from kubectl

kubectl -n <namespace> exec <pod_name> -it -- bash -c 'mysqldump --databases $MYSQL_DATABASE -u$MYSQL_USER -p$MYSQL_PASSWORD' > dump-`date '+%Y_%m_%d__%H_%M_%S'`.sql