From dcae6eb0a28424e4e420acfa022bbf1d305bf123 Mon Sep 17 00:00:00 2001 From: Sandeep Dinesh Date: Tue, 24 Jul 2018 14:54:12 -0700 Subject: [PATCH] Update gcp-config.md Automated setting environment variables using gcloud commands instead of copy/paste Signed-off-by: Sandeep Dinesh --- docs/gcp-config.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/gcp-config.md b/docs/gcp-config.md index 2cb50d9689..9561010faa 100644 --- a/docs/gcp-config.md +++ b/docs/gcp-config.md @@ -9,10 +9,12 @@ If you do not have the `gcloud` and `gsutil` CLIs locally installed, follow the ## Create GCS bucket -Heptio Ark requires an object storage bucket in which to store backups, preferrably unique to a single Kubernetes cluster (see the [FAQ][20] for more details). Create a GCS bucket, replacing placeholder appropriately: +Heptio Ark requires an object storage bucket in which to store backups, preferrably unique to a single Kubernetes cluster (see the [FAQ][20] for more details). Create a GCS bucket, replacing the placeholder with the name of your bucket: ```bash -gsutil mb gs:/// +BUCKET= + +gsutil mb gs://$BUCKET/ ``` ## Create service account @@ -26,6 +28,10 @@ To integrate Heptio Ark with GCP, create an Ark-specific [Service Account][15]: ``` Store the `project` value from the results in the environment variable `$PROJECT_ID`. + + ```bash + PROJECT_ID=$(gcloud config get-value project) + ``` 2. Create a service account: @@ -42,11 +48,16 @@ To integrate Heptio Ark with GCP, create an Ark-specific [Service Account][15]: ``` Set the `$SERVICE_ACCOUNT_EMAIL` variable to match its `email` value. + + ```bash + SERVICE_ACCOUNT_EMAIL=$(gcloud iam service-accounts list \ + --filter="displayName:Heptio Ark service account" \ + --format 'value(email)') + ``` 3. Attach policies to give `heptio-ark` the necessary permissions to function: ```bash - BUCKET= ROLE_PERMISSIONS=( compute.disks.get @@ -93,10 +104,12 @@ Create a Secret. In the directory of the credentials file you just created, run: ```bash kubectl create secret generic cloud-credentials \ - --namespace \ + --namespace heptio-ark \ --from-file cloud=credentials-ark ``` +_Note: If you use a custom namespace, replace `heptio-ark` with the name of the custom namespace_ + Specify the following values in the example files: * In file `examples/gcp/00-ark-config.yaml`: