Updated mnist example README with AWS credentials setting

This commit is contained in:
Oleg Shepetyuk 2019-01-25 17:26:56 +02:00
parent f85a8e970f
commit ea86a41172
1 changed files with 28 additions and 25 deletions

View File

@ -354,47 +354,50 @@ various environment variables configuring access to S3.
--from-literal=awsSecretAccessKey=${AWS_SECRET_ACCESS_KEY}
```
1. Mount the secret into the pod
1. Pass secrets as environment variables into pod
```
ks param set --env=${KSENV} train secret aws-creds=/var/secrets
ks param set --env=${KSENV} train secretKeyRefs AWS_ACCESS_KEY_ID=aws-creds.awsAccessKeyID,AWS_SECRET_ACCESS_KEY=aws-creds.awsSecretAccessKey
```
* Setting this ksonnet parameter causes a volumeMount and volume to be added to your TFJob
* Setting this ksonnet parameter causes a two new environment variables to be added to your TFJob
* To see this you can run
```
ks show ${KSENV} -c train
```
* The output should now include a volumeMount and volume section
* The output should now include two environment variables referencing K8s secret
```
apiVersion: kubeflow.org/v1beta1
kind: TFJob
metadata:
...
spec:
tfReplicaSpecs:
Chief:
...
template:
apiVersion: kubeflow.org/v1beta1
kind: TFJob
metadata:
...
spec:
containers:
- command:
tfReplicaSpecs:
Chief:
...
volumeMounts:
- mountPath: /var/secrets
name: aws-creds
readOnly: true
template:
...
volumes:
- name: aws-creds
secret:
secretName: aws-creds
...
```
spec:
containers:
- command:
...
env:
...
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: awsAccessKeyID
name: aws-creds
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: awsSecretAccessKey
name: aws-creds
...
```
1. Next we need to set a whole bunch of S3 related environment variables so that TensorFlow
knows how to talk to S3