shreyas.k
shreyas.k

Reputation: 191

How to perform Rolling update and Rollback of deployment in Kubernetes using fabric8 java client API?

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.

Upvotes: 0

Views: 532

Answers (1)

Rohan Kumar
Rohan Kumar

Reputation: 5872

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("");

Upvotes: 1

Related Questions