mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 01:08:58 +03:00
adding commands/scripts for windows
Signed-off-by: Mike Stevenson <Mike.Stevenson@us.logicalis.com>
This commit is contained in:
@@ -8,14 +8,21 @@ In this lab you will generate an encryption key and an [encryption config](https
|
||||
|
||||
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 <<EOF
|
||||
kind: EncryptionConfig
|
||||
@@ -32,12 +39,37 @@ resources:
|
||||
EOF
|
||||
```
|
||||
|
||||
#### Windows
|
||||
```
|
||||
New-Item encryption-config.yaml -Value @"
|
||||
kind: EncryptionConfig
|
||||
apiVersion: v1
|
||||
resources:
|
||||
- resources:
|
||||
- secrets
|
||||
providers:
|
||||
- aescbc:
|
||||
keys:
|
||||
- name: key1
|
||||
secret: ${ENCRYPTION_KEY}
|
||||
- identity: {}
|
||||
"@
|
||||
```
|
||||
|
||||
Copy the `encryption-config.yaml` encryption config file to each controller instance:
|
||||
|
||||
#### Linux & OS X
|
||||
```
|
||||
for instance in controller-0 controller-1 controller-2; do
|
||||
gcloud compute scp encryption-config.yaml ${instance}:~/
|
||||
done
|
||||
```
|
||||
|
||||
#### Windows
|
||||
```
|
||||
@('controller-0','controller-1','controller-2') | ForEach-Object {
|
||||
gcloud compute scp encryption-config.yaml ${_}:/home/$env:USERNAME/
|
||||
}
|
||||
```
|
||||
|
||||
Next: [Bootstrapping the etcd Cluster](07-bootstrapping-etcd.md)
|
||||
|
||||
Reference in New Issue
Block a user