-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
225 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Kubernetes Development | ||
|
||
## Manual | ||
|
||
To build and install a development version of the driver: | ||
``` | ||
$ GCE_PD_CSI_STAGING_IMAGE=gcr.io/path/to/driver/image:dev # Location to push dev image to | ||
$ make push-container | ||
# Modify controller.yaml and node.yaml in ./deploy/kubernetes/dev to use dev image | ||
$ GCE_PD_DRIVER_VERSION=dev | ||
$ ./deploy/kubernetes/deploy-driver.sh | ||
``` | ||
|
||
To bring down driver: | ||
``` | ||
$ ./deploy/kubernetes/delete-driver.sh | ||
``` | ||
|
||
## TODO Testing | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Kubernetes Basic User Guide | ||
This guide gives a simple example on how to provision zonal and regional PDs in single-zone and regional clusters. | ||
|
||
**Note:** Regional cluster support only available in beta starting with | ||
Kubernetes 1.14. | ||
|
||
## Install Driver | ||
|
||
1. [One-time per project] Create GCP service account for the CSI driver and set required roles | ||
``` | ||
$ PROJECT=your-project-here # GCP project | ||
$ GCE_PD_SA_NAME=my-gce-pd-csi-sa # Name of the service account to create | ||
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to save the service account key | ||
$ ./deploy/setup-project.sh | ||
``` | ||
|
||
2. Deploy driver to Kubernetes Cluster | ||
``` | ||
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to get the service account key | ||
$ GCE_PD_DRIVER_VERSION=stable # Driver version to deploy | ||
$ ./deploy/kubernetes/deploy-driver.sh | ||
``` | ||
|
||
## Zonal PD example | ||
This example provisions a zonal PD in both single-zone and regional clusters. | ||
|
||
1. Create example Zonal Storage Class | ||
``` | ||
$ kubectl apply -f ./examples/kubernetes/demo-zonal-sc.yaml | ||
``` | ||
|
||
2. Create example PVC and Pod | ||
``` | ||
$ kubectl apply -f ./examples/kubernetes/demo-pod.yaml | ||
``` | ||
|
||
3. Verify PV is created and bound to PVC | ||
``` | ||
$ kubectl get pvc | ||
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE | ||
podpvc Bound pvc-e36abf50-84f3-11e8-8538-42010a800002 10Gi RWO csi-gce-pd 9s | ||
``` | ||
|
||
4. Verify pod is created and in `RUNNING` state (it may take a few minutes to get to running state) | ||
``` | ||
$ kubectl get pods | ||
NAME READY STATUS RESTARTS AGE | ||
web-server 1/1 Running 0 1m | ||
``` | ||
|
||
## Regional PD example | ||
This example provisions a regional PD in regional clusters. | ||
|
||
1. Create example Regional Storage Class. Choose between: | ||
|
||
* Unrestricted zones | ||
``` | ||
$ kubectl apply -f ./examples/kubernetes/demo-regional-sc.yaml | ||
``` | ||
* Restricted zones | ||
``` | ||
$ kubectl apply -f ./examples/kubernetes/demo-regional-restricted-sc.yaml | ||
``` | ||
2. Create example PVC and Pod | ||
``` | ||
$ kubectl apply -f ./examples/kubernetes/demo-pod.yaml | ||
``` | ||
3. Verify PV is created and bound to PVC | ||
``` | ||
$ kubectl get pvc | ||
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE | ||
podpvc Bound pvc-e36abf50-84f3-11e8-8538-42010a800002 10Gi RWO csi-gce-pd 9s | ||
``` | ||
4. Verify pod is created and in `RUNNING` state (it may take a few minutes to get to running state) | ||
``` | ||
$ kubectl get pods | ||
NAME READY STATUS RESTARTS AGE | ||
web-server 1/1 Running 0 1m | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Kubernetes Snapshots User Guide (Alpha) | ||
|
||
### Install Driver with alpha snapshot feature | ||
|
||
1. [One-time per project] Create GCP service account for the CSI driver and set required roles | ||
``` | ||
$ PROJECT=your-project-here # GCP project | ||
$ GCE_PD_SA_NAME=my-gce-pd-csi-sa # Name of the service account to create | ||
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to save the service account key | ||
$ ./deploy/setup-project.sh | ||
``` | ||
|
||
2. Deploy driver to Kubernetes Cluster | ||
``` | ||
$ GCE_PD_SA_DIR=/my/safe/credentials/directory # Directory to get the service account key | ||
$ GCE_PD_DRIVER_VERSION=dev # Driver version to deploy | ||
$ ./deploy/kubernetes/deploy-driver.sh | ||
``` | ||
|
||
### Snapshot Example | ||
|
||
1. Create example Default Snapshot Class | ||
``` | ||
$ kubectl create -f ./examples/kubernetes/demo-defaultsnapshotclass.yaml | ||
``` | ||
2. Create a snapshot of the PVC created in above example | ||
``` | ||
$ kubectl create -f ./examples/kubernetes/demo-snapshot.yaml | ||
``` | ||
3. Verify Snapshot is created and is ready to use | ||
``` | ||
$ k get volumesnapshots demo-snapshot-podpvc -o yaml | ||
apiVersion: snapshot.storage.k8s.io/v1alpha1 | ||
kind: VolumeSnapshot | ||
metadata: | ||
creationTimestamp: 2018-10-05T16:59:26Z | ||
generation: 1 | ||
name: demo-snapshot-podpvc | ||
namespace: default | ||
... | ||
status: | ||
creationTime: 2018-10-05T16:59:27Z | ||
ready: true | ||
restoreSize: 6Gi | ||
``` | ||
4. Create a new volume from the snapshot | ||
``` | ||
$ kubectl create -f ./examples/kubernetes/demo-restore-snapshot.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Local development | ||
This page contains information on how to develop and test the driver locally. | ||
|
||
## Testing | ||
|
||
Running E2E Tests: | ||
``` | ||
$ PROJECT=my-project # GCP Project to run tests in | ||
$ IAM_NAME=my-iam@project.iam.gserviceaccount.com # Existing IAM Account with GCE PD CSI Driver Permissions | ||
$ ./test/run-e2e-local.sh | ||
``` | ||
|
||
Running Sanity Tests: | ||
``` | ||
$ ./test/run-sanity.sh | ||
``` | ||
|
||
Running Unit Tests: | ||
``` | ||
$ ./test/run-unit.sh | ||
``` | ||
|
||
## Dependency Management | ||
|
||
Use [dep](https://github.com/golang/dep) | ||
``` | ||
$ dep ensure | ||
``` | ||
|
||
To modify dependencies or versions change `./Gopkg.toml` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: csi-gce-pd | ||
provisioner: pd.csi.storage.gke.io | ||
parameters: | ||
type: pd-standard | ||
replication-type: regional-pd | ||
volumeBindingMode: WaitForFirstConsumer | ||
allowedTopologies: | ||
- matchLabelExpressions: | ||
- key: topology.gke.io/zone | ||
values: | ||
- us-central1-a | ||
- us-central1-b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
apiVersion: storage.k8s.io/v1beta1 | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: csi-gce-pd | ||
provisioner: pd.csi.storage.gke.io | ||
parameters: | ||
type: pd-standard | ||
replication-type: regional-pd | ||
volumeBindingMode: Immediate | ||
volumeBindingMode: WaitForFirstConsumer |
Oops, something went wrong.