Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How deleting a deployment in fabric8 kubernetes-client works? #2209

Closed
wangyang0918 opened this issue May 8, 2020 · 14 comments
Closed

How deleting a deployment in fabric8 kubernetes-client works? #2209

wangyang0918 opened this issue May 8, 2020 · 14 comments
Labels

Comments

@wangyang0918
Copy link
Contributor

In Flink project, we are using the following code to delete a deployment. We start a Flink master deployment in the K8s cluster and it will call the stopAndCleanupCluster when all jobs finished. However, we find that it could not work and have a high probability the deployment could not be deleted, instead the replication has decreased to 0.

So when delete a deployment via fabric8 kubernetes-client, does it decrease the replication to 0 first? And then delete the deployment and replicationset. Right?

I really appreciate for your help and any suggestion.

	public void stopAndCleanupCluster(String clusterId) {
		this.internalClient
			.apps()
			.deployments()
			.inNamespace(this.nameSpace)
			.withName(KubernetesUtils.getDeploymentName(clusterId))
			.cascading(true)
			.delete();
	}
@rohanKanojia
Copy link
Member

cacading() has been marked as deprecated. Please use withPropagationPolicy() instead

@wangyang0918
Copy link
Contributor Author

@rohanKanojia Thanks a lot for your quick response. Do you mean withPropagationPolicy set to Foreground could solve this problem?

If the deleting deployment is not a one-step operation, then it might be not be executed completely, especially we do this in the deployment itself.

@rohanKanojia
Copy link
Member

I think cascading(true) should also be able to delete Deployment and its dependents. It sets orphanDependents fields to false in DeleteOptions.

But I would suggest you should set using withPropagationPolicy set to Foreground or Background for deletion operations

@wangyang0918
Copy link
Contributor Author

@rohanKanojia So do you mean the deleting deployment only send one http request to K8s apiserver? If not, it might not be executed completely.

@rohanKanojia
Copy link
Member

Yes, deletion is just an API request to Kubernetes APIServer

@wangyang0918
Copy link
Contributor Author

Thanks a lot. It is really strange that the deployment is not deleted. And the replication has been set to 0 instead.

@rohanKanojia
Copy link
Member

Which version are you using?

@zhengcanbin
Copy link

Yes, deletion is just an API request to Kubernetes APIServer

The Flink community is using V4.5.2, that is not a one step request

@rohanKanojia
Copy link
Member

Umm, that's pretty old version. Could you please try on v4.9.0 or v4.9.1 instead?

@rohanKanojia
Copy link
Member

@wangyang0918: I'm not sure if LeaderElection support is there in 4.5.2. I remember you once requested it and our team added it. Are you not using it?

@zhengcanbin
Copy link

Umm, that's pretty old version. Could you please try on v4.9.0 or v4.9.1 instead?

@rohanKanojia I notice the latest version is v4.10.1, is it safe that we use it in production?

@rohanKanojia
Copy link
Member

ah, We recently split the Kubernetes Model into smaller jars per apiVersion in #2137 . But it has introduced some regressions #2195, #2201 and #2205

If you're not affected by these bugs, you can upgrade. We have plans on fixing them and then cutting a stable release.

@zhengcanbin
Copy link

ah, We recently split the Kubernetes Model into smaller jars per apiVersion in #2137 . But it has introduced some regressions #2195, #2201 and #2205

If you're not affected by these bugs, you can upgrade. We have plans on fixing them and then cutting a stable release.

Got it. Thank you @rohanKanojia!

@wangyang0918
Copy link
Contributor Author

Bumping the version to 4.9.1 could fix our problem. @rohanKanojia Thanks a lot for you help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants