Skip to main content
The OpenShift Python Wrapper provides a simple and intuitive interface for interacting with OpenShift and Kubernetes clusters. It standardizes resource CRUD operations and offers additional capabilities that simplify cluster management.

Requirements

The library requires Python 3.10 or higher.

Installation Methods

1

Install from PyPI (Recommended)

Install the latest stable version from PyPI using your preferred package manager:
uv is a fast Python package installer and is the recommended tool for managing dependencies.
2

Install from Source

For development or to use the latest features, install directly from the source repository:
To use the local installation in another project:
3

Verify Installation

Verify the installation by importing the library:

Dependencies

The library automatically installs the following key dependencies:
  • kubernetes (>=31.0.0) - Official Kubernetes Python client
  • timeout-sampler - Utilities for waiting and polling resources
  • python-simple-logger - Logging utilities
  • deepdiff - Deep comparison of resource states
  • jsonschema - Schema validation for resources
  • requests - HTTP library for API calls

Authentication Setup

The wrapper supports multiple authentication methods. Configure your cluster access using one of the following:
The library automatically reads from your kubeconfig file:
Authenticate using an API token:
Authenticate with basic credentials (uses OAuth flow):
Pass kubeconfig as a dictionary:

Environment Configuration

Logging

Control the logging level for the wrapper:
Disable log data hashing in secure environments:
Setting OPENSHIFT_PYTHON_WRAPPER_HASH_LOG_DATA="false" will expose sensitive information in logs. Only use this in secure environments.

Proxy Configuration

Route traffic through a proxy server:
The library automatically detects and uses the proxy configuration.

Additional Features

Fake Kubernetes Client

For testing without a real cluster, use the built-in fake client:
See the Fake Kubernetes Client documentation for details.

Command-Line Tools

The library includes command-line utilities:
  • class-generator - Generate resource classes from OpenShift API schemas
  • openshift-mcp-server - MCP server for exposing OpenShift functionality

Next Steps

Quickstart Guide

Get started with basic operations and examples

Core Concepts

Learn about resources, clients, and patterns