简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM