Remove–K8sJob - anongitmous/k8sShell GitHub Wiki
Remove Kubernetes job resources.
Syntax
Remove-K8sJob
-Jobs <Mtf.Kubernetes.Models.V1K8sJob[]>
[<K8sShellRemoveParameters>]
[<K8sShellCommonCore>]
[<CommonParameters>]
Description
Removes job resource objects from the cluster.
See the example output.
Examples
ℹ️ See A Note about the Examples
1. Delete all jobs from the currently-active namespace
Get-K8sJobs | Remove-K8sJob
- The results from Get–K8sJobs are piped into Remove-K8sJob
- If there is no currently active namespace (i.e. namespace is
$nullor an empty string''), then this would delete all jobs from all namespaces.
2. Delete all jobs from the 'foo' namespace
Get-K8sJobs -Namespace 'foo' | Remove-K8sJob
3. Delete the job named 'my_job' in the 'foo' namespace
Get-K8sJob -Namespace 'foo' | Where-Object {$_.Name -match 'my_job'} | Remove-K8sJob
- To do a trial run, utilize the
-DryRun Alloption:
Get-K8sJob -Namespace 'foo' | Where-Object {$_.Name -match 'my_job'} | Remove-K8sJob -DryRun All
Parameters
-Jobs
- Specifies the job(s) to delete.
| Type: | Mtf.Kubernetes.Models.V1K8sJob[] |
| 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.V1K8sJob[]
You can pipe a job object to this cmdlet.
Outputs
Mtf.Kubernetes.K8sWrapperCommon.K8sObjectDeleterResponse<k8s.Models.V1Job>>
Example
(the DryRun parameter was used here)
Notes
K8sShell includes the following alias for Remove-K8sJob:
- ksrj
📝 Due to a conflict with Microsoft's built-in 'Get-Job' cmdlet, this cmdlet's name was changed to 'Remove-K8sJob' to be consistent with Get–K8sJobs.
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.