---
title: "calicoctl delete"
description: "Reference for the calicoctl delete command in Calico Enterprise, used to remove resources by name or from a manifest file."
product: "Calico Enterprise"
version: "3.23 (latest)"
section: "Reference"
canonical_url: "https://docs.tigera.io/calico-enterprise/latest/reference/clis/calicoctl/delete"
---

# calicoctl delete

This sections describes the `calicoctl delete` command.

Read the [calicoctl command line interface user reference](https://docs.tigera.io/calico-enterprise/latest/reference/clis/calicoctl/overview.md) for a full list of calicoctl commands.

> **SECONDARY:** The available actions for a specific resource type may be limited based on the datastore used for Calico Enterprise (Kubernetes API). Please refer to the [Resources section](https://docs.tigera.io/calico-enterprise/latest/reference/resources/overview.md) for details about each resource type.

## Displaying the help text for 'calicoctl delete' command

Run `calicoctl delete --help` to display the following help menu for the command.

```text
Usage:
  calicoctl delete ( (<KIND> [<NAME...>]) |
                   --filename=<FILE>) [--recursive] [--skip-empty]
                   [--skip-not-exists] [--config=<CONFIG>] [--namespace=<NS>]

Examples:
  # Delete a policy using the type and name specified in policy.yaml.
  calicoctl delete -f ./policy.yaml

  # Delete a policy based on the type and name in the YAML passed into stdin.
  cat policy.yaml | calicoctl delete -f -

  # Delete policy with name "foo"
  calicoctl delete policy foo

Options:
  -h --help                 Show this screen.
  -s --skip-not-exists      Skip over and treat as successful, resources that
                            don't exist.
  -f --filename=<FILENAME>  Filename to use to delete the resource.  If set to
                            "-" loads from stdin. If filename is a directory, this command is
                            invoked for each .json .yaml and .yml file within that directory,
                            terminating after the first failure.
  -R --recursive            Process the filename specified in -f or --filename recursively.
     --skip-empty           Do not error if any files or directory specified using -f or --filename contain no
                            data.
  -c --config=<CONFIG>      Path to the file containing connection
                            configuration in YAML or JSON format.
                            [default: /etc/calico/calicoctl.cfg]
  -n --namespace=<NS>       Namespace of the resource.
                            Only applicable to NetworkPolicy, NetworkSet, and WorkloadEndpoint.
                            Uses the default namespace if not specified.
  --context=<context>       The name of the kubeconfig context to use.

Description:
  The delete command is used to delete a set of resources by filename or stdin,
  or by type and identifiers.  JSON and YAML formats are accepted for file and
  stdin format.

  Valid resource types are:

    - bfdconfiguration
    - bgpconfiguration
    - bgpfilter
    - bgppeer
    - clusterinformation
    - egressgatewaypolicy
    - externalnetwork
    - felixconfiguration
    - globalnetworkpolicy
    - globalnetworkset
    - globalthreatfeed
    - hostendpoint
    - ippool
    - ipreservation
    - kubecontrollersconfiguration
    - licensekey
    - networkpolicy
    - networkset
    - node
    - packetcapture
    - profile
    - remoteclusterconfiguration
    - stagedglobalnetworkpolicy
    - stagedkubernetesnetworkpolicy
    - stagednetworkpolicy
    - tier
    - uisettingsgroup
    - workloadendpoint

  The resource type is case-insensitive and may be pluralized.

  Attempting to delete a resource that does not exists is treated as a
  terminating error unless the --skip-not-exists flag is set.  If this flag is
  set, resources that do not exist are skipped.

  When deleting resources by type, only a single type may be specified at a
  time.  The name is required along with any and other identifiers required to
  uniquely identify a resource of the specified type.

  The output of the command indicates how many resources were successfully
  deleted, and the error reason if an error occurred.  If the --skip-not-exists
  flag is set then skipped resources are included in the success count.

  The resources are deleted in the order they are specified.  In the event of a
  failure deleting a specific resource it is possible to work out which
  resource failed based on the number of resources successfully deleted.
```

### Examples

1. Delete a set of resources (of mixed type) using the data in resources.yaml.

   ```bash
   calicoctl delete -f ./resources.yaml
   ```

   Results indicate that 8 resources were successfully deleted.

   ```text
   Successfully deleted 8 resource(s)
   ```

2. Delete a policy resource by name. The policy is called "policy1".

   ```bash
   bin/calicoctl delete policy policy1
   ```

   Results indicate success.

   ```text
   Successfully deleted 1 'policy' resource(s)
   ```

### Options

```text
-s --skip-not-exists      Skip over and treat as successful, resources that
                          don't exist.
-f --filename=<FILENAME>  Filename to use to delete the resource.  If set to
                          "-" loads from stdin.
-n --namespace=<NS>       Namespace of the resource.
                          Only applicable to NetworkPolicy and WorkloadEndpoint.
                          Uses the default namespace if not specified.
```

### General options

```text
-c --config=<CONFIG>      Path to the file containing connection
                          configuration in YAML or JSON format.
                          [default: /etc/calico/calicoctl.cfg]
```

## See also

- [Installing calicoctl](https://docs.tigera.io/calico-enterprise/latest/operations/clis/calicoctl/install.md).
- [Resources](https://docs.tigera.io/calico-enterprise/latest/reference/resources/overview.md) for details on all valid resources, including file format and schema
- [NetworkPolicy](https://docs.tigera.io/calico-enterprise/latest/reference/resources/networkpolicy.md) for details on the Calico Enterprise selector-based policy model
