fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift
http://fabric8.io
Apache License 2.0
3.43k stars 1.46k forks source link

How do I roll back deployment #6442

Open chappie-k opened 1 month ago

chappie-k commented 1 month ago

Is your task related to a problem? Please describe

kubenetes version:1.29.1 kubenetes-client 6.13.4

when i exec the following code:

DeploymentRollback deploymentRollback = new DeploymentRollbackBuilder()
            .withApiVersion("app/v1")
            .withName(name)
            .withRollbackTo(new RollbackConfig(revision)).build();
    kubernetesClient.apps().deployments().inNamespace(K8SConfig.K8S_DEFAULT_NAMESPACE).withName(name).rollback(deploymentRollback);

errormessage: Message: the server could not find the requested resource. Received status: Status(apiVersion=v1, code=404, details=StatusDetails(causes=[], group=null, kind=null, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=the server could not find the requested resource, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=NotFound, st

help me!!!

Describe the solution you'd like

rollout deployment could worked

Describe alternatives you've considered

No response

Additional context

No response

rohanKanojia commented 1 month ago

@chappie-k : Hello, from error stacktrace it looks like the Deployment is not present in the cluster:

Message: the server could not find the requested resource. 

Are you sure that the Deployment you're trying to rollout is present in the target cluster?