如何使用 'kubectl run' 命令创建 Kubernetes Deployment?

How to create a Kubernetes Deployment with the 'kubectl run' command?

根据我阅读的 article,在使用“kubectl 运行”命令时,

但是,当我在我的 Minikube 安装上尝试这样做时,它正在创建一种资源:Pod

k run ngingx --image=nginx -o yaml --dry-run=client --restart Always
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: ngingx
  name: ngingx
spec:
  containers:
  - image: nginx
    name: ngingx
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}

该功能是否已被弃用,还是我做错了什么?

谢谢

应该是这样的

kubectl create deployment ngingx --image=nginx -o yaml --dry-run=client

不,restart: Always 不会创建 pod 或 deplyoment,它是关于容器重启策略的,如果 pod 崩溃它会尝试重启容器。