Skip to content

Commit e26e538

Browse files
authored
Merge pull request #460 from davidz627/docs/perms
Add required IAM permissions to driver installation guide
2 parents afd7d61 + 552c62d commit e26e538

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

docs/kubernetes/user-guides/driver-install.md

+63-4
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,80 @@
33
## Install Driver
44

55
1. Clone the driver to your local machine
6-
```
6+
7+
```console
78
$ git clone https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver $GOPATH/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
89
```
910

10-
2. [One-time per project] Create GCP service account for the CSI driver and set required roles
11+
2. [One-time per project] Set up or use an existing service account:
12+
13+
The driver requires a service account that has the following permissions and
14+
roles to function properly:
15+
1116
```
17+
compute.instances.get
18+
compute.instances.attachDisk
19+
compute.instances.detachDisk
20+
roles/compute.storageAdmin
21+
roles/iam.serviceAccountUser
22+
```
23+
24+
If there is a pre-existing service account with these roles for use then the
25+
service account key must be downloaded and made discoverable through environment
26+
variable
27+
28+
```
29+
$ gcloud iam service-accounts keys create "/my/safe/credentials/directory/cloud-sa.json" --iam-account "${my-iam-name}" --project "${my-project-name}"
30+
$ GCE_PD_SA_DIR=/my/safe/credentials/directory
31+
```
32+
33+
**Note**: The service account key *must* be named `cloud-sa.json` at driver deploy time
34+
35+
However, if there is no pre-existing service account for use the provided script
36+
can be used to create a new service account with all the required permissions:
37+
38+
```console
1239
$ PROJECT=your-project-here # GCP project
1340
$ GCE_PD_SA_NAME=my-gce-pd-csi-sa # Name of the service account to create
1441
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to save the service account key
1542
$ ./deploy/setup-project.sh
1643
```
1744

45+
**Note**: The PD CSI Driver will be given the identity `my-gce-pd-csi-sa` during
46+
deployment, all actions performed by the driver will be performed as the
47+
specified service account
48+
1849
3. Deploy driver to Kubernetes Cluster
19-
```
50+
51+
```console
2052
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to get the service account key
2153
$ GCE_PD_DRIVER_VERSION=stable # Driver version to deploy
2254
$ ./deploy/kubernetes/deploy-driver.sh
23-
```
55+
```
56+
57+
## GCP Permissions Required
58+
59+
The `setup-project.sh` script only needs to be run once per project to generate
60+
a service account for the driver. The user or service account running this
61+
script needs the following permissions:
62+
63+
```
64+
iam.serviceAccounts.list
65+
iam.serviceAccountKeys.create
66+
iam.roles.create
67+
iam.roles.get
68+
iam.roles.update
69+
```
70+
71+
If a service account provided to `setup-project.sh` does not already exist the
72+
additional permissions are required in order to create the new service account:
73+
74+
```
75+
resourcemanager.projects.getIamPolicy
76+
resourcemanager.projects.setIamPolicy
77+
iam.serviceAccounts.create
78+
iam.serviceAccounts.delete
79+
```
80+
81+
These permissions are not required if you already have a service account ready
82+
for use by the PD Driver.

0 commit comments

Comments
 (0)