Skip to main content

OpenShift Python Wrapper

A Python wrapper for the Kubernetes client with support for OpenShift and Container Virtualization. Standardize resource operations with a simple, intuitive interface.

Quick Start

Get up and running with OpenShift Python Wrapper in minutes

1

Install the package

Install using pip or uv:
pip install openshift-python-wrapper
2

Configure cluster access

Ensure you have a valid kubeconfig file with access to your cluster:
export KUBECONFIG=~/.kube/config
kubectl cluster-info
The wrapper uses your existing Kubernetes configuration automatically.
3

Create your first resource

Create a Pod using the wrapper’s intuitive interface:
from ocp_resources.pod import Pod

pod = Pod(
    name="nginx-pod",
    namespace="default",
    containers=[{
        "name": "nginx",
        "image": "nginx:latest"
    }]
)
pod.deploy()
pod.wait_for_status(status="Running")

print(f"Pod {pod.name} is running!")
Pod nginx-pod is running!
4

Execute commands in containers

The wrapper provides simplified access to pod operations:
# Execute a command inside the pod
result = pod.execute(command=["nginx", "-v"])
print(result)

# Get logs
logs = pod.log()
print(logs)

Key Features

Everything you need to work with Kubernetes and OpenShift resources

Unified CRUD Interface

Standardized Create, Read, Update, and Delete operations for all resource types

Context Managers

Automatic resource lifecycle management with Python context managers

OpenShift Virtualization

First-class support for KubeVirt and Container Virtualization resources

Pod Operations

Execute commands, stream logs, and interact with containers easily

Class Generator

Auto-generate wrapper classes for any Kubernetes resource

Fake Client

Test your code without a real cluster using the fake Kubernetes client

Explore by Topic

Deep dive into specific areas of the wrapper

📦

Core Concepts

Understand resources, namespaces, and client configuration

Learn more
🐳

Working with Pods

Execute commands, stream logs, and manage container lifecycles

Learn more
💻

Virtual Machines

Manage KubeVirt virtual machines and OpenShift Virtualization

Learn more
⚙️

Class Generator

Auto-generate Python wrappers for any Kubernetes custom resource

Learn more

Ready to get started?

Install the package and create your first resource in minutes

View Quickstart Guide

Build docs developers (and LLMs) love