How to Install kubernetes in Python
Kubernetes python client
pip install kubernetes
What is kubernetes?
Kubernetes python client
Quick Start
Minimal example to get started with kubernetes:
import kubernetes
print(kubernetes.__version__)
Installation
pip (standard)
pip install kubernetes
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install kubernetes
pip3
pip3 install kubernetes
conda
conda install -c conda-forge kubernetes
Poetry
poetry add kubernetes
Dependencies
Installing kubernetes will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import kubernetes; print(kubernetes.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing kubernetes with pip.
ModuleNotFoundError: No module named 'kubernetes'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install kubernetes. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'kubernetes' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install kubernetes to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'kubernetes'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show kubernetes and upgrade with pip install --upgrade kubernetes.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install kubernetes. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user kubernetes
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org kubernetes
Recent Releases
| Version | Released |
|---|---|
35.0.0 latest |
2026-01-16 |
35.0.0b1 |
2026-01-12 |
35.0.0a1 |
2026-01-06 |
34.1.0 |
2025-09-29 |
34.1.0b1 |
2025-09-22 |
Manage kubernetes
Upgrade to latest version
pip install --upgrade kubernetes
Install a specific version
pip install kubernetes==35.0.0
Uninstall
pip uninstall kubernetes
Check what is installed
pip show kubernetes