<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Giorgi Beria</title>
    <description>The latest articles on DEV Community by Giorgi Beria (@beriagiorgi).</description>
    <link>https://dev.to/beriagiorgi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F199468%2Ff22f21a8-c64e-472d-98bf-3339036be20c.jpg</url>
      <title>DEV Community: Giorgi Beria</title>
      <link>https://dev.to/beriagiorgi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/beriagiorgi"/>
    <language>en</language>
    <item>
      <title>Kubernetes Rollbacks Without Panic: A Practical Deployment Guide</title>
      <dc:creator>Giorgi Beria</dc:creator>
      <pubDate>Sun, 01 Nov 2026 18:58:59 +0000</pubDate>
      <link>https://dev.to/beriagiorgi/kubernetes-rollbacks-without-panic-a-practical-deployment-guide-2269</link>
      <guid>https://dev.to/beriagiorgi/kubernetes-rollbacks-without-panic-a-practical-deployment-guide-2269</guid>
      <description>&lt;h1&gt;
  
  
  Kubernetes Rollbacks: How I Made Deployments Safer and Easier
&lt;/h1&gt;

&lt;p&gt;Deploying new software is easy when everything works. The real challenge starts when something breaks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How quickly can you restore the previous working version?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I recently improved my Kubernetes deployment workflow to make rollbacks predictable, traceable, and easier to execute.&lt;/p&gt;

&lt;p&gt;Here are the practical changes that made the biggest difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Stop Using &lt;code&gt;latest&lt;/code&gt; for Production
&lt;/h2&gt;

&lt;p&gt;Using a Docker image like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;my-api:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;makes it difficult to identify exactly which version is running.&lt;/p&gt;

&lt;p&gt;Instead, I generate unique image tags using a timestamp and Git commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;GIT_SHA&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--short&lt;/span&gt; HEAD&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;BUILD_TIME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d-%H%M&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;IMAGE_TAG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BUILD_TIME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;-&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GIT_SHA&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;my-api:20261101-1430-a8f21c3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This makes each deployment identifiable and helps ensure previous images can be restored.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Image tags should never be overwritten.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Always Check Rollout History
&lt;/h2&gt;

&lt;p&gt;After deploying, I verify the rollout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout status deployment/my-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the currently configured image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get deployment my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{.spec.template.spec.containers[*].image}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View deployment history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout &lt;span class="nb"&gt;history &lt;/span&gt;deployment/my-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands help identify the running version and available rollback revisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Keep Previous Revisions
&lt;/h2&gt;

&lt;p&gt;Kubernetes needs Deployment revision history to perform rollbacks.&lt;/p&gt;

&lt;p&gt;In the Deployment manifest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;revisionHistoryLimit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This retains up to two old ReplicaSets for rollback purposes.&lt;/p&gt;

&lt;p&gt;For critical applications, keeping more revisions may be appropriate.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Roll Back with One Command
&lt;/h2&gt;

&lt;p&gt;When a deployment causes problems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout undo deployment/my-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To restore a specific revision:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout undo deployment/my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--to-revision&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also use a small Bash script that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Displays the current image.&lt;/li&gt;
&lt;li&gt;Shows available revisions.&lt;/li&gt;
&lt;li&gt;Asks for confirmation.&lt;/li&gt;
&lt;li&gt;Performs the rollback.&lt;/li&gt;
&lt;li&gt;Waits for rollout completion.&lt;/li&gt;
&lt;li&gt;Displays the resulting image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to make recovery straightforward without hiding important information.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Verify the Application After Rollback
&lt;/h2&gt;

&lt;p&gt;A successful Kubernetes rollout does not necessarily mean the application works correctly.&lt;/p&gt;

&lt;p&gt;I check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout status deployment/my-api
kubectl get pods &lt;span class="nt"&gt;-l&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;my-api
kubectl logs deployment/my-api &lt;span class="nt"&gt;--tail&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then verify the application's health endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsS&lt;/span&gt; https://example.com/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;A rollback is complete only after the application has been verified.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Understand What Rollbacks Cannot Fix
&lt;/h2&gt;

&lt;p&gt;Kubernetes Deployment rollbacks restore a previous Pod template, but they do not automatically reverse:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database migrations&lt;/li&gt;
&lt;li&gt;External service failures&lt;/li&gt;
&lt;li&gt;Incompatible schema changes&lt;/li&gt;
&lt;li&gt;Changes to external configuration or secrets&lt;/li&gt;
&lt;li&gt;Other independently deployed services&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These require separate recovery planning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;My deployment workflow now follows five simple principles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use unique, immutable image tags.&lt;/li&gt;
&lt;li&gt;Keep useful deployment history.&lt;/li&gt;
&lt;li&gt;Make rollback commands easy to execute.&lt;/li&gt;
&lt;li&gt;Confirm before changing production.&lt;/li&gt;
&lt;li&gt;Verify the application after recovery.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;A reliable deployment process is not one that never fails. It is one that makes recovery predictable.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written by **Giorgi Beria&lt;/em&gt;&lt;em&gt;, Software Engineer &amp;amp; Product Builder.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://giorgiberia.com/blog/2026-05-30-kubernetes-rollbacks-without-panic/" rel="noopener noreferrer"&gt;giorgiberia.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;GitHub: &lt;a href="https://github.com/giorgiberia" rel="noopener noreferrer"&gt;github.com/giorgiberia&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
