I highly suspect this is a bug and that a report a...
# general
m
I highly suspect this is a bug and that a report already exists in rancher issues, but I'm not finding it with any keyword searches I put in. Rancher 2.7.12 I have a deployment with replicas set to 2 and a cronjob that creates a separate pod. When the cronjob runs, the pod appears in the deployment dashboard in Rancher. But it doesn't show up in
kubectl get deployment
I'm not certain if this is a bug. Anyone have any ideas on this?
b
I wouldn't expect it to show up in deployments.
I would expect it to show up in
kubectl get pods -n <namespace>
but
cronjobs
and
jobs
are different type of workload, just like
deployments
and
daemonsets
m
That's what I'm raising. The cronjob pod shows up in the deployment's list of pods in Rancher UI. Rancher incorrectly shows 3 pods. But the cronjob pod does NOT show up in
kubectl get deployments/my_app
- it properly shows 2 pods.
b
Without knowing more (yaml examples etc) it's gonna be hard to say
But I'll point out that latest in 2.7.x is 2.7.18 but latest release is 2.11.1
m
Screenshot showing what I think is a bug, and the two relevant yaml files downloaded from Rancher and redacted
c
Your cronjob pod uses the same labels as the deployments labelselector. Don't do that. The upstream deployment docs explicitly warn against this.
This is not a bug. It is something you are explicitly doing with the labels in the pod templates in your cronjob and deployment resources.
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#selector > Note: > You should not create other Pods whose labels match this selector, either directly, by creating another Deployment, or by creating another controller such as a ReplicaSet or a ReplicationController. If you do so, the first Deployment thinks that it created these other Pods. Kubernetes does not stop you from doing this.
m
Ah, that's what I was worried about but couldn't find. I will fix that ASAP.
is there any standardized approach recommended for this? Example:
workload_type: deployment
as a label?
c
No. Just don't give everything the same labels. Make something up if you need to.