<p>Currently I am trying to implement demo for CI/CD pipeline using SVN , Kubernetes and Jenkins. For kubernetes deployment, I created deployment and services.And for making deployment I am using <code>kubectl apply -f</code> command for both deployment inside my Jenkins deployment step. </p>

<p>Like the following ,</p>

<pre><code>stage ('Test Deployment')
        {
             steps
                {
                    sh 'kubectl apply -f deployment/testdeployment.yaml'
                    sh 'kubectl apply -f deployment/testservice.yaml'
                }
        }
</code></pre>

<p>and service.</p>

<p>For each commit to my SVN repo will trigger this jenkins pipeline job and will execute the commands. After modifying any changes in code the same <code>kubectl apply</code> command is executing.</p>

<p>Here my confusion is that , </p>

<ol>
<li>Can I use <code>kubectl apply</code> command is for updating the existing deployment ? </li>
<li>Or Do I need to use the command <code>kubectl rollout restart</code> ?</li>
</ol>

<p>For continuous deployment process in CI/CD pipeline implementation , Which command I need to use in my Jenkinsfile for updating the deployment when commit is made to SVN repository? </p>

Mr.DevEng
<p>You can use the Kubectl apply command as long as the name of resources in the deployment and service file has not changed. From the <a href="https://kubectl.docs.kubernetes.io/pages/app_management/apply.html" rel="nofollow noreferrer">Kubernetes book</a>,</p>

<blockquote>
  <p>Apply is a command that will update a Kubernetes cluster to match
  state defined locally in files.</p>

<pre><code>kubectl apply
</code></pre>
  
  <p>Fully declarative - don't need to specify create or update - just
  manage files</p>
</blockquote>

<p>The parameters relating to rolling deployment such as how many pods should be available and how many can be taken out of active deployment you can check <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment" rel="nofollow noreferrer">this documentation</a>. </p>
