| 用途 | 命令式创建 / 生成清单初稿 |
|---|---|
| 语法 | kubectl create <资源> <参数> |
常用示例
常用示例
kubectl create deployment web --image=nginx:1.25 --replicas=3 --dry-run=client -o yaml > web.yaml
kubectl create namespace test
kubectl create configmap app-config --from-literal=LOG_LEVEL=info --from-file=app.conf
kubectl create secret generic db-pass --from-literal=password=ChangeMe123create 是「只创建」语义,资源已存在会报 AlreadyExists;可重复执行用 apply -f。