日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Kubernetes中使用CronJob定时备份etcd集群数据

發(fā)布時間:2025/3/17 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Kubernetes中使用CronJob定时备份etcd集群数据 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019獨角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

Kubernetes中使用CronJob定時備份etcd集群數(shù)據(jù)

  • 注意:這里的內(nèi)容已經(jīng)過時
    • 使用kubernetes1.12.3和etcd3.2.24請參考 Kubernetes的etcd探秘-狀態(tài)數(shù)據(jù)備份 。

kubernetes中部署的應(yīng)用的信息都存放在etcd里面,這里面的數(shù)據(jù)非常重要,需要備份,以備不時之需。

這里使用k8s提供的定時任務(wù)來執(zhí)行備份任務(wù),定時任務(wù)的pod要和etcd的pod要在同一個node上面(使用nodeAffinity)。

要求

  • kubernetes 1.6
  • etcd 3.0.17

yaml文件

apiVersion: batch/v2alpha1 kind: CronJob metadata:name: etcd-disaster-recoverynamespace: cron spec:schedule: "0 22 * * *"jobTemplate:spec:template:metadata:labels:app: etcd-disaster-recoveryspec:affinity:nodeAffinity:requiredDuringSchedulingIgnoredDuringExecution:nodeSelectorTerms:- matchExpressions:- key: kubernetes.io/roleoperator: Invalues:- mastercontainers:- name: etcdimage: coreos/etcd:v3.0.17command:- sh- -c- "export ETCDCTL_API=3; \etcdctl --endpoints $ENDPOINT snapshot save /snapshot/$(date +%Y%m%d_%H%M%S)_snapshot.db; \echo etcd backup sucess"env:- name: ENDPOINTvalue: "127.0.0.1:2379"volumeMounts:- mountPath: "/snapshot"name: snapshotsubPath: data/etcd-snapshot- mountPath: /etc/localtimename: lt-config- mountPath: /etc/timezonename: tz-configrestartPolicy: OnFailurevolumes:- name: snapshotpersistentVolumeClaim:claimName: cron-nas- name: lt-confighostPath:path: /etc/localtime- name: tz-confighostPath:path: /etc/timezonehostNetwork: true

?

參考

  • https://v1-6.docs.kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
  • https://coreos.com/etcd/docs/3.0.17/op-guide/recovery.html
  • Kubernetes Master節(jié)點 災(zāi)備恢復(fù)操作指南,https://yq.aliyun.com/articles/561894
  • Kubernetes 備份,https://my.oschina.net/u/2306127/blog/2032463

轉(zhuǎn)載于:https://my.oschina.net/u/2306127/blog/2032457

總結(jié)

以上是生活随笔為你收集整理的Kubernetes中使用CronJob定时备份etcd集群数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。