Help:Managed Kubernetes
Magnum is the OpenStack Kubernetes as a Service offering. It can be used to deploy kubernetes clusters to a cloud VPS project.
To configure the openstack CLI, see Help:Using_OpenStack_APIs#OpenStack_Commandline_Interfaces.
The openstack coe subcommand used below is provided by the Magnum client (sudo apt install python3-magnum).
Deploy a cluster
A cluster can be launched from Horizon, managed by OpenTofu, or launched from the commandline:
openstack coe cluster create <cluster name> --cluster-template <cluster template name> --master-count 1 --node-count <worker count>
Creation may take 10 or 20 minutes. Creation progress can also be checked from the commandline:
openstack coe cluster show <cluster_id>
Get kube config file
Once the cluster is up, you can get the config file to connect with kubectl using 'Get Cluster Config' on Horizon or from the CLI:
OS_PROJECT_ID={project} openstack coe cluster config <cluster name> --dir <path to put "config" file in>
Driver Selection
Prior to mid-2026, most Magnum clusters were creating using the magnum Heat driver and Fedora base images. This driver is now deprecated and will soon be removed entirely, and the Fedora base images have been deactivated.
All new clusters should use an Ubuntu Kubernetes base image. These images are provided with names like "ubuntu-22.04-v1.34.8-for-magnum" or similar for different versions. Any cluster or template using an ubuntu base image will automatically be build using the new magnum-cluster-api driver.
The Heat driver will be phased out in early 2027. Clusters created with Fedora images and the old drivers /may/ continue to work, but will likely be unalterable and unreliable. All Heat clusters should be replaced as soon as possible.
Templates
Magnum clusters are deployed using a template that defines what the cluster will look like to openstack. This includes what image will be used, networking information, control and worker node sizes, and what version of kubernetes will be deployed when using the cluster.
Create a template
Any magnum-managed cluster will be created using a coe cluster template. Templates options are documented, but be warned that different drivers implement different options and in some cases handle them differently. Additionally, templates can include the free-form 'label' option which serves to support driver-specific options which are not part of the pre-determined template schema.
Because of that uncertainty, the best strategy is to begin with an existing, working template, and iterate on that rather than creating a new aspirational template from scratch.
Example Template
openstack coe cluster template create \
--image ubuntu-22.04-v1.34.8-for-magnum \
--cluster-distro ubuntu \
--external-network "wan-transport-eqiad" \
--fixed-network "VXLAN/IPv6-dualstack" \
--master-lb-enabled \
--master-flavor g4.cores2.ram4.disk20 \
--flavor g4.cores2.ram4.disk20 \
--network-driver calico \
--docker-storage-driver overlay2 \
--coe kubernetes \
--labels master_lb_floating_ip_enabled=false,kube_tag=v1.34.8 \
capitest
kube_tag can be found at https://hub.docker.com/r/rancher/hyperkube/tags
Template options
There are several optional options.
- --docker-volume-size
- will define how large of a volume, if any, to attach to nodes, this volume is used for storing docker images. If none is specified the disk space available to the image itself (as part of its flavor definition) will be used instead.
- --public
- will define if the template can be seen beyond the project it was created in.
Scale a cluster
openstack coe cluster resize <cluster name> <number of workers>
Upgrade a cluster
openstack coe cluster upgrade <cluster name> <template to upgrade to>
If this gets stuck you may need to uncordon any cordoned nodes and then run:
openstack coe cluster resize <cluster name> <current number of workers>
to reset the cluster status. Then run the upgrade again.
While updating kubectl won't work, but services will still be running and available.
Add cinder csi to cluster
Setup cinder csi: https://github.com/kubernetes/cloud-provider-openstack/blob/master/docs/cinder-csi-plugin/using-cinder-csi-plugin.md#using-the-manifests
example cloud.conf:
[Global]
application-credential-id = <application credential id>
application-credential-secret = <application credential secret>
domain-name = default
auth-url = https://openstack.eqiad1.wikimediacloud.org:25000/v3
tenant-id = <project id>
region = eqiad1-r
tenant-id can be found from:
openstack server show <id of a k8s cluster node>
it will be listed as project_id
base64 -w 0 cloud.conf
git clone https://github.com/kubernetes/cloud-provider-openstack.git
cd cloud-provider-openstack
vim manifests/cinder-csi-plugin/csi-secret-cinderplugin.yaml # replace base64 part with base64 output from above
kubectl create -f manifests/cinder-csi-plugin/csi-secret-cinderplugin.yaml
kubectl -f manifests/cinder-csi-plugin/ apply
Setup cinder as the default storage class:
sc.yaml:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: standard
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: cinder.csi.openstack.org
parameters:
availability: nova
kubectl apply -f sc.yaml
Provisioning with OpenTofu
When using tofu to provision a Magnum cluster, the application credentials used must include the "Unrestricted (dangerous)" permission or things will blow up. Specifically they will blow up with a "Failed to create trustee or trust for Cluster" error when Magnum attempts to create a service account for the cluster's internal use.
Certificate rotation
Magnum will create certificates with a 12 month lifespan. That means to that to preserve access to long-lived clusters the certs need to be updated at least once every 11 months.
Automatic monitoring and alerting for cert expiration is a work in progress, but actual cert updates from the commandline should be straightforward. A rolling cluster upgrade will also refresh the certs, and it works to 'upgrade' a cluster using the same template and kubernetes version that was used for creation.
root@cloudcontrol2010-dev:/home/andrew# openstack coe cluster show ef3d024f-7877-4e9a-8480-211d92a4e51c | grep template
| cluster_template_id | 236b713e-3c4c-4206-8954-5150358b1a01
root@cloudcontrol2010-dev:/home/andrew# openstack coe cluster upgrade ef3d024f-7877-4e9a-8480-211d92a4e51c 236b713e-3c4c-4206-8954-5150358b1a01
Request to upgrade cluster ef3d024f-7877-4e9a-8480-211d92a4e51c has been accepted.
root@cloudcontrol2010-dev:/home/andrew# # wait a few minutes
root@cloudcontrol2010-dev:/home/andrew# OS_PROJECT_ID=testlabs openstack coe cluster config ef3d024f-7877-4e9a-8480-211d92a4e51c
export KUBECONFIG=/home/andrew/config
root@cloudcontrol2010-dev:/home/andrew# export KUBECONFIG=/home/andrew/config
root@cloudcontrol2010-dev:/home/andrew# date
Tue Oct 6 02:40:54 PM UTC 2026
root@cloudcontrol2010-dev:/home/andrew# kubectl config view --raw -o jsonpath='{.users[0].user.client-certificate-data}' | base64 --decode | openssl x509 -enddate -noout
notAfter=Oct 5 14:40:38 2031 GMT
root@cloudcontrol2010-dev:/home/andrew# # expiration has moved to 12 months from present
The current Magnum setup does not support the endpoints used by 'coe ca rotate,' 'coe credential rotate,' or the 'Rotate Cluster Credentials' Horizon menu.
Hints and tips for the cluster-api driver
This is a list of traps and surprises encountered while using the magnum-cluster-api driver. Please add yours below!
- Error reporting for this driver is spotty at best. In many cases cluster creation will drag on forever rather than fail fast; in other cases it will fail but with an unhelpful error message. Better error reporting can be found using
kubectl get cluster -n magnum-system {cluster id} -o json | jq .status - Typically you should set 'master_lb_floating_ip_enabled': 'false' in your template. If this is not set, cluster creation will fail if your project doesn't have available floating ip quota.
- Cluster creation will fail cryptically if the kube_tag label does not match the kubernetes version installed on the requested worker image. See above for a few more details.
- Cluster creation tends to hang if master_lb_enabled=false. You can explicitly set master_lb_enabled=true or leave it unset (in which case it will default to true)
- Additional k8s api server certificate SANs can be managed via the
api_server_cert_sanslabel. The value is a comma separated list of either IP addresses or DNS hostnames. In the latter case, domain names cannot end with `.`
