text stringlengths 0 59.1k |
|---|
apiVersion: v1 |
metadata: |
name: pod-uses-managed-ssd-5g |
labels: |
name: storage |
spec: |
containers: |
- image: nginx |
name: az-c-01 |
command: |
- /bin/sh |
- -c |
- while true; do echo $(date) >> /mnt/managed/outfile; sleep 1; done |
volumeMounts: |
- name: managed01 |
mountPath: /mnt/managed |
volumes: |
- name: managed01 |
azureDisk: |
kind: Managed |
diskName: myDisk |
diskURI: /subscriptions/<subscriptionID>/resourceGroups/<resourceGroup>/providers/Microsoft.Compute/disks/<diskName> |
<|endoftext|> |
# source: k8s_examples/_archived/volumes/azure_disk/claim/README.md type: docs |
# Kubernetes Persistent Volume Plugin For Blob and Managed Disks Samples |
This repo contains samples that works with the new Azure persistent volume plugin for Kubernetes. The plugin is expected to be in v1.7.2 release then will become part of Azure ACS |
## What does the plugin do? |
1. Provision PVC based on Azure Managed Disks and Blob Disks |
2. Perform consistent attach/detach/mount/unmount and format when needed for disks |
3. Supports both standard and premium LRS storage accounts. |
## Get Started |
### Using the Samples |
The sequence of events is generally |
1. Create a storage class |
2. Create a PVC |
3. Create a pod or a replication controller that uses the PVC |
``` |
# you can use the following command to create a storage class first |
kubectl create -f storageclass-managed-hdd.yaml |
# you can use the following command to create a pvc, which will create an azure disk |
kubectl create -f pvc-on-managed-hdd.yaml |
# You can get more details about the created PVC by |
kubectl describe pvc {pvc-name} |
# you can use the following command to create a pod with specified pvc |
kubectl create -f pod-uses-managed-hdd.yaml |
``` |
To verify, inside of the pod/container, you should see something like this: |
``` |
$ df -h |
/dev/sdc 125.9G 59.6M 119.4G 0% /mnt/managed |
``` |
## How does it work? |
### Managed Disks |
The entire experience is offloaded to Azure to manage disks:storage accounts. You can use PVC (Kubernetes will automatically create a managed disk for you). Or you can use an existing disk as PV in your PODs/RCs |
> Note: as a general rule, use PV disks provisioned in the same Azure resource group where the cluster is provisioned. |
### Blob Disks |
Blob Disks works in two modes. Controlled by *kind* parameter on the storage class. |
### Dedicated (default mode) |
When *kind* parameter is set to *dedicated* K8S will create a new dedicated storage account for this new disk. No other disks will be allowed in the this storage account. The account will be removed when the PVC is removed (according to K8S PVC reclaim policy) |
> Note: You can still use existing VHDs, again the general rule apply use storage accounts that are part of cluster resource group |
### The following storage parameter can be used to control the behaviour |
1. *skuname* or *storageaccounttype* to choose the underlying Azure storage account (default is *Standard_LRS* allowed values are *Standard_LRS* and *Premium_LRS*) |
2. *cachingmode* controls Azure caching mode when the disk is attached to a VM (default is *readwrite* allowed values are *none*, *readwrite* and *readonly* |
3. *kind* decides on disk kind (default is *shared* allowed values are *shared*, *dedicated* and *managed*) |
4. *fstype* the file system of this disk (default *ext4*) |
### Shared |
PVC: VHDs are created in a shared storage accounts in the same resource group as the cluster as the following |
``` |
Resource Group |
--Storage Account: pvc{unique-hash}001 // created by K8S as it provisioned PVC, all disks are placed in the same blob container |
---pvc-xxx-xxx-xxxx.vhd |
---pvc-xxx-xxx-xxxx.vhd |
--Storage Account: pvc{unique-hash}002..n |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.