Skip to content

Commit 0188df4

Browse files
authored
Merge pull request #48347 from xenolinux/encrypt-kms
BZ2070625: Encrypting EBS instance volumes with a KMS key
2 parents e8e9263 + 6db6777 commit 0188df4

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * storage/persistent_storage-aws.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="aws-container-persistent-volumes-encrypt_{context}"]
7+
= Encrypting container persistent volumes on AWS with a KMS key
8+
9+
Defining a KMS key to encrypt container-persistent volumes on AWS is useful when you have explicit compliance and security guidelines when deploying to AWS.
10+
11+
.Prerequisites
12+
13+
* Underlying infrastructure must contain storage.
14+
* You must create a customer KMS key on AWS.
15+
16+
.Procedure
17+
18+
. Create a storage class:
19+
+
20+
[source,yaml]
21+
----
22+
$ cat << EOF | oc create -f -
23+
apiVersion: storage.k8s.io/v1
24+
kind: StorageClass
25+
metadata:
26+
name: <storage-class-name> <1>
27+
parameters:
28+
fsType: ext4 <2>
29+
encrypted: "true"
30+
kmsKeyId: keyvalue <3>
31+
provisioner: ebs.csi.aws.com
32+
reclaimPolicy: Delete
33+
volumeBindingMode: WaitForFirstConsumer
34+
EOF
35+
----
36+
<1> Specifies the name of the storage class.
37+
<2> File system that is created on provisioned volumes.
38+
<3> Specifies the full Amazon Resource Name (ARN) of the key to use when encrypting the container-persistent volume. If you do not provide any key, but the `encrypted` field is set to `true`, then the default KMS key is used. See link:https://docs.aws.amazon.com/kms/latest/developerguide/find-cmk-id-arn.html[Finding the key ID and key ARN on AWS] in the AWS documentation.
39+
40+
. Create a persistent volume claim (PVC) with the storage class specifying the KMS key:
41+
+
42+
[source,yaml]
43+
----
44+
$ cat << EOF | oc create -f -
45+
apiVersion: v1
46+
kind: PersistentVolumeClaim
47+
metadata:
48+
name: mypvc
49+
spec:
50+
accessModes:
51+
- ReadWriteOnce
52+
volumeMode: Filesystem
53+
storageClassName: <storage-class-name>
54+
resources:
55+
requests:
56+
storage: 1Gi
57+
EOF
58+
----
59+
60+
. Create workload containers to consume the PVC:
61+
+
62+
[source,yaml]
63+
----
64+
$ cat << EOF | oc create -f -
65+
kind: Pod
66+
metadata:
67+
name: mypod
68+
spec:
69+
containers:
70+
- name: httpd
71+
image: quay.io/centos7/httpd-24-centos7
72+
ports:
73+
- containerPort: 80
74+
volumeMounts:
75+
- mountPath: /mnt/storage
76+
name: data
77+
volumes:
78+
- name: data
79+
persistentVolumeClaim:
80+
claimName: mypvc
81+
EOF
82+
----

storage/persistent_storage/persistent-storage-aws.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AWS Elastic Block Store volumes can be provisioned dynamically.
1717
Persistent volumes are not bound to a single project or namespace; they can be
1818
shared across the {product-title} cluster.
1919
Persistent volume claims are specific to a project or namespace and can be
20-
requested by users.
20+
requested by users. You can define a KMS key to encrypt container-persistent volumes on AWS.
2121

2222
[IMPORTANT]
2323
====
@@ -52,6 +52,8 @@ include::modules/storage-persistent-storage-volume-format.adoc[leveloffset=+1]
5252

5353
include::modules/storage-persistent-storage-aws-maximum-volumes.adoc[leveloffset=+1]
5454

55+
include::modules/storage-persistent-storage-volume-encrypt-with-kms-key.adoc[leveloffset=+1]
56+
5557
[id="additional-resources_persistent-storage-aws"]
5658
[role="_additional-resources"]
5759
== Additional resources

0 commit comments

Comments
 (0)