Release Notes
Announcements
Release Notes

_, -, and cannot begin with KMS-. In this document, we take tke-kms as an example. 
SecretId and SecretKey. If you already have them, skip this procedure.SecretId/SecretKey.SecretId and SecretKey on Manage API Key page when the creation is completed. See the figure below:

tke-kms-plugin.yaml, as shown below:{{REGION}}: the region where KMS key resides. You can check Region List for the valid values. {{KEY_ID}}: enter the KMS key ID obtained in the step of creating a KMS key and obtaining the ID. {{SECRET_ID}} and {{SECRET_KEY}}: enter the SecretID and SecretKey created in the step of creating and obtaining access key. images: ccr.ccs.tencentyun.com/tke-plugin/tke-kms-plugin:1.0.0: tke-kms-plugin image address. If you want to use the self-created tke-kms-plugin image, you can replace it.apiVersion: apps/v1kind: DaemonSetmetadata:name: tke-kms-pluginnamespace: kube-systemspec:selector:matchLabels:name: tke-kms-plugintemplate:metadata:labels:name: tke-kms-pluginspec:nodeSelector:node-role.kubernetes.io/master: "true"hostNetwork: truerestartPolicy: Alwaysvolumes:- name: tke-kms-plugin-dirhostPath:path: /var/run/tke-kms-plugintype: DirectoryOrCreatetolerations:- key: node-role.kubernetes.io/mastereffect: NoSchedulecontainers:- name: tke-kms-pluginimage: ccr.ccs.tencentyun.com/tke-plugin/tke-kms-plugin:1.0.0command:- /tke-kms-plugin- --region={{REGION}}- --key-id={{KEY_ID}}- --unix-socket=/var/run/tke-kms-plugin/server.sock- --v=2livenessProbe:exec:command:- /tke-kms-plugin- health-check- --unix-socket=/var/run/tke-kms-plugin/server.sockinitialDelaySeconds: 5failureThreshold: 3timeoutSeconds: 5periodSeconds: 30env:- name: SECRET_IDvalue: {{SECRET_ID}}- name: SECRET_KEYvalue: {{SECRET_KEY}}volumeMounts:- name: tke-kms-plugin-dirmountPath: /var/run/tke-kms-pluginreadOnly: false
vim /etc/kubernetes/encryption-provider-config.yaml
apiVersion: apiserver.config.k8s.io/v1kind: EncryptionConfigurationresources:- resources:- secretsproviders:- kms:name: tke-kms-plugintimeout: 3scachesize: 1000endpoint: unix:///var/run/tke-kms-plugin/server.sock- identity: {}
apiVersion: v1kind: EncryptionConfigresources:- resources:- secretsproviders:- kms:name: tke-kms-plugintimeout: 3scachesize: 1000endpoint: unix:///var/run/tke-kms-plugin/server.sock- identity: {}
vi /etc/kubernetes/manifests/kube-apiserver.yaml
args according to the K8s version you actually use. kube-apiserver.yaml from the /etc/kubernetes/manifests directory and move it back to the directory after you have completed the editing. --encryption-provider-config=/etc/kubernetes/encryption-provider-config.yaml
--experimental-encryption-provider-config=/etc/kubernetes/encryption-provider-config.yaml
/var/run/tke-kms-plugin/server.sock. The location and content for adding is as follows:/var/run/tke-kms-plugin/server.sock is a unix socket that is listened when tke kms server is launched. kube apiserver will access tke kms server by accessing the socket. volumeMounts::- mountPath: /var/run/tke-kms-pluginname: tke-kms-plugin-dir
volume::- hostPath:path: /var/run/tke-kms-pluginname: tke-kms-plugin-dir
/etc/kubernetes/manifests/kube-apiserver.yaml file. Wait for kube-apiserver to restart.kubectl create secret generic kms-secret -n default --from-literal=mykey=mydata
kubectl get secret kms-secret -o=jsonpath='{.data.mykey}' | base64 -d
mydata, i.e. it is equal to the value of Secret, it means Secret has been decrypted correctly. See the figure below:

Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan