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.
I tried some of their APIs but don't think it is correct.
Config config = new ConfigBuilder().build();
KubernetesClient client = new DefaultKubernetesClient(config);
client.apps().deployments().inNamespace("default").withName("nginx").createOrReplace(deployment);
What is the best way to do it? Any help is much appreciated.
I think you can do rolling update like this(available since v4.1.3):
client.apps().deployments().inNamespace("default")
.withName("nginx")
.rolling()
.withTimeout(5, TimeUnit.MINUTES)
.updateImage("");