<p>What is the command to delete replication controller and its pods? </p>

<p>I am taking a course to learn k8s on pluralsight. I am trying to delete the pods that I have just created using Replication controller. Following is my YAML:</p>

<pre><code>apiVersion: v1
kind: ReplicationController
metadata:
  name: hello-rc
spec:
  replicas: 2
  selector:
    app: hello-world
  template:
    metadata:
      labels:
        app: hello-world
    spec:
      containers:
      - name: hello-ctr
        image: nigelpoulton/pluralsight-docker-ci:latest
        ports:
        - containerPort: 8080
</code></pre>

<p>If I do 'kubectl get pods' following is the how it looks on my mac:</p>

<p><a href="https://i.stack.imgur.com/CG7zf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CG7zf.png" alt="enter image description here"></a></p>

<p>I have tried the following two commands to delete the pods that are created in the Minikube cluster on my mac, but they are not working:</p>

<p><code>kubectl delete pods hello-world</code>
<code>kubectl delete pods hello-rc</code></p>

<p>Could someone help me understand what I am missing?</p>

<p>you can delete the pods by deleting the replication controller that created them</p>

<pre><code>kubectl delete rc hello-rc
</code></pre>

<p>also, because pods created are just managed by ReplicationController, you can delete only theReplicationController and leave the pods running</p>

<pre><code>kubectl delete rc hello-rc --cascade=false
</code></pre>

<p>this means the pods are no longer managed .you can create a new ReplicationController with the
proper label selector and manage them again</p>

<p>Also,instead of replicationcontrollers, you can use replica sets.
 They behave in a similar way, but they have more expressive
pod selectors. For example, a ReplicationController can’t match pods with 2 labels </p>
