Karthik Rao V
Karthik Rao V

Reputation: 61

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

As per an article I read, while using the 'kubectl run' command,

However, when I try that on my Minikube installation it is creating a resource of kind: 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: {}

Has the feature been deprecated or am I doing something wrong ?

Thank You

Upvotes: 2

Views: 2441

Answers (1)

Dashrath Mundkar
Dashrath Mundkar

Reputation: 9174

it should be like this

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

Nope the restart: Always does not create pod or deplyoment it's about the container restart policy which is used for restarting container if pod crashes it tries restart.

Upvotes: 1

Related Questions