Anthos clusters on VMware (GKE on-prem) version 1.9 supports encrypting secrets without the need for an external KMS (Key Management Service), or any other dependencies.
Enable always-on secrets encryption
Always-on secrets encryption works by automatically generating an encryption key that is used to encrypt secrets before they are stored on the etcd database for that cluster.
The key version is a version number to indicate the key currently in use.
You can enable secrets encryption after a cluster has already been created.
For the admin cluster:
Edit the admin cluster configuration file to add the
gkectl update admin --config ADMIN_CLUSTER_CONFIG_FILE --kubeconfig ADMIN_CLUSTER_KUBECONFIG
For a user cluster:
Edit the user cluster configuration file to add the
gkectl update cluster --config USER_CONFIG_FILE --kubeconfig ADMIN_CLUSTER_KUBECONFIG
Replace the following:
ADMIN_KUBECONFIGwith the path of your admin cluster kubeconfig file.
ADMIN_CLUSTER_CONFIGwith the path of your admin cluster configuration file.
USER_CLUSTER_CONFIGwith the path of your user cluster configuration file.
gkectl update commands provided in this section can also be used for any other updates to the corresponding cluster.
The encryption keys for the admin cluster are stored on the admin cluster data disk. This disk is mounted on the admin master machine at
/opt/data, and the encryption keys can be found at
/opt/data/gke-k8s-kms-plugin/generatedkeys/. These keys must be backed up to retain access to the encrypted secrets used by that key.
To rotate an existing encryption key for a cluster, increment the
keyVersion in the corresponding admin cluster configuration file or user cluster configuration file, and run the appropriate
gkectl update command. This creates a new key matching the new version number, re-encrypts each secret, and securely erases the old one. All subsequent new secrets are encrypted using the new encryption key.
Disable always-on secrets encryption
To disable secrets encryption on an existing cluster, remove the
keyVersion field and add a
disabled: true field. Next, run the corresponding
gkectl update command. This update decrypts each existing secret and stores each secret in plain text. All subsequent new secrets are stored in plain text.
secretsEncryption: mode: GeneratedKey generatedKey: disabled: true