[1.22] Charmed k8s fails to attach PV from csi-cinder - attachdetach-controller: Attach timeout for volume
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
CDK Addons |
Fix Released
|
High
|
Cory Johns |
Bug Description
The underlying Cinder volume gets stuck at "available" and never gets into "attaching" or "in-use", thus the PV is not gonna be available for a pod. For the record, the following step works with v1.21.5 so it's a regression in a broader context.
$ kubectl version --short
...
Server Version: v1.22.2
How to reproduce:
1. Deploy Charmed k8s with openstack-
juju add-model k8s-on-openstack "openstack/
wget -O ~ubuntu/
# LP: #1936842
sed -i.bak -e 's/lxd:0/0/' ~ubuntu/
# https:/
cat > ~ubuntu/
applications:
openstack-
annotations:
gui-x: "600"
gui-y: "300"
charm: cs:~containers/
num_units: 1
trust: true
to:
- '0'
options:
lb-
relations:
- ['openstack-
- ['openstack-
- ['openstack-
EOF
juju deploy --trust ~ubuntu/
--overlay ~ubuntu/
2. Confirm the storage class of "cdk-cinder" is set up by the charm
$ kubectl describe sc
Name: cdk-cinder
IsDefaultClass: No
Annotations: juju.io/
Provisioner: cinder.
Parameters: <none>
AllowVolumeExpa
MountOptions: <none>
ReclaimPolicy: Delete
VolumeBindingMode: Immediate
Events: <none>
3. Create a PVC and create a pod with the attachment
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolum
metadata:
name: my-pvc-1
spec:
storageClassName: cdk-cinder
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: my-pod-1
spec:
volumes:
- name: my-volume
persistentV
claimName: my-pvc-1
containers:
- image: nginx
name: nginx
volumeMounts:
- name: my-volume
mountPath: /opt/volumes/
EOF
[Actual result]
attachdetach-
$ kubectl describe pod
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m18s default-scheduler Successfully assigned default/my-pod-1 to juju-0998b2-
Warning FailedAttachVolume 18s attachdetach-
Warning FailedMount 15s kubelet Unable to attach or mount volumes: unmounted volumes=
$ openstack volume list --format yaml
- Attached to: []
ID: bfcab68e-
Name: pvc-e77ec6f7-
Size: 1
Status: available
[Expected result - v1.21.5]
AttachVolume.Attach succeeded for volume
$ kubectl describe pod
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 55s default-scheduler Successfully assigned default/my-pod-1 to juju-d1d7f0-
Normal SuccessfulAttac
Normal Pulling 38s kubelet Pulling image "nginx"
Normal Pulled 30s kubelet Successfully pulled image "nginx" in 7.910156447s
Normal Created 29s kubelet Created container nginx
Normal Started 29s kubelet Started container nginx
$ openstack volume list --format yaml
- Attached to:
- attached_at: '2021-09-
attachment_id: 9f44a7ea-
device: /dev/vdb
host_name: vast-goose.maas
id: cba11417-
server_id: f7c17617-
volume_id: cba11417-
ID: cba11417-
Name: pvc-ead5e7e8-
Size: 1
Status: in-use
Changed in cdk-addons: | |
importance: | Undecided → High |
no longer affects: | charmed-kubernetes-bundles |
Changed in cdk-addons: | |
milestone: | none → 1.22+ck1 |
status: | New → Triaged |
Changed in cdk-addons: | |
status: | In Progress → Fix Committed |
tags: | removed: review-needed |
Changed in cdk-addons: | |
status: | Fix Committed → Fix Released |
Attaching ~field-high. The current and immediate workaround is to downgrade to 1.21 for customer deployments, but it's not sustainable.