概述
上篇介绍的是不带pvc的恢复,这篇介绍下带pvc的恢复。
a集群创建nginx
apiVersion: v1
kind: Namespace
metadata:
name: nginx-pvc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:stable-alpine
volumeMounts:
- mountPath: /etc/test
name: test
volumes:
- name: test
persistentVolumeClaim:
claimName: nginx-test
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nginx-test
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 2Gi
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
type: NodePort
ports:
- port: 80
protocol: TCP
name: http
nodePort: 32366
selector:
app: nginx
参考这里:我这里使用的是local-path sc,需要升级k10,使用sidecar。
https://wghdr.top/archives/2381
给nginx-pvc ns打标签
k label ns nginx-pvc k10/injectKanisterSidecar=true
重新创建nginx pod
# 注释掉创建namespace字段
k delete -f nginx.yaml -n nginx-pvc
k apply -f nginx.yaml -n nginx-pvc
k get po -n nginx-pvc
kanister-sidecar已注入。
我这里b集群也是同样的local-path,也需要同样helm upgrade
。
a集群创建备份策略
备份成功,也可以看到Kanister信息。
b集群创建import策略
导入成功。