<p>I am a newbee in Kubernetes.</p>

<p>I have a Jenkins pipeline to deploy microservices [Spring Boot] into Kubernetes cluster [ EKS ]. It is in working condition and able to deploy into EKS cluster successfully.</p>

<blockquote>
  <p>For first time [ when Deployment / Service / Pod is not present in EKS
  ] application is deploying and displaying the content properly, but
  after that Application is deploying into cluster but not showing the
  updated content, it is showing the old content.</p>
</blockquote>

<p>If i remove the existing Deployment , Service and Pod, then it is deploying and displaying the new content.</p>

<p>Any clue if i am missing something.</p>

ajoy sinha
<p>There is a trick .. you have to use a pattern in pom and deployment yaml file that pattern need to be replaced using sed command in jenkins file        </p>

<p>in pom </p>

<pre><code>&lt;image&gt;registry.hub.docker.com/xxxx/yyyy:#BUILD_NUMBER&lt;/image&gt;
</code></pre>

<p>In deloyment.yaml file </p>

<pre><code>image: registry.hub.docker.com/xxxx/yyyy:#BUILD_NUMBER  
</code></pre>

<p>and in jenkins file </p>

<pre><code>sh "sed -i 's/#BUILD_NUMBER/${BUILD_NUMBER}/g' pom.xml"
sh "sed -i 's/#BUILD_NUMBER/${BUILD_NUMBER}/g' kubedeploy.yaml"
</code></pre>
