How To Enable/Disable ETCD Backup Using Qbert API
Problem
You would like to enable/disable ETCD backup on an existing cluster using Qbert API.
Environment
- Platform9 Managed Kubernetes - All versions
- Qbert
- ETCD
Procedure
- Obtain a token for authentication purposes. Keystone Identity API: This link describes the process for getting a Keystone authentication token in order to access the PMK REST APIs.
TOK=$(openstack token issue -f value -c id)- Run the following command to query the current ETCD Backup configuration.
curl -skX GET https://<DU_FQDN>/qbert/v4/<projectID>/clusters/<clusterUUID> --header "X-Auth-Token: $TOK" | jq .etcdBackup{ "isEtcdBackupEnabled": 0, "intervalInMins": 0, "storageType": "", "storageProperties": null, "taskStatus": "", "taskErrorDetail": ""}- Configure the ETCD Backup by running the following command.
curl -skX PUT -i https://<DU_FQDN>/qbert/v4/<projectID>/clusters/<clusterUUID> --header "X-Auth-Token: $TOK" --header "Content-Type: application/json" --data '{"etcdBackup": {"isEtcdBackupEnabled": "1", "intervalInMins": "1440", "storageType": "local", "storageProperties": {"localPath": "/etc/pf9/etcd-backup"}}}'HTTP/1.1 200 OKServer: nginx/1.18.0Date: Thu, 08 Jul 2021 01:21:32 GMTContent-Type: text/plain; charset=utf-8Content-Length: 2Access-Control-Allow-Credentials: trueAccess-Control-Expose-Headers: X-Subject-TokenX-Frame-Options: DENYX-XSS-Protection: 1X-Content-Type-Options: nosniffStrict-Transport-Security: max-age=3600# kubectl get cronjob -n kube-systemNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGEetcd-backup */1440 * * * * False 0 <none> 16sPlease configure the intervalInMins, storageType, and localPath properties as per your requirement.
- Validate if the ETCD Backup properties were updated in the Qbert DB.
curl -skX GET https://<DU_FQDN>/qbert/v4/<projectID>/clusters/<clusterUUID> --header "X-Auth-Token: $TOK" | jq .etcdBackup{ "isEtcdBackupEnabled": 1, "intervalInMins": 1440, "storageType": "local", "storageProperties": { "localPath": "/etc/pf9/etcd-backup" }, "taskStatus": "success", "taskErrorDetail": ""}ETCD backup has been successfully enabled on your cluster.
- Disable the ETCD Backup by running the following command.
curl -skX PUT -i https://<DU_FQDN>/qbert/v4/<projectID>/clusters/<clusterUUID> --header "X-Auth-Token: $TOK" --header "Content-Type: application/json" --data '{"etcdBackup": {"isEtcdBackupEnabled": "0","intervalInMins": "0", "storageType": "", "storageProperties": {"localPath": ""}}}'- Validate if the ETCD Backup properties were updated in the Qbert DB.
curl -skX GET https://<DU_FQDN>/qbert/v4/<projectID>/clusters/<clusterUUID> --header "X-Auth-Token: $TOK" | jq .etcdBackup{ "isEtcdBackupEnabled": 0, "intervalInMins": 0, "storageType": "", "storageProperties": { "localPath": "" }, "taskStatus": "success", "taskErrorDetail": ""}# kubectl get cronjob -n kube-systemNo resources found in kube-system namespace.ETCD backup has been successfully disabled on the cluster.
Was this page helpful?