# kubectl get [pod | po] [--all-namespaces | -n {NAMESPACE}] | grep {keyword}
$ kubectl get po -n database | grep maria
# kubectl exec [po | pod] -n {NAMESPACE} -it {POD_NAME} /bin/bash
$ kubectl exec po -n database mariadb-master-0
# Kubectl exec -n {NAMESPACE} -it {POD_NAME} -- /bin/bash
$ kubectl exec po -n database -it mariadb-master-0 -- /bin/bash
# mysqldump -u{USER_NAME} -p -A > {FILE_PATH(NAME)}
$ mysqldump -uroot -p -A > /tmp/dump.sql
# kubectl cp {NAMESPACE}/{POD_NAME}:{SOURCE_FILE_PATH} {TARGET_FILE_PATH}
$ kubectl cp database/mariadb-master-0:/tmp/dump.sql ~/mariadb-master-dump.sql
# tar zcvf {FILE_NAME}.tar.gz [ * | {FILE(DIR)_NAME}]
$ tar zcvf mariadb-master-dump.tar.gz ~/mariadb-master-dump.sql
Leave a comment