Remove–Deployment - anongitmous/k8sShell GitHub Wiki

Remove the Kubernetes deployment resource.

Syntax

Remove-Deployment

-Deployments <Mtf.Kubernetes.Models.V1K8sDeployment[]>
[<K8sShellRemoveParameters>]
[<K8sShellCommonCore>]
[<CommonParameters>]

Description

Removes deployment resource objects from the cluster.

See the example output.

Examples

ℹ️ See A Note about the Examples

1. Delete all deployments from the currently-active namespace

Get-Deployments | Remove-Deployment

  • The results from Get–Deployments are piped into Remove-Deployment
  • If there is no currently active namespace (i.e. namespace is $null or an empty string ''), then this would delete all deployments from all namespaces.

2. Delete all deployments from the 'foo' namespace

Get-Deployments -Namespace 'foo' | Remove-Deployment

3. Delete the deployment named 'my_deployment' in the 'foo' namespace

Get-Deployments -Namespace 'foo' | Where-Object {$_.Name -match 'my_deployment'} | Remove-Deployment

  • To do a trial run, utilize the -DryRun All option:
    Get-Deployments -Namespace 'foo' | Where-Object {$_.Name -match 'my_deployment'} | Remove-Deployment -DryRun All

Parameters

-Deployments

  • Specifies the deployment(s) to delete.
Type: Mtf.Kubernetes.Models.V1K8sDeployment[]
Aliases:
Position: 0
Default value: None
Accept pipeline input: True
Accept wildcard characters: False

See Remove Parameters
See Common Parameters/Non-namespaced Core Context

Inputs

  • Mtf.Kubernetes.Models.V1K8sDeployment[]
    You can pipe a deployment object to this cmdlet.

Outputs

Mtf.Kubernetes.K8sWrapperCommon.K8sObjectDeleterResponse<k8s.Models.V1Deployment>

Example

(the DryRun parameter was used here)
image

Notes

K8sShell includes the following alias for Remove-Deployment:

  • ksrd

This cmdlet does not have a namespace parameter because the service objects processed by it are self-contained in that they carry with them the InvocationConfig active at their creation.

Related