This guide covers setting up the openshift-install binary and obtaining the required pull secret for cluster provisioning.
- Overview
- Prerequisites
- Installing openshift-install
- Obtaining Pull Secret
- AWS Credentials Setup
- Configuration
- Verification
- Troubleshooting
The ocpctl worker service uses the openshift-install binary to provision OpenShift clusters on AWS and IBM Cloud. This binary requires:
- openshift-install binary - Official OpenShift installer
- Pull secret - Authentication for pulling OpenShift images
- Cloud credentials - AWS or IBM Cloud credentials
- Red Hat account - Required to download installer and pull secret
- Cloud provider account - AWS or IBM Cloud with appropriate permissions
- AWS CLI configured with credentials
- IAM permissions for creating VPCs, EC2 instances, ELBs, Route53 records, etc.
- Service quotas sufficient for cluster creation
- IBM Cloud CLI installed and configured
- API key with appropriate permissions
- Resource groups and quotas configured
Visit the OpenShift mirror and download the appropriate version for your OS:
Linux (x86_64):
# Download the latest stable version
VERSION=stable-4.16 # or specific version like 4.16.0
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${VERSION}/openshift-install-linux.tar.gz
# Extract
tar xvf openshift-install-linux.tar.gz
# Move to PATH
sudo mv openshift-install /usr/local/bin/
# Make executable
sudo chmod +x /usr/local/bin/openshift-install
# Verify installation
openshift-install versionmacOS:
# Download for macOS
VERSION=stable-4.16
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${VERSION}/openshift-install-darwin.tar.gz
# Extract
tar xvf openshift-install-darwin.tar.gz
# Move to PATH
sudo mv openshift-install /usr/local/bin/
# Make executable
sudo chmod +x /usr/local/bin/openshift-install
# Verify installation
openshift-install versionFor a specific OpenShift version:
# Example: OpenShift 4.16.0
VERSION=4.16.0
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${VERSION}/openshift-install-linux.tar.gzBrowse available versions at: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/
macOS (Homebrew):
brew install openshift-installLinux (Custom Script):
# Download and install script
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-install-linux.tar.gz
tar -xzf openshift-install-linux.tar.gz
sudo install -m 755 openshift-install /usr/local/bin/# Check version
openshift-install version
# Expected output:
# openshift-install 4.16.0
# built from commit ...
# release image ...The pull secret authenticates the installer to pull OpenShift container images from Red Hat registries.
-
Visit Red Hat Cloud Console:
- Go to https://console.redhat.com/openshift/install/pull-secret
- Log in with your Red Hat account
-
Copy Pull Secret:
- Click "Copy" or "Download" button
- The secret is a JSON object containing authentication credentials
-
Save Pull Secret:
Option A: Environment Variable (Recommended for ocpctl):
# Add to .env file
cat >> .env << 'EOF'
OPENSHIFT_PULL_SECRET='{"auths":{"cloud.openshift.com":{"auth":"...","email":"..."},...}}'
EOFOption B: File on Disk:
# Save to file
cat > ~/pull-secret.json << 'EOF'
{
"auths": {
"cloud.openshift.com": {
"auth": "base64-encoded-credentials",
"email": "your-email@example.com"
},
"quay.io": {
"auth": "base64-encoded-credentials",
"email": "your-email@example.com"
},
"registry.connect.redhat.com": {
"auth": "base64-encoded-credentials",
"email": "your-email@example.com"
},
"registry.redhat.io": {
"auth": "base64-encoded-credentials",
"email": "your-email@example.com"
}
}
}
EOF
# Set environment variable to point to file
echo 'OPENSHIFT_PULL_SECRET_FILE=~/pull-secret.json' >> .envThe pull secret is a JSON object with this structure:
{
"auths": {
"cloud.openshift.com": {
"auth": "base64-encoded-token",
"email": "your-email@redhat.com"
},
"quay.io": {
"auth": "base64-encoded-token",
"email": "your-email@redhat.com"
},
"registry.connect.redhat.com": {
"auth": "base64-encoded-token",
"email": "your-email@redhat.com"
},
"registry.redhat.io": {
"auth": "base64-encoded-token",
"email": "your-email@redhat.com"
}
}
}Important Notes:
- Keep the pull secret secure - it contains authentication credentials
- Do NOT commit the pull secret to version control
- Add
pull-secret.jsonto.gitignore - Pull secrets can be regenerated from the Red Hat console if compromised
# Install AWS CLI
# macOS
brew install awscli
# Linux
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
# Configure credentials
aws configure
# Enter:
# - AWS Access Key ID
# - AWS Secret Access Key
# - Default region (e.g., us-east-1)
# - Default output format (json)
# Verify
aws sts get-caller-identityAdd to .env:
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS_DEFAULT_REGION=us-east-1For production deployments on EC2:
- Create IAM role with required permissions
- Attach role to EC2 instance
- No explicit credentials needed - SDK uses instance metadata
The AWS credentials need permissions to create:
- VPC and networking (subnets, route tables, internet gateways)
- EC2 instances (control plane and worker nodes)
- ELB load balancers
- Route53 DNS records
- S3 buckets (for bootstrap ignition)
- IAM roles and instance profiles
- Security Groups
Minimum policy (use AWS-managed AdministratorAccess for development):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:*",
"elasticloadbalancing:*",
"iam:*",
"route53:*",
"s3:*"
],
"Resource": "*"
}
]
}Edit .env file:
# OpenShift Installation
OPENSHIFT_PULL_SECRET='{"auths":{...}}' # Your actual pull secret JSON
OPENSHIFT_INSTALL_BINARY=/usr/local/bin/openshift-install # Path to binary (optional)
# AWS Configuration
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
# Worker Configuration
WORK_DIR=/tmp/ocpctl # Directory for cluster installation files
WORKER_CONCURRENCY=3 # Number of concurrent cluster operationsIf running as systemd service, add environment file:
# /etc/ocpctl/worker.env
OPENSHIFT_PULL_SECRET='{"auths":{...}}'
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...Update systemd service file:
[Service]
EnvironmentFile=/etc/ocpctl/worker.env# Check version
openshift-install version
# Test help
openshift-install create cluster --help# Validate JSON
echo $OPENSHIFT_PULL_SECRET | jq .
# Should output valid JSON with "auths" key# Verify identity
aws sts get-caller-identity
# Should output:
# {
# "UserId": "AIDAI...",
# "Account": "123456789012",
# "Arn": "arn:aws:iam::123456789012:user/your-user"
# }
# Check permissions (create a test cluster to fully validate)
# or verify specific permissions:
aws ec2 describe-regions
aws s3 lsCreate a test cluster through ocpctl:
# Start API server
make run-api
# Start worker
make run-worker
# In another terminal, create a test cluster via API or web UI
curl -X POST http://localhost:8080/api/v1/clusters \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "test-cluster",
"platform": "aws",
"profile": "aws-minimal-test",
"region": "us-east-1",
"version": "4.16.0",
"owner": "admin@localhost",
"team": "test",
"cost_center": "test-001",
"ttl_hours": 8
}'
# Monitor logs
# API logs show cluster creation request
# Worker logs show job pickup and openshift-install executionProblem: Binary not in PATH
Solution:
# Check if binary exists
which openshift-install
# If not found, verify installation
ls -la /usr/local/bin/openshift-install
# Add to PATH if needed
export PATH=$PATH:/usr/local/binProblem: error: unable to pull image or authentication errors
Solution:
# Validate pull secret JSON
echo $OPENSHIFT_PULL_SECRET | jq .
# Regenerate pull secret from Red Hat console if corrupted
# Ensure no extra whitespace or newlines
OPENSHIFT_PULL_SECRET=$(cat pull-secret.json | tr -d '\n')Problem: error: NoCredentialProviders or permission denied
Solution:
# Verify credentials
aws sts get-caller-identity
# Check environment variables
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
# Re-configure AWS CLI
aws configure
# Check IAM permissions
aws iam get-userProblem: openshift-install create cluster fails
Solutions:
-
Check AWS Service Quotas:
# View quotas aws service-quotas list-service-quotas --service-code ec2 # Request quota increase if needed
-
Verify Region Support:
- Not all regions support all instance types
- Check profile's instance types are available in selected region
-
Review Installation Logs:
# Logs are in work directory tail -f /tmp/ocpctl/<cluster-id>/.openshift_install.log
-
Check Bootstrap Errors:
# Bootstrap logs cat /tmp/ocpctl/<cluster-id>/.openshift_install_state.json
Problem: Jobs stuck in PENDING status
Solution:
# Check worker logs
journalctl -u ocpctl-worker -f
# Verify environment variables loaded
systemctl show ocpctl-worker | grep Environment
# Check database connectivity
psql $DATABASE_URL -c "SELECT * FROM jobs WHERE status = 'PENDING';"
# Restart worker
systemctl restart ocpctl-worker- OpenShift Documentation: https://docs.openshift.com/container-platform/latest/installing/index.html
- OpenShift Installer GitHub: https://github.com/openshift/installer
- Red Hat Console: https://console.redhat.com/openshift
- AWS Permissions Calculator: https://github.com/openshift/installer/blob/master/docs/user/aws/iam.md
-
Rotate Credentials Regularly:
- Regenerate pull secret every 90 days
- Rotate AWS credentials
-
Use Least Privilege:
- Create dedicated IAM user for ocpctl
- Limit permissions to only what's needed
-
Secure Storage:
- Never commit secrets to git
- Use AWS Secrets Manager or HashiCorp Vault in production
- Encrypt environment files
-
Audit Logging:
- Enable CloudTrail for AWS API calls
- Monitor cluster creation activities
- Alert on suspicious patterns
Instead of environment variables, use AWS Secrets Manager:
// Fetch pull secret from AWS Secrets Manager
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/secretsmanager"
)
sess := session.Must(session.NewSession())
svc := secretsmanager.New(sess)
result, err := svc.GetSecretValue(&secretsmanager.GetSecretValueInput{
SecretId: aws.String("ocpctl/pull-secret"),
})
pullSecret := *result.SecretStringPin to specific versions in production:
# Lock to specific version
OPENSHIFT_VERSION=4.16.0
OPENSHIFT_INSTALL_BINARY=/usr/local/bin/openshift-install-${OPENSHIFT_VERSION}Configure proper cleanup and retention:
# Worker configuration
WORK_DIR=/var/lib/ocpctl/workdir
RETAIN_WORK_DIR_DAYS=7 # Clean up after 7 daysIf you encounter issues:
- Check worker logs:
journalctl -u ocpctl-worker -f - Check installer logs:
tail -f $WORK_DIR/<cluster-id>/.openshift_install.log - Verify prerequisites: Run verification steps above
- Consult OpenShift documentation
- Open an issue on the ocpctl GitHub repository