<p><strong>Background</strong></p>
<p>I am trying to learn to automate deployments with Jenkins on my laptop computer. I did not check the resource settings in the helm chart when I deployed Jenkins and I ended up over provisioned the memory and cpu requests.</p>
<p>The pod was initializing for several minutes and then eventually ended up in the status of CrashLoopBackOf.</p>
<p><strong>Software and Versions</strong></p>
<pre><code>$ minikube start
😄  minikube v1.17.1 on Microsoft Windows 10 Enterprise 10.0.19042 Build 19042
...
...
🐳  Preparing Kubernetes v1.20.2 on Docker 20.10.2
...
</code></pre>
<p>Note that Docker was installed from Visual Studio Code with Docker Desktop and Windows 10 WSL Ubuntu 20.04 LTS enabled.</p>
<pre><code>$ helm version
version.BuildInfo{Version:&quot;v3.5.2&quot;, GitCommit:&quot;167aac70832d3a384f65f9745335e9fb40169dc2&quot;, GitTreeState:&quot;dirty&quot;, GoVersion:&quot;go1.15.7&quot;}
</code></pre>
<p><strong>Installation</strong></p>
<pre><code>$ helm repo add stable https://charts.jenkins.io

$ helm repo ls
NAME                    URL
stable                  https://charts.jenkins.io


$ kubectl create namespace devops-cicd
namespace/devops-cicd created

$ helm install jenkins stable/jenkins --namespace devops-cicd

$ kubectl get svc -n devops-cicd -o wide
NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE    SELECTOR
jenkins         ClusterIP   10.108.169.104   &lt;none&gt;        8080/TCP    7m1s   app.kubernetes.io/component=jenkins-controller,app.kubernetes.io/instance=jenkins
jenkins-agent   ClusterIP   10.103.213.213   &lt;none&gt;        50000/TCP   7m     app.kubernetes.io/component=jenkins-controller,app.kubernetes.io/instance=jenkins


$ kubectl get pod -n devops-cicd --output wide 
NAME        READY   STATUS    RESTARTS   AGE     IP            NODE       NOMINATED NODE   READINESS GATES
jenkins-0   1/2     Running   1          8m13s   172.17.0.10   minikube   &lt;none&gt;           &lt;none&gt;
</code></pre>
<p>The pod failed eventually, ending with the status of CrashLoopBackOff</p>
<p>Unfortunately, I forgot to extract the logs for the pod.</p>
<p>In full disclosure, I got it deployed successfully by pulling the chart to my local file system and halved the size of the memory and cpu settings.</p>
<p><strong>Questions</strong></p>
<p>I fear that the situation of over provisioning in the Production environment one day. So how does one stop a failed pod from respawning/restarting and undo/rollback the deployment?</p>
<p>I tried to set Deployment replicas=0 but it had no effect. Actually, the only resources I could see were a couple of Services, the Pod itself, a PersistentVolume and some secrets.</p>
<p>I had to delete the namespace to remove the pod. This is not ideal. So what is the best way to tackle this situation (i.e. just deal with the problematic pod)?</p>

absolutelynewbie
<p>Drawing on the feedback I have gathered and confirmed that the pod is scheduled by a <code>StatefulSet</code>. I am attempting to answer my own question with the hope that it is useful for newbies like me.</p>
<p>My question was how to stop a pod (from respawning).</p>
<p>So here I get the info on the StatefulSet:</p>
<pre><code>$ kubectl get statefulsets -n devops-cicd -o wide
NAME      READY   AGE   CONTAINERS              IMAGES
jenkins   0/1     33s   jenkins,config-reload   jenkins/jenkins:2.303.1-jdk11,kiwigrid/k8s-sidecar:1.12.2 
</code></pre>
<p>Then scale in:</p>
<pre><code>$ kubectl scale statefulset jenkins --replicas=0 -n devops-cicd
statefulset.apps/jenkins scaled
</code></pre>
<p>Result:</p>
<pre><code>$ kubectl get statefulsets -n devops-cicd -o wide
NAME      READY   AGE     CONTAINERS              IMAGES
jenkins   0/0     6m35s   jenkins,config-reload   jenkins/jenkins:2.303.1-jdk11,kiwigrid/k8s-sidecar:1.12.2   
</code></pre>
