Get up to 50% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

Perform etcd Backup for Restricted Environment on OCP 4.3.x

Etcd is the key-value store for OpenShift Container Platform, which persists the state of all resource objects. Back up your cluster’s etcd data regularly and store in a secure location ideally outside the OpenShift Container Platform environment. Do not take an etcd backup before the first certificate rotation completes, which occurs 24 hours after installation, otherwise the backup will contain expired certificates. It is also recommended to take etcd backups during non-peak usage hours, as it is a blocking action.

(Cover image :

I was in OCP 4.3.0 Restricted Environment where OCP Nodes have no Internet Connection even through Proxy, and noticed etcd-snapshot-backup.sh script failed as it tried to download the etcdctl from Internet.

[root@bastion ~]# ssh -i .ssh/id_rsa [email protected]
[core@etcd-1 ~]$ sudo /usr/local/bin/etcd-snapshot-backup.sh ./assets/backup
Creating asset directory ./assets
Downloading etcdctl binary..

In high level to make the etcd backup successful, I had to find etcdctl and copied somewhere ( /root/etcdctl ), and modified etcd-snapshot-backup.sh script

[root@etcd-1 ~]# find / -iname etcdctl*

[root@etcd-1 ~]# diff /usr/local/bin/etcd-snapshot-backup.sh /usr/local/bin/etcd-snapshot-original.sh
40c40
< ETCDCTL="/root/etcdctl"
---
> ETCDCTL="${ASSET_DIR}/bin/etcdctl"
49c49
<   # dl_etcdctl
---
>   dl_etcdctl

Then performed the backup:

[root@etcd-1 ~]# /usr/local/bin/etcd-snapshot-backup.sh assets/backup/
Trying to backup etcd client certs..
etcd client certs found in /etc/kubernetes/static-pod-resources/kube-apiserver-pod-14 backing up to ./assets/backup/
Backing up /etc/kubernetes/manifests/etcd-member.yaml to ./assets/backup/
Trying to backup latest static pod resources..
Snapshot saved at ./assets/tmp/snapshot.db
snapshot db and kube resources are successfully saved to assets/backup//snapshot_db_kuberesources_2020-02-25_030239.tar.gz!

PS: We need to revert back the changes we have on etcd-snapshot-backup.sh script to avoid machine-config operator goes to DEGRADED state due to file mismatch, verification: oc describe pods -n machine-config-operator machine-config-daemon-XXX (the nodes where we modify the script) To fix the DEGRADED state, we need to delete the problematic pods

Note: – Do not forget to store the snapshot backup file somewhere outside the OCP Nodes – For OCP nodes connected using proxy, We might need to add HTTP(S)_PROXY environment variables on the script or export them before running the script – For OCP 4.3.5 and later, You might not need to modify the backup script.

Share :

Related Posts

OpenShift Cluster – How to Drain or Evacuate a Node for Maintenance

OpenShift Cluster – How to Drain or Evacuate a Node for Maintenance

Image : www.oemoffhighway.com As we know OpenShift clusters are bundled with multiple compute nodes, master nodes, infra nodes etc, it’s not a big …

Ansible and Jenkins integration – Red Hat Webinar

Ansible and Jenkins integration – Red Hat Webinar

Join this Red Hat webinar to see how to use Jenkins pipelines to deploy simple applications using Ansible Tower.

Install Grafana Operator on OpenShift Container Platform 4

Install Grafana Operator on OpenShift Container Platform 4

OpenShift Container Platform includes a pre-configured, pre-installed, and self-updating monitoring stack that is based on the Prometheus open source …

OpenShift 4: DHCPD High Availability

OpenShift 4: DHCPD High Availability

Objective One of the support component to install OpenShift 4 is the DHCP . We need to ensure this DHCP is r esilient and highly available hence this …

Certificate & TLS: Becoming Custom(or Own) Root Certificate Authority

Certificate & TLS: Becoming Custom(or Own) Root Certificate Authority

Image: https://qph.fs.quoracdn.net/main-qimg-f2d9af77cbca3c6bc42bdd31437a7d6c Objective Becoming organization/private PKI provider Shared rootCA …

OpenShift 4: Custom API URL Endpoint

OpenShift 4: Custom API URL Endpoint

https://unsplash.com/@pankajpatel Objective On top of the standard api.<cluster_name>. as external API endpoint, we are going to serve this …