Main Menu
- Home
- Kubernetes
- Containerization Stack (DevOps)
- Oracle Cloud Native Environment (OCNE)
- Linux
- Linux "FIND" Command related Articles
- Linux "YUM" Command related Articles
- Linux "PS" Command related Articles
- "AWK" Command related Articles
- Linux "RPM" Command related Articles
- "PING" Command related Articles
- "NTP" related Articles
- Linux Network related Articles and Commands
- Linux Security related Articles
- Linux Troubleshooting Articles
- Linux FILESYSTEM related Articles
- Linux INFINIBAND Network related Articles
- Linux "MOUNT" Command related Articles
- Linux Shell Script Articles
- "BIOS" related Linux Articles
- "NFS" related Articles
- "GREP" Commands related Articles
- Linux "CPU" & "Memory" related Articles
- "SED" Command related Articles
- "SYSTEMCTL" Commands related Articles
- Logical Volumes related Articles
- "TCPDUMPS" related Articles
- GitHub Repositories (tarbots)
- About tarbots
Search
KUBERNETES: How to Backup Kubernetes Certificates?
KUBERNETES (K8S): ETCDCTL Command To Validate The Status of ETCD Database Backup
To Validate the status of etcd database that was backed up and make sure you are able to read the stats from snapshot backup, run below ETCDCTL command. Change /backup directory name in below command to directory where you want to backup etcd database.
sudo ETCDCTL_API=3 etcdctl --write-out=table snapshot status /backup/etcd.db
Below is sample output of above command.
sudo ETCDCTL_API=3 etcdctl --write-out=table snapshot status /home/opc/etcd.db
+----------+----------+------------+------------+
| HASH | REVISION | TOTAL KEYS | TOTAL SIZE |
+----------+----------+------------+------------+
| 56414efa | 940057 | 2001 | 7.0 MB |
+----------+----------+------------+------------+
KUBERNETES (K8S): ETCDCTL Command To Backup ETCD Database (Snapshot Backup)
Below is etcdctl command that has to be run on control.master node to backup etcd database. Backup will be snapshot backup. Change /backup direcotry name in below command to directory where you want to backup etcd database.
ETCDCTL_API=3 etcdctl \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /backup/etcd.db
After successful execution of above command, you should see output as follows:
Snapshot saved at /backup/etcd.db
Above certs will be the default cert names and location. If the cert names/directories are different for etcd, you can gather those details by looking at /etc/kubernetes/manifests/etcd.yaml etcd yaml file.
Below are the important entry lines in etcd yaml file which shows the etcd URL/port, cert fetials and etcd image version being used.
kubeadm.kubernetes.io/etcd.advertise-client-urls: https://10.XX.XX.219:2379
- --advertise-client-urls=https://10.XX.XX.219:2379
- --cert-file=/etc/kubernetes/pki/etcd/server.crt
- --initial-advertise-peer-urls=https://10.XX.XX.219:2380
- --key-file=/etc/kubernetes/pki/etcd/server.key
- --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
- --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
- --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
- --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
image: container-registry.oracle.com/olcne/etcd:3.5.6