$ kubectl create -f example/deployment.yaml 检查etcd-operator服务是否启动成功: $ kubectl get deployment etcd-operator NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE etcd-operator111110d
/ # ETCDCTL_API=3 etcdctl --cacert="/etc/etcdtls/operator/etcd-tls/etcd-client-c a.crt" --cert="/etc/etcdtls/operator/etcd-tls/etcd-client.crt" --key="/etc/etcdt ls/operator/etcd-tls/etcd-client.key" --endpoints="https://<vip>:2379" m ember list 51c79f48887c71c3, started, example-mn7zg95s8s, https://example-mn7zg95s8s.example.default.svc:2380, https://example-mn7zg95s8s.example.default.svc:2379 589b77d81c2e267d, started, example-xx8fskdwd6, https://example-xx8fskdwd6.example.default.svc:2380, https://example-xx8fskdwd6.example.default.svc:2379 64f355e75da60cdb, started, example-x6grchxhmb, https://example-x6grchxhmb.example.default.svc:2380, https://example-x6grchxhmb.example.default.svc:2379 / #
etcd集群数据备份及恢复
etcd集群数据备份
部署etcd-backup-operator:
1 2 3 4
$ kubectl create -f example/etcd-backup-operator/deployment.yaml $ kubectl get pods NAME READY STATUS RESTARTS AGE etcd-backup-operator-68f847c4d9-k6pnj 1/1 Running 16h11m
检查etcd-backup-operator是否创建EtcdBackup CRD成功:
1 2 3
$ kubectl get crd NAME KIND etcdbackups.etcd.database.coreos.com CustomResourceDefinition.v1beta1.apiextensions.k8s.io
# kubectl get pods NAME READY STATUS RESTARTS AGE etcd-restore-operator-859c9f479-lkzsm 1/1 Running 249m
检查etcd-restore-operator是否创建EtcdRestore CRD成功
1 2 3
$ kubectl get crd NAME KIND etcdrestores.etcd.database.coreos.com CustomResourceDefinition.v1beta1.apiextensions.k8s.io
创建EtcdRestore CR,编辑restore_cr.yaml文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
apiVersion:"etcd.database.coreos.com/v1beta2" kind:"EtcdRestore" metadata: # The restore CR name must be the same as spec.etcdCluster.name name:example spec: etcdCluster: # The namespace is the same as this EtcdRestore CR name:example backupStorageType:S3 s3: # The format of "path" must be: "<s3-bucket-name>/<path-to-backup-file>" # e.g: "mybucket/etcd.backup" path:etcd-bucket/etcd.backup_v2_2019-10-11-08:53:40 awsSecret:aws endpoint:http://xx.xx.xx.cn forcePathStyle:true