<p>I'm using fabric8 java client library for kubernetes in my project. I am not able to find the best way to perform rolling update and rollback of deployment to previous version using their APIs.</p>

<p>I tried some of their APIs but don't think it is correct.</p>

<pre><code>Config config = new ConfigBuilder().build();
KubernetesClient client = new DefaultKubernetesClient(config);

client.apps().deployments().inNamespace("default").withName("nginx").createOrReplace(deployment);
</code></pre>

<p>What is the best way to do it? Any help is much appreciated.</p>

shreyas.k
<p>I think you can do rolling update like this(available since v4.1.3):</p>

<pre><code>     client.apps().deployments().inNamespace("default")
       .withName("nginx")
       .rolling()
       .withTimeout(5, TimeUnit.MINUTES)
       .updateImage("");
</code></pre>
