-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusage.yaml
65 lines (53 loc) · 1.54 KB
/
usage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# ---------------------------------------------------------------------------- #
# Must first have available a PersistentVolumeClaim named "crypt-underlying-pvc"
# in namespace "default" corresponding to a block volume.
# ALL DATA ON THE crypt-underlying-pvc PersistentVolumeClaim WILL BE LOST ONCE
# THE crypt-wrapping-pvc PersistentVolumeClaim BELOW IS CREATED!
# ---------------------------------------------------------------------------- #
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: crypt-storage-class
provisioner: crypt-provisioner
---
apiVersion: v1
kind: Secret
metadata:
name: crypt-secret
stringData:
passphrase: my-passphrase
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: crypt-wrapping-pvc
annotations:
crypt/underlyingClaimName: crypt-underlying-pvc
crypt/secretName: crypt-secret
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1
storageClassName: crypt-storage-class
---
# Exec into this pod and check the /volume block device.
apiVersion: v1
kind: Pod
metadata:
name: crypt-test-pod
spec:
terminationGracePeriodSeconds: 0 # ensure that the pod can be deleted quickly
containers:
- name: container
image: ubuntu:20.04
command: [ sleep, infinity ] # wait until pod is manually deleted
volumeDevices:
- name: volume
devicePath: /volume
volumes:
- name: volume
persistentVolumeClaim:
claimName: crypt-wrapping-pvc
# ---------------------------------------------------------------------------- #