Fix "Deployment not deleted with Flink"
Fix and Closes #248 (closed)
Merge request reports
Activity
added Bug label
see #248 (closed) for more details
assigned to @stu208458
assigned to @she and unassigned @stu208458
mentioned in issue #248 (closed)
added 1 commit
- b5420942 - fix: wait only for pods which have exactly the same much labels and not only the same app lable
The problem of #248 (closed) is that the
flink-jobmanager
has the same labelapp=flink
as theflink-taskmanager
. So when we delete theflink-taskmanager
, we wait for all pods with the labelapp=flink
. But since we don't delete the pods related to theflink-jobmanager
, we wait for the pods associated with theflink-jobmanager
instead of the pods associated with theflink-taskmanager
.If two different deployments (or a deployment and a statefulset) have exactly the same
matchLabels
, we would get the error again. I'm not sure if this is a "valid" scenario or not? I would think that thematchLabels
of two different deployments/statefulsets should never be exactly the same in Kubernetes. What do you think? @sheYes, technically it is possible to deploy two different deployments that differ only in the
metadata.name
. However, I am not sure if this is a good practice.If I am correct, Kubernetes then creates two
replicaSets
that control the individual pods. The pods then have theownerReferences
field that points to the correspondingreplicaSet
. The ReplicaSet is associated with themetadata.name
of the deployment. So this would not be a problem if thedeployments
have the samematchLabels
.But other Kubernetes resources (e.g., a service) only look for the labels of a pod. So when you create a service or similar, you can not decide which pods this service should be associated with. So, i am not sure if it make any sense to deploy two deployments with exactly the same
matchLabels
.Kubernetes labels are a bit confusing. :D
Maybe interesting readings:
- https://medium.com/@zwhitchcox/matchlabels-labels-and-selectors-explained-in-detail-for-beginners-d421bdd05362
- https://stackoverflow.com/questions/54172198/why-dont-two-kubernetes-replicasets-with-same-selector-conflict-with-each-other
- https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/
mentioned in commit c3821898