LinuxCommandLibrary

kubectl-set

updates resource fields

TLDR

Set image

$ kubectl set image deployment/[name] [container]=[image:tag]
copy
Set environment
$ kubectl set env deployment/[name] [KEY=value]
copy
Set resources
$ kubectl set resources deployment/[name] -c [container] --limits=[cpu=200m,memory=512Mi]
copy
Set service account
$ kubectl set serviceaccount deployment/[name] [sa-name]
copy
Set selector
$ kubectl set selector service/[name] [app=myapp]
copy

SYNOPSIS

kubectl set command [options]

DESCRIPTION

kubectl set updates resource fields. It modifies specific aspects of running workloads.
The command is faster than full apply for targeted changes. It triggers rollouts for deployments.

PARAMETERS

image RESOURCE CONTAINER=IMAGE

Update container image.
env RESOURCE VAR=VALUE
Set environment variables.
resources RESOURCE
Set resource limits.
serviceaccount RESOURCE SA
Set service account.
selector RESOURCE LABELS
Set selector.
--help
Display help information.

CAVEATS

Subcommand of kubectl. Triggers rollout. Consider apply for declarative management.

HISTORY

kubectl set provides targeted resource updates for Kubernetes operational tasks.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community