@@ -85,8 +85,9 @@ kubectl wait --namespace cert-manager --timeout=15m --for=condition=Ready cluste
85
85
86
86
Create new certificate and let it sign by Let's Encrypt to validate it:
87
87
88
- ``` shell
89
- tee " ${TMP_DIR} /${CLUSTER_FQDN} /k8s-cert-manager-certificate-production.yml" << EOF | kubectl apply -f -
88
+ ``` bash
89
+ if ! aws s3 ls " s3://${CLUSTER_FQDN} /velero/backups" | grep -q velero-weekly-backup-cert-manager; then
90
+ tee " ${TMP_DIR} /${CLUSTER_FQDN} /k8s-cert-manager-certificate-production.yml" << EOF | kubectl apply -f -
90
91
apiVersion: cert-manager.io/v1
91
92
kind: Certificate
92
93
metadata:
@@ -107,7 +108,8 @@ spec:
107
108
- "*.${CLUSTER_FQDN} "
108
109
- "${CLUSTER_FQDN} "
109
110
EOF
110
- kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certificate ingress-cert-production
111
+ kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certificate ingress-cert-production
112
+ fi
111
113
```
112
114
113
115
### Create S3 bucket
@@ -120,8 +122,9 @@ kubectl wait --namespace cert-manager --for=condition=Ready --timeout=10m certif
120
122
Use CloudFormation to create S3 bucket which will be used to store backups from
121
123
Velero.
122
124
123
- ``` shell
124
- cat > " ${TMP_DIR} /${CLUSTER_FQDN} /aws-s3.yml" << \EOF
125
+ ``` bash
126
+ if ! aws s3 ls " s3://${CLUSTER_FQDN} " ; then
127
+ cat > " ${TMP_DIR} /${CLUSTER_FQDN} /aws-s3.yml" << \EOF
125
128
AWSTemplateFormatVersion: 2010-09-09
126
129
127
130
Parameters:
@@ -256,9 +259,10 @@ Outputs:
256
259
Value: !Ref S3ChangeNotificationTopic
257
260
EOF
258
261
259
- aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM \
260
- --parameter-overrides S3BucketName=" ${CLUSTER_FQDN} " EmailToSubscribe=" ${MY_EMAIL} " \
261
- --stack-name " ${CLUSTER_NAME} -s3" --template-file " ${TMP_DIR} /${CLUSTER_FQDN} /aws-s3.yml"
262
+ aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM \
263
+ --parameter-overrides S3BucketName=" ${CLUSTER_FQDN} " EmailToSubscribe=" ${MY_EMAIL} " \
264
+ --stack-name " ${CLUSTER_NAME} -s3" --template-file " ${TMP_DIR} /${CLUSTER_FQDN} /aws-s3.yml"
265
+ fi
262
266
```
263
267
264
268
## Install Velero
@@ -413,8 +417,10 @@ default aws k01.k8s.mylabs.dev/velero Available 2023-03-23 20:16:20
413
417
414
418
Initiate backup process and save the necessary cert-manager object to S3:
415
419
416
- ``` shell
417
- velero backup create --labels letsencrypt=production --ttl 2160h0m0s --from-schedule velero-weekly-backup-cert-manager
420
+ ``` bash
421
+ if ! aws s3 ls " s3://${CLUSTER_FQDN} /velero/backups" | grep -q velero-weekly-backup-cert-manager; then
422
+ velero backup create --labels letsencrypt=production --ttl 2160h0m0s --from-schedule velero-weekly-backup-cert-manager
423
+ fi
418
424
```
419
425
420
426
Check the backup details:
@@ -670,7 +676,7 @@ Few commands showing the details after cert-manager renewed the certificate.
670
676
671
677
Examine the certificate:
672
678
673
- ``` shell
679
+ ``` bash
674
680
kubectl describe certificates -n cert-manager ingress-cert-production
675
681
```
676
682
0 commit comments