Calico Open Source 3.33 (latest) documentation
calicoctl delete
This sections describes the calicoctl delete command.
Read the calicoctl command line interface user reference for a full list of calicoctl commands.
note
The available actions for a specific resource type may be limited based on the datastore used for Calico (etcdv3 / Kubernetes API). Please refer to the Resources section 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.
Delete one or more Calico resources, either by type and name or from a file,
directory, or stdin. Deleting a resource that doesn't exist is treated as an
error unless --skip-not-exists is set.
Usage:
calicoctl delete [KIND [NAME...]] [flags]
Examples:
# Delete specific policies by name.
calicoctl delete networkpolicy foo bar
# Delete the resources described in a file.
calicoctl delete -f ./policy.yaml
Flags:
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
-f, --filename string Filename to use to create/apply/replace/delete the resource. Use '-' for stdin.
-h, --help help for delete
-n, --namespace string Namespace of the resource.
-R, --recursive Process the filename specified in -f recursively.
--skip-empty Do not error if files contain no data.
-s, --skip-not-exists Skip over resources that do not exist.
Global Flags:
--allow-version-mismatch Allow client and cluster versions mismatch
--context string The name of the kubeconfig context to use
-l, --log-level string Set the log level (panic, fatal, error, warn, info, debug) (default "panic")
Examples
-
Delete a set of resources (of mixed type) using the data in resources.yaml.
calicoctl delete -f ./resources.yamlResults indicate that 8 resources were successfully deleted.
Successfully deleted 8 resource(s) -
Delete a policy resource by name. The policy is called "policy1".
bin/calicoctl delete policy policy1Results indicate success.
Successfully deleted 1 'policy' resource(s)
Options
-s, --skip-not-exists Skip over resources that do not exist.
-f, --filename string Filename to use to create/apply/replace/delete the resource. Use '-' for stdin.
-n, --namespace string Namespace of the resource.
General options
-c, --config string Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
See also
- Installing calicoctl.
- Resources for details on all valid resources, including file format and schema
- NetworkPolicy for details on the Calico selector-based policy model