It will automatically create a backup of internal etcd cluster in minikube under /data/backup folder. This is done using CronJob in Kubernetes. The same procedure applies for any K8s cluster with internal etcd cluster.
- Running instance of Minikube cluster.
- Check the image of etcd used. To do so login into Minikube instance and view the file /etc/kubernetes/manifests/etcd.yaml
minikube ssh
sudo cat /etc/kubernetes/manifests/etcd.yaml
under spec.containers.image you will get the image
image: k8s.gcr.io/etcd:3.4.3-0
then change the YAML accordingly on line 15.
- Check for --trusted-ca-file, --cert-file and --key-file from the above cat output and replace on line 23
replace the value of --trusted-ca-file in
--cacert=[CA CERT FILE PATH]
replace the value of --cert-file in
--cert=[SERVER CERT FILER PATH]
replace the value of --key-file in
--key=[SERVER KEY FILE PATH]
- After modification of the YAML file create the CronJob using the command
kubectl create -f k8s-internal-etcd-cluster-backup.yaml
You can check the view the created CronJob using the command
kubectl get cronjob -n kube-system