Calico Open Source 3.33 (latest) documentation
calicoctl create
This sections describes the calicoctl create 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 create' command
Run calicoctl create --help to display the following help menu for the
command.
Create one or more Calico resources from a file, directory, or stdin, in YAML
or JSON format. Use create when you want the command to fail if a resource
already exists; use apply if you'd rather create-or-update.
Usage:
calicoctl create [flags]
Examples:
# Create resources from a file.
calicoctl create -f ./policy.yaml
# Create resources from stdin.
cat policy.json | calicoctl create -f -
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 create
-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.
--skip-exists Skip over resources that already 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
-
Create a set of resources (of mixed type) using the data in resources.yaml.
calicoctl create -f ./resources.yamlResults indicate that 8 resources were successfully created.
Successfully created 8 resource(s) -
Create the same set of resources reading from stdin.
cat resources.yaml | calicoctl create -f -Results indicate failure because the first resource (in this case a Profile) already exists.
Failed to create any resources: resource already exists: Profile(name=profile1)
Options
-f, --filename string Filename to use to create/apply/replace/delete the resource. Use '-' for stdin.
--skip-exists Skip over resources that already exist.
-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