<p>I am using below command to create my pod</p>
<pre><code>kubectl run pingpong --image alpine ping 1.1.1.1
</code></pre>
<p>This command works good, but doesn't create replicaset.</p>
<p>How can I create a replicaset with this command too? I tried below</p>
<pre><code>kubectl create deployment pingpong --image alpine ping 1.1.1.1 
</code></pre>
<p>but it doesn't work.</p>

<p>From kubernetes version 1.18 <code>kubectl run</code> does not create deployment anymore because all the generators were deprecated.</p>
<p>You should use below command to create a deployment which internally creates a replicaset.</p>
<pre><code>kubectl create deployment pingpong --image=alpine
</code></pre>
<p>Please note you can not pass a command like <code>ping 1.1.1.1</code> in the above command.</p>
<p>If you want to add a command you need to edit the deployment created above using <code>kubectl edit deployment pingpong</code>or use a yaml to create it in first place.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: alpine-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: alpine
  template:
    metadata:
      labels:
        app: alpine
    spec:
      containers:
      - name: alpine
        image: alpline
        command: [&quot;&lt;Your command here&gt;&quot;]
</code></pre>
