Remove–Endpoint - anongitmous/k8sShell GitHub Wiki

Remove the Kubernetes endpoint resource(s).

Syntax

Remove-Endpoint

-Endpoints <Mtf.Kubernetes.Models.V1K8sEndpoint[]>
[<K8sShellRemoveParameters>]
[<K8sShellCommonCore>]
[<CommonParameters>]

Description

Removes endpoint resource objects from the cluster.

See the example output.

Examples

ℹ️ See A Note about the Examples

1. Delete all endpoints from the currently-active namespace

Get-Endpoints | Remove-Endpoint

  • The results from Get–Endpoints are piped into Remove-Endpoint
  • If there is no currently active namespace (i.e. namespace is $null or an empty string ''), then this would delete all endpoints from all namespaces.
  • Using aliasing, the above can be shortened to
    ksgep | ksre

2. Delete all endpoints from the 'foo' namespace

Get-Endpoints -Namespace 'foo' | Remove-Endpoint

  • Using aliasing, the above can be shortened to
    ksgep -ns 'foo' | ksre

3. Delete the enpoint named 'my_endpoint' in the 'foo' namespace

Get-Endpoints -Namespace 'foo' | Where-Object {$_.Name -match 'my_endpoint'} | Remove-Endpoint

  • To do a trial run, utilize the -DryRun All option:
    Get-Endpoints -Namespace 'foo' | Where-Object {$_.Name -match 'my_endpoint'} | Remove-Endpoint -DryRun All
  • Using aliasing, the above can be shortened to
    ksgep -ns 'foo' | ? {$_.Name -match 'my_endpoint'} | ksre -DryRun All

Parameters

-Endpoints

  • Specifies the endpoints(s) to delete.
Type: Mtf.Kubernetes.Models.V1K8sEndpoint[]
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.V1K8sEndpoint
    You can pipe endpoint object(s) to this cmdlet.

Outputs

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

Example

(the DryRun parameter was used here)
image

Notes

K8sShell includes the following alias for Remove-Endpoint:

  • ksre

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