@@ -17,10 +17,14 @@ It is recommended to read following kubernetes documents
17
17
* [ Encrypting Secret Data at Rest] ( https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/#verifying-that-data-is-encrypted )
18
18
* [ Using a KMS provider for data encryption] ( https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/ )
19
19
20
+
20
21
## Installation Steps
22
+
21
23
The following installation steps assumes that you have a Kubernetes cluster(v1.10+) running on OpenStack Cloud.
22
24
23
- 1 . Create 256bit(32 byte) cbc key and store in barbican
25
+
26
+ ### Create 256bit(32 byte) cbc key and store in barbican
27
+
24
28
```
25
29
$ openstack secret order create --name k8s_key --algorithm aes --mode cbc --bit-length 256 --payload-content-type=application/octet-stream key
26
30
+----------------+-----------------------------------------------------------------------+
@@ -37,7 +41,8 @@ $ openstack secret order create --name k8s_key --algorithm aes --mode cbc --bit-
37
41
+----------------+----------------------------------------------------------------------+
38
42
```
39
43
40
- 2 . Get the Key Id, It is the uuid in * Secret href*
44
+ ### Get the Key ID, It is the ** uuid** in * Secret href*
45
+
41
46
```
42
47
$ openstack secret order get http://hostname:9311/v1/orders/e477a578-4a46-4c3f-b071-79e220207b0e
43
48
+----------------+-----------------------------------------------------------------------+
@@ -54,39 +59,39 @@ $ openstack secret order get http://hostname:9311/v1/orders/e477a578-4a46-4c3f-b
54
59
+----------------+-----------------------------------------------------------------------+
55
60
```
56
61
57
- 3 . Add the key-id in your cloud-config file
58
- ```
62
+
63
+ ### Add the Key ID in your cloud-config file
64
+
65
+ ``` toml
59
66
[Global ]
60
- username = <username>
61
- password = <password>
62
- domain-name = <domain-name>
63
- auth-url = <keystone-url>
64
- tenant-id = <project-id>
65
- region = <region>
67
+ username = " <username>"
68
+ password = " <password>"
69
+ domain-name = " <domain-name>"
70
+ auth-url = " <keystone-url>"
71
+ tenant-id = " <project-id>"
72
+ region = " <region>"
66
73
67
74
[KeyManager ]
68
- key-id = <key-id>
75
+ key-id = " <key-id>"
69
76
```
70
77
71
- 4 . Clone the cloud-provider-openstack repo and build the docker image for barbican-kms-plugin in architecture amd64
72
- ```
73
- $ git clone https://github.com/kubernetes/cloud-provider-openstack.git $GOPATH/k8s.io/src/
74
- $ cd $GOPATH/k8s.io/src/cloud-provider-openstack/
75
- $ export ARCH=amd64
76
- $ export VERSION=latest
77
- $ make image-barbican-kms-plugin
78
- ```
79
78
80
- 5 . Run the KMS Plugin in docker container
81
- ```
82
- $ docker run -d --volume=/var/lib/kms:/var/lib/kms \
83
- --volume=/etc/kubernetes:/etc/kubernetes \
84
- -e socketpath=/var/lib/kms/kms.sock \
85
- -e cloudconfig=/etc/kubernetes/cloud-config \
86
- registry.k8s.io/provider-os/barbican-kms-plugin:v1.27.0-alpha.0
79
+ ### Run the KMS Plugin in your cluster
80
+
81
+ This will provide a socket at ` /var/lib/kms/kms.sock ` on each of the control
82
+ plane node
87
83
```
88
- 6 . Create /etc/ kubernetes/encryption-config .yaml
84
+ kubectl apply -f https://raw.githubusercontent.com/ kubernetes/cloud-provider-openstack/master/manifests/barbican-kms/ds .yaml
89
85
```
86
+ * recommendation:* Use the tag corresponding to your Kubernetes release, for
87
+ example ` release-1.25 ` for kubernetes version 1.25.
88
+
89
+
90
+ ### Create encrytion configuration
91
+
92
+ Create ` /etc/kubernetes/encryption-config.yaml ` on each of your control plane
93
+ nodes
94
+ ``` yaml
90
95
kind : EncryptionConfig
91
96
apiVersion : v1
92
97
resources :
@@ -98,12 +103,44 @@ resources:
98
103
endpoint : unix:///var/lib/kms/kms.sock
99
104
cachesize : 100
100
105
- identity : {}
101
- ```
102
- 7 . Enable --experimental-encryption-provider-config flag in kube-apiserver and restart it.
103
106
` ` `
104
- --experimental-encryption-provider-config=/etc/kubernetes/encryption-config.yaml
107
+
108
+
109
+ ### Update the API server
110
+
111
+ On each of your control plane nodes you need to edit the kube-apiserver, the
112
+ configuration is usually found at
113
+ ` /etc/kubernetes/manifests/kube-apiserver.yaml`. You can just edit it and
114
+ kubernetes will eventually restart the pod with the new configuration.
115
+
116
+ Add the following volumes and volume mounts to the `kube-apiserver.yaml`
117
+ ` ` ` yaml
118
+ spec:
119
+ containers:
120
+ - command:
121
+ - kube-apiserver
122
+ - --encryption-provider-config=/etc/kubernetes/encryption-config.yaml
123
+ ...
124
+ volumeMounts:
125
+ - mountPath: /var/lib/kms/kms.sock
126
+ name: kms-sock
127
+ - mountPath: /etc/kubernetes/encryption.yaml
128
+ name: encryption-config
129
+ readOnly: true
130
+ ...
131
+ volumes:
132
+ - hostPath:
133
+ path: /var/lib/kms/kms.sock
134
+ type: Socket
135
+ name: kms-sock
136
+ - hostPath:
137
+ path: /etc/kubernetes/encryption.yaml
138
+ type: File
139
+ name: encryption-config
140
+ ...
105
141
` ` `
106
142
143
+
107
144
# ## Verify
108
145
[Verify the secret data is encrypted](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/#verifying-that-data-is-encrypted
109
146
)
0 commit comments