-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update examples and documentation #214
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe move/duplicate this note in the "regional PD" section There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I duplicated it because you can use single-zone pds in a regional cluster too |
||
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 | ||
|
||
**Note:** Regional cluster support only available in beta starting with | ||
Kubernetes 1.14. | ||
|
||
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 | ||
``` |
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=alpha # Driver version to deploy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we creating a new "alpha" overlay? Right now I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should update the overlay/docs atomically so we don't have a period of time when docs say to deploy alpha but that doesn't actually do anything There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, i want to create a separate alpha overlay that we can use for another CI test job. I will work on adding one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to just put the overlay back to dev for now. With topology going beta in 1.14, it's only snapshots that is still alpha. |
||
$ ./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 |
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` |
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 |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.5.0 not yet release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I change it to "dev", are we going to remember to change it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not, lets leave it like this