Skip to content
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

Doc about Persistent disk added #446

Closed
wants to merge 7 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions docs/book/src/topics/persistent-disks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Persistent Disks
---

This document describes how persistent disks are to be provisioned and attached to VMs in Google Cloud Platform.

## Storage Disks
---

See [Storage Options](https://cloud.google.com/compute/docs/disks) for more information.

### Disk Types

We can either configure a zonal or regional persistent disk, we can choose following disk types:
- Standard persistent disks (`pd-standard`)
- Balanced persistent disks (`pd-balanced`)
- SSD persistent disks (`pd-ssd`)
- Extreme persistent disks (`pd-extreme`)

If you create a disk in the Cloud Console, the default disk type is `pd-balanced`. If you create a disk using the gcloud tool the default disk type is `pd-standard`.

## Disk Specification
---

- `DISK_NAME`: the name of the new disk
- `DISK_SIZE`: the size, in gigabytes, of the new disk. Acceptable sizes range, in 1 GB increments, from 10 GB to 65,536 GB inclusive.
- `DISK_TYPE`: ull or partial URL for the type of the persistent disk. Example: `https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/diskTypes/pd-ssd`

### Creating disk

```sh
gcloud compute disks create *(DISK_NAME)* \
--size *(DISK_SIZE)* \
--zone *(ZONE)*\
--type *(DISK_TYPE)*
```

### Attaching disk to running or stopped VM instance

```sh
gcloud compute instance attach-disk *(INSTANCE_NAME)* \
--disk *(DISK_NAME)*
```

After this, use `gcloud compute disks describe` to see the description of the disks.

After you create and attach the new disk to a VM, you must format and mount the disk, so that the operating system can use the available storage space.

## Restrictions
---
- You can attach up to 127 secondary non-boot zonal persistent disks.
- You can have a total attached capacity of 257 TB per instance.

## EXAMPLE
---
The below example shows how to create and attach a custom disk "my_disk" at vm-instance-1 for every control plane machine, in addition to the etcd disk. NOTE: the same can be applied to the worker machine.

```yaml
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
[...]
diskSetup:
partitions:
- device: gcloud compute --project \
"project-1" ssh \
--zone us-central-a \
vm-instance-1
type: bq
layout: true
overwrite: false
- device: gcloud compute --project \
sayantani11 marked this conversation as resolved.
Show resolved Hide resolved
"project-1" ssh \
--zone us-central-b \
vm-instance-2
type: bq
layout: true
overwrite: false
filesystems:
- label: etcd_disk
filesystem: ext4
device: gcloud compute --project \
"project-1" ssh \
--zone us-central-b \
vm-instance-2
- label: my_disk
filesystem: ext4
device: gcloud compute --project \
"project-1" ssh \
--zone us-central-a \
vm-instance-1
mounts:
- - LABEL=etcd_disk
- /var/lib/etcddisk
- - LABEL=my_disk
- /var/lib/mydir
---
kind: GCPMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
template:
spec:
[...]
dataDisks:
- nameSuffix: etcddisk
diskSizeGB: 256
- nameSuffix: my_disk
diskSizeGB: 128
```