# Generating the Data Encryption Config and Key Kubernetes stores a variety of data including cluster state, application configurations, and secrets. Kubernetes supports the ability to [encrypt](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data) cluster data at rest. In this lab you will generate an encryption key and an [encryption config](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/#understanding-the-encryption-at-rest-configuration) suitable for encrypting Kubernetes Secrets. ## The Encryption Key Generate an encryption key: #### Linux & OS X ``` ENCRYPTION_KEY=$(head -c 32 /dev/urandom | base64) ``` #### Windows ``` $ENCRYPTION_KEY=[System.Convert]::ToBase64String($(0..31 | ForEach-Object { Get-Random -Minimum 0 -Maximum 255 } )) ``` ## The Encryption Config File Create the `encryption-config.yaml` encryption config file: #### Linux & OS X ``` cat > encryption-config.yaml <