Overview
The OpenShift Python Wrapper supports proxy configuration, allowing you to route all cluster communication through an HTTP or HTTPS proxy server. This is essential for environments with restricted network access or corporate proxy requirements.Quick Start
Enable proxy configuration by setting environment variables:The wrapper automatically detects and uses proxy settings from
HTTPS_PROXY or HTTP_PROXY environment variables. No code changes are required.Configuration Methods
HTTPS Proxy
For secure connections (recommended):HTTP Proxy
For non-secure connections:Proxy Priority
If both are set,HTTPS_PROXY takes precedence:
Proxy URL Format
Proxy URLs should follow this format:Without Authentication
With Authentication
With Special Characters
URL-encode special characters in credentials:No Proxy Configuration
Exclude specific hosts from proxying:The
NO_PROXY variable accepts comma-separated values:- Hostnames:
localhost,example.com - IP addresses:
127.0.0.1,192.168.1.1 - CIDR notation:
10.0.0.0/8,172.16.0.0/12 - Domain suffixes:
.internal.example.com(matches all subdomains)
Usage Examples
Basic Usage
Set proxy and use the wrapper normally:With Authentication
Multiple Clusters with Different Proxies
Corporate Proxy Setup
Windows Environment
Linux/Mac Environment
Docker Container
Pass proxy settings to containers:Kubernetes Pod
Configure proxy in pod environment:Verification
Check Proxy Configuration
Verify proxy settings are detected:Test Proxy Connection
Test if the proxy is working:Troubleshooting
Proxy Connection Refused
Certificate Verification Errors
For testing only, you can disable SSL verification (not recommended for production):Proxy Authentication Failures
If authentication fails:- Verify credentials are correct
- Check if special characters need URL encoding
- Test credentials with curl:
Requests Not Using Proxy
If requests aren’t going through proxy:-
Verify environment variables are set:
-
Check NO_PROXY isn’t excluding your cluster:
-
Ensure variables are set before importing wrapper:
Security Considerations
- Avoid Hardcoding Credentials: Never hardcode proxy credentials in scripts
- Use Environment Variables: Store credentials in environment variables
- Secure Credential Storage: Use secrets management for production
- HTTPS Proxy: Prefer HTTPS proxies for encrypted traffic
- Audit Logging: Enable proxy logging for security audits
- Least Privilege: Use proxy accounts with minimum required permissions
Best Practices
- Set Globally: Configure proxy environment variables at the system level
- Use NO_PROXY: Exclude internal traffic from proxying
- Test Connectivity: Always test proxy configuration before deployment
- Document Settings: Document proxy requirements for your environment
- Monitor Traffic: Monitor proxy logs for connection issues
- Use Authentication: Secure proxies with authentication
- Handle Errors: Add proper error handling for proxy failures