Updated on 2025-04-03 GMT+08:00

ccictl set resources

Scenario

Specify compute resource requirements (vCPU and memory) for any resource that defines a pod template. If a pod is successfully scheduled, the resource requests are guaranteed, but it may burst up to the specified limits.

For each type of compute resource, if only the limit is specified and the request is omitted, the request will default to the limit.

Possible resources include (case insensitive): Run ccictl api-resources to view a complete list of supported resources.

ccictl set resources (-f FILENAME | TYPE NAME)  ([--limits=LIMITS & --requests=REQUESTS]

Examples

# Set the container vCPU limit of the nginx Deployment to "200m" and memory limit to "512Mi".
ccictl set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi

# Set the resource requests and limits for all containers in the nginx Deployment.
ccictl set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi

# Remove the requests for resources on containers in the nginx Deployment.
ccictl set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0

# Print the result (in YAML format) of updating the container restrictions based on the local list. No request is sent to the server.
ccictl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml

Options

--all

If the value is true, all resources in the namespace of the specified resource type are selected.

--allow-missing-template-keys     Default: true

If the value is true, the error in the template is ignored when a field or mapping key is missing in the template. This option applies only to the Golang and JSONPath output formats.

-c, --containers string     Default: "*"

Names of the containers to be changed in the selected pod template. Wildcard characters can be used.

-f, --filename strings

List of file names, directories, or file URLs, which are used to identify the resources whose environments are to be updated.

-h, --help

Help information for set resources

--limits string

Resource limits of a specified container, for example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.

--local

If the value is true, set image will not communicate with the API server and will run locally.

-o, --output string

Output format. The value options include json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, and jsonpath-file.

-R, --recursive

Process the directory used in -f or --filename recursively. This option is useful when you want to manage related manifests organized within the same directory.

--requests string

Resource requests of a specified container, for example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges.

-l, --selector string

Selector used for filtering (label query). The value can be =, ==, or !=, for example, -l key1=value1,key2=value2. Matched objects must meet all specified label constraints.

--template string

Template character string or template file path used when -o is set to go-template or go-template-file. The Golang template format is [http://golang.org/pkg/text/template/#pkg-overview].

The following ccictl options can also be used in subcommands:

Parent command options