@@ -101,18 +101,16 @@ to a situation where updates to the `Ingress` (i.e a new DNS name) are not
101
101
applied to the ` Certificate ` .
102
102
103
103
To avoid this issue, in most cases ` Certificate ` s created via ` ingress-shim `
104
- can be excluded from the backup. Given that the restore happens
104
+ should be excluded from the backup. Given that the restore happens
105
105
in the correct order (` Secret ` with the X.509 certificate restored before
106
106
the ` Ingress ` ) ` cert-manager ` will be able to create a new ` Certificate `
107
107
for the ` Ingress ` and determine that the existing ` Secret ` is for that ` Certificate ` .
108
108
109
109
### Velero
110
110
111
- We have briefly tested backup and restore with ` velero ` ` v1.5.3 ` and
112
- ` cert-manager ` versions ` v1.3.1 ` and ` v1.3.0 ` as well as ` velero ` ` v1.3.1 `
113
- and ` cert-manager ` ` v1.1.0 ` .
111
+ We have tested backup and restore with ` velero ` ` v1.12.2 ` and ` cert-manager ` version ` v1.13.2 ` .
114
112
115
- A few potential edge cases:
113
+ A few potential edge cases:
116
114
117
115
- Ensure that the backups include ` cert-manager ` CRDs.
118
116
For example, we have seen that if ` --exclude-namespaces ` flag is passed to
@@ -124,7 +122,7 @@ We have briefly tested backup and restore with `velero` `v1.5.3` and
124
122
exclude ` Order ` s, ` Challenge ` s and ` CertificateRequest ` s from the backup, see
125
123
[ Excluding some cert-manager resources from backup] ( #excluding-some-cert-manager-resources-from-backup ) .
126
124
127
- - Velero's [ default restore order] ( https://github.com/vmware-tanzu/velero/blob/main /pkg/cmd/server/server.go#L470 ) (` Secrets ` before ` Ingress ` es, Custom Resources
125
+ - Velero's [ default restore order] ( https://github.com/vmware-tanzu/velero/blob/a318e1da995a390c9f10e4aef7df356594944377 /pkg/cmd/server/server.go#L511-L543 ) (` Secrets ` before ` Ingress ` es, Custom Resources
128
126
restored last), should ensure that there is no unnecessary certificate reissuance
129
127
due to the order of restore operation, see [ Order of restore] ( #order-of-restore ) .
130
128
@@ -140,6 +138,41 @@ We have briefly tested backup and restore with `velero` `v1.5.3` and
140
138
` Certificate ` s created for ` Ingress ` es from the backup even when not
141
139
re-creating the ` Ingress ` itself. See [ Restoring Ingress Certificates] ( #restoring-ingress-certificates ) .
142
140
141
+
142
+ #### Example backup and restore using Velero
143
+
144
+ The following command will create a backup of all Kubernetes resources in the
145
+ default and cert-manager namespaces, excluding ` Order ` s, ` Challenge ` s and
146
+ ` CertificateRequest ` s (see above):
147
+ ``` bash
148
+ velero backup create \
149
+ full-backup \
150
+ --include-namespaces cert-manager,default \
151
+ --include-cluster-resources=true \
152
+ --exclude-resources challenges.acme.cert-manager.io,orders.acme.cert-manager.io,certificaterequests.cert-manager.io
153
+ ```
154
+
155
+ To workaround Velero not restoring owner references, you can restore the backup
156
+ in two steps: first restore the ` Secret ` s and ` Ingress ` es and the ` cert-manager `
157
+ deployment, second restore the ` Certificate ` resources. This will allow ` cert-manager ` 's
158
+ controller to create the ` Certificate ` for the ingresses and set the owner reference.
159
+ The second restore will then restore the manually created ` Certificate ` s and detect that
160
+ the generated ` Certificate ` s for the ` Ingress ` es already exist and will not attempt to
161
+ recreate them.
162
+
163
+ 1 . Restore everything except ` Certificate ` resources:
164
+ ``` bash
165
+ velero restore create \
166
+ --from-backup full-backup \
167
+ --exclude-resources certificates.cert-manager.io
168
+ ```
169
+
170
+ 2 . Wait for cert-manager to create the ` Certificate ` s for the ` Ingress ` es (if cert-manager is having RBAC/ webhook issues, you might have to manually restart the deployments). After the auto-generated ` Certificate ` s are created, restore the manually created ` Certificate ` s:
171
+ ``` bash
172
+ velero restore create \
173
+ --from-backup full-backup
174
+ ```
175
+
143
176
## Backing up CertificateRequests
144
177
145
178
We no longer recommend including ` CertificateRequest ` resources in a backup
0 commit comments