Linux command
kubectl-set 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Set image
kubectl set image deployment/[name] [container]=[image:tag]
Set environment
kubectl set env deployment/[name] [KEY=value]
Set resources
kubectl set resources deployment/[name] -c [container] --limits=[cpu=200m,memory=512Mi]
Set service account
kubectl set serviceaccount deployment/[name] [sa-name]
Set selector
kubectl set selector service/[name] [app=myapp]
说明
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.
参数
- 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.
FAQ
What is the kubectl-set command used for?
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.
How do I run a basic kubectl-set example?
Run `kubectl set image deployment/[name] [container]=[image:tag]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does image _RESOURCE_ _CONTAINER=IMAGE_ do in kubectl-set?
Update container image.