Repository navigation
CKS: deploy the Ceph CSI RBD driver when a cluster is created - #14906
bhouse-nexthop wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14906 +/- ##
============================================
+ Coverage 3.86% 20.93% +17.07%
- Complexity 0 21161 +21161
============================================
Files 494 6057 +5563
Lines 42888 549650 +506762
Branches 8141 73487 +65346
============================================
+ Hits 1657 115071 +113414
- Misses 40999 421123 +380124
- Partials 232 13456 +13224
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tested on a KVM lab running a main (24.0) build that includes this change. Primary storage is Ceph RBD. The Kubernetes 1.33.1 ISO was built with this PR's Result: 24 of 24 checks passed.
One thing to know when using it: cephcsi v3.18.2 needs an x86-64-v2 CPU in the guest. On the first run the KVM guests used the Not tested: UI (the PR has no UI fields), CephFS and snapshots (not part of this PR). |
On Ceph-backed zones, a CKS cluster that needs ReadWriteOnce volumes from Ceph gets them only after ceph-csi is installed by hand: its manifests, a config map with the monitors, a secret with the Ceph key and a StorageClass. createKubernetesCluster takes cephcsimonitors, cephcsipool, cephcsiuser and cephcsisecretkey. When they are given, the cluster is created with the ceph-csi RBD driver from the Kubernetes version ISO and a default StorageClass ceph-rbd on that pool. The key is stored encrypted in the cluster's details until the driver is deployed, then removed from them. It is copied to the control node as a file only the login user can read. The file is unlinked as soon as kubectl has it open, and it is applied server-side, so the key is never on a command line, in the node's user data or in a last-applied annotation. The request is marked as sensitive so the async job stores it encrypted. The cluster response returns cephcsipool, so the details tab shows which pool the cluster was created with for the driver; the key is never returned. In the create cluster form, advanced mode has a Ceph RBD storage switch that shows the monitors, pool, user and key (a password field that cannot be revealed). create-kubernetes-binaries-iso.sh adds the ceph-csi manifests and images to the ISO when CEPH_CSI_VERSION is set. Deleting a cluster with ceph-csi first deletes its PVCs with reclaim policy Delete, as for the CloudStack CSI driver. The cleanup now runs once before any node is destroyed (etcd nodes used to go first) and waits up to 120s for those PVs to go, so the driver can remove the backing volumes while the cluster still runs. Signed-off-by: Brad House <bhouse@nexthop.ai>
060320a to
508a429
Compare
|
I added the UI to this PR (still one commit):
Tested in a nested KVM test environment with Ceph: with Ceph RBD storage turned on, the form created a cluster that reached Running with the driver deployed, in about 5 minutes. The request carried the four parameters, the key field had no reveal icon, the details tab and |
Description
On a zone whose primary storage is Ceph RBD, a CKS cluster that should get its PersistentVolumes from Ceph needs ceph-csi installed by hand after every create: the driver's manifests and images, a ConfigMap with the monitors, a Secret with a Ceph user and key, and a StorageClass. The only storage CKS sets up is the CloudStack CSI driver (
enablecsi), which attaches volumes through the hypervisor.createKubernetesClustertakes four new parameters. When they are given, CKS deploys the ceph-csi RBD driver into the cluster with a default StorageClassceph-rbdon the given pool.cephcsimonitorshostorhost:portwith the v1 port (6789, the default), comma-separatedcephcsipoolcephcsiuserclient.(refused with it), e.g. one made withmon 'profile rbd' osd 'profile rbd pool=<pool>' mgr 'profile rbd pool=<pool>'cephcsisecretkeyceph auth get-keyAll four or none; each is checked against a character set that cannot break the generated manifests.
How it works:
create-kubernetes-binaries-iso.shadds the ceph-csi RBD manifests (namespaceceph-csi-rbd) and their images whenCEPH_CSI_VERSIONis set, e.g.CEPH_CSI_VERSION=3.18.2, so nodes pull nothing from the internet. It is opt-in because the images add about 370 MB to every node's import. The control node copiesceph-csi/from the ISO to/opt/ceph-csi, like the CloudStack CSI manifests.cks/conf/ceph-csi-rbd.yml, next to the node templates, so an operator can change the StorageClass. After the cluster is up, CKS fills it in, copies it to the control node and runskubectl apply --server-sideon it and on/opt/ceph-csi/. A cluster whose ISO has no ceph-csi fails with kubectl'sthe path "/opt/ceph-csi/" does not exist, before anything is applied.kubernetes_cluster_details, encrypted with the database key and not displayed, until the driver is deployed; then that detail is removed.last-applied-configurationannotation.secretkey, so the API access log masks it.createKubernetesClusteris now markedrequestHasSensitiveInfo, so its async job parameters are stored encrypted (with database encryption on), which also covers the existing registry password.password. Changing that is a separate change.reclaimPolicy: Delete, volume expansion on,imageFeatures: layering,exclusive-lock,object-map,fast-diff, ext4 withdiscard.kubernetes_cluster_details.Not included: CephFS, the snapshot controller (the provisioner's snapshotter sidecar is there, but VolumeSnapshots need the CRDs and controller), csi-addons, UI fields, and a response field. The upstream provisioner Deployment asks for 3 replicas on separate nodes, so on a cluster with fewer workers the extra replicas stay Pending until workers are added. Every Kubernetes version ISO used by such a cluster, for upgrades too, should be built with
CEPH_CSI_VERSION.Fixes: #14905
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
mvn test -pl plugins/integrations/kubernetes-service -am: 141 tests, 0 failures. The new tests cover:client.prefix;kubectl apply --server-side, and the key detail removed afterwards;CEPH_CSI_VERSION=3.18.2andv3.18.2. It downloads the five RBD manifests, moves every object toceph-csi-rbd, and adds the six images (cephcsi and the five sidecars) to the image list. With the variable unset, nothing is added.How did you try to break this feature and the system with this change?
client.prefix are refused before anything is created.kubectl applyfail on the missing/opt/ceph-csi/before it contacts the API server (checked with kubectl against an unreachable server), and the create fails with that reason.