Cns Category | Vmware PowerCLI Reference

Cns Category

Cmdlets are usually implemented around resource operations. The four basic operations are CREATE, READ, UPDATE and DELETE. This set of operations is known as CRUD. Most of the cmdlets support CRUD which are respectively cmdlets that start with the New/Get/Set/Remove cmdlet verbs but they also may have additional operations

Step 1: Retrieve a object by running a Get command

You can READ objects by using Get-CnsVolume cmdlet. See example below:

# Retrieves the vSAN file share which belongs to the $fileServiceDomain file service domain.

Get-CnsVolume -FileServiceDomain $fileServiceDomain

Step 2 : Run commands from the CRUD group

You can CREATE objects by using New-CnsContainerCluster cmdlet. See example below:

# Creates a Cloud Native Storage (CNS) container cluster with Vanilla as a cluster flavor, 'k8_cls_1' as a cluster ID, Kubernetes as a cluster type, and '[email protected]' as a vSphere user.

New-CnsContainerCluster -ClusterFlavor Vanilla -KubernetesClusterId 'k8_cls_1' -ClusterType Kubernetes -VSphereUser '[email protected]'
You can UPDATE objects by using Set-CnsVolume cmdlet. See example below:

# Updates the $cnsVolumeMetadata CNS volume metadata to the $cnsVolume CNS volume.

Set-CnsVolume -CnsVolume $cnsVolume -CnsVolumeMetadata $cnsVolumeMetadata
You can REMOVE objects by using Remove-CnsVolume cmdlet. See example below:

# Removes the $CnsVolume CNS volume without asking for confirmation.

Remove-CnsVolume -CnsVolume $CnsVolume -Confirm:$false

Step 3: Explore More Related Commands:


New-CnsKubernetesEntityMetadata This cmdlet creates a Cloud Native Storage (CNS) Kubernetes entity metadata at a client side.
New-CnsKubernetesEntityReference This cmdlet creates a Cloud Native Storage (CNS) Kubernetes entity reference at the client side.
New-CnsVolume This cmdlet creates a Cloud Native Storage (CNS) volume.
New-CnsVolumeAttachment New-CnsVolumeAttachment -CnsVolume <CnsVolume> -VM <VirtualMachine> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]
New-CnsVolumeMetadata This cmdlet creates a Cloud Native Storage (CNS) volume metadata at the client side.
Remove-CnsVolumeAttachment Remove-CnsVolumeAttachment -CnsVolume <CnsVolume> -VM <VirtualMachine> [-Server <VIServer[]>] [-RunAsync] [-WhatIf] [-Confirm] [<CommonParameters>]