upgrade k8s charm results in duplicate units

Bug #1871756 reported by Ian Booth
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Ian Booth

Bug Description

deploy a stateful k8s charm with 3 units
upgrade the charm such that a new podspec is generated

k8s will progressively terminate and restart each pod

as each pod is restarted, juju will create a new unit instead of associating the restarted pod with its existing unit

looking at the db, the cloudContainer records for each unit correctly record the provider-id, but these are now duplicated, eg there are 2 records with provider-id "mariadb-k8s-1".
juju is supposed to use the provider-id to associate the pod with the unit

Also, 2 of the 3 charm upgrade-hooks errored because only the leader can pod-spec-set, yet the Python code did do a is_leader() check, so there's an issue there.

And looking at pod-0, it has the agent for unit-5, which is one of the duplicate units Juju created.

Tags: k8s
Ian Booth (wallyworld)
description: updated
Revision history for this message
Ian Booth (wallyworld) wrote :

It looks like the issue is at least partly caused by the fact that when the pod status is reported back to the controller, the fact that the pods belong to a stateful set is not being set as true. This causes juju to treat the units as stateless and hence delete them as soon as a pod terminates since for stateless deployments, a new pod is created rather than reusing the existing name.

Changed in juju:
assignee: nobody → Ian Booth (wallyworld)
status: Triaged → In Progress
Ian Booth (wallyworld)
Changed in juju:
milestone: 2.8-beta1 → 2.7.6
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.