python-magnumclient
raw JSON → 4.10.0 verified Fri May 01 auth: no python
Client library for the OpenStack Magnum API, which manages containers and container orchestration engines (e.g., Kubernetes, Swarm). Current version 4.10.0, requires Python >=3.8. Releases follow OpenStack release cadence (approx. every 6 months with periodic stable updates).
pip install python-magnumclient Common errors
error No module named 'magnum' ↓
cause Importing the wrong module name; correct module is 'magnumclient'.
fix
Use 'from magnumclient import client'
error magnumclient.exceptions.EndpointNotFound: Could not find a suitable endpoint ↓
cause Keystone does not have the required service type in the catalog. Typically the service type is 'container' (not 'container-infra').
fix
Check Keystone service list for 'container' or set endpoint_override in the Client constructor.
Warnings
breaking Version 4.x dropped support for Python 2.7 and Python <3.8. ↓
fix Use Python >=3.8.
gotcha The commonly used 'magnumclient.client.Client()' may require explicit version argument; default version may not match your Magnum API. ↓
fix Pass version='1' (or the API microversion you need) to Client().
breaking From version 3.x to 4.x, the 'magnum-api' service type changed from 'container-infra' to 'container' in Keystone catalog. Clients may fail to discover endpoints if configured with old service type. ↓
fix Ensure Keystone catalog has 'container' service type, or pass endpoint_override directly.
Install
pip install python-magnumclient==4.10.0 Imports
- client wrong
from magnum import clientcorrectfrom magnumclient import client - MagnumClient wrong
from magnumclient import MagnumClientcorrectfrom magnumclient.client import Client
Quickstart
from magnumclient import client
from keystoneauth1 import session as ks_session
from keystoneauth1.identity import v3
auth = v3.Password(auth_url='http://your-openstack:5000/v3',
username='admin', password='secret',
project_name='admin', user_domain_name='Default',
project_domain_name='Default')
sess = ks_session.Session(auth=auth)
magnum = client.Client(session=sess, interface='public', region_name='RegionOne')
print(magnum.clusters.list())