Command Palette

Search for a command to run...

OpenShift Installation Guide

Comprehensive guide for installing OpenShift Container Platform (OCP) and OpenShift Origin (OKD) across different operating systems.

This guide covers the installation of both OpenShift Container Platform (OCP) and OpenShift Origin (OKD) - the community distribution of OpenShift.

Prerequisites

  • Minimum 4 CPU cores
  • Minimum 16GB RAM
  • 100GB available disk space
  • Internet connectivity
  • Valid Red Hat subscription (for OCP)

Installation Methods

1. CodeReady Containers (CRC) - Local Development

CRC provides a minimal OpenShift 4 cluster that runs on your local machine. This is ideal for development and testing.

Ubuntu/Debian Installation

# Install required packages
sudo apt update
sudo apt install -y libvirt-daemon libvirt-daemon-system network-manager
 
# Download CRC
curl -LO https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
 
# Extract the archive
tar xvf crc-linux-amd64.tar.xz
cd crc-linux-*
 
# Move binary to PATH
sudo mv crc /usr/local/bin/
 
# Setup CRC
crc setup
 
# Start OpenShift cluster
crc start

2. OpenShift CLI (oc)

The OpenShift CLI is required for interacting with OpenShift clusters.

# Download OpenShift CLI
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz
 
# Extract the archive
tar xvf oc.tar.gz
 
# Move binary to PATH
sudo mv oc /usr/local/bin/
sudo mv kubectl /usr/local/bin/
 
# Verify installation
oc version

3. Production Installation

For production environments, OpenShift can be installed on various platforms:

Post-Installation Configuration

1. Access the Cluster

# Get cluster credentials
oc login -u kubeadmin -p <password> <cluster_url>
 
# View cluster status
oc get nodes
oc get clusterversion

2. Configure Authentication

apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
  name: cluster
spec:
  identityProviders:
  - name: htpasswd_provider
    mappingMethod: claim
    type: HTPasswd
    htpasswd:
      fileData:
        name: htpasswd-secret

3. Configure Storage

apiVersion: config.openshift.io/v1
kind: Storage
metadata:
  name: cluster
spec:
  storageClassDevices:
    - devicePaths:
      - /dev/sdb
      storageClassName: standard
      volumeMode: Block

Troubleshooting

Security Best Practices

  1. Configure Network Policies

    apiVersion: networking.k8s.io/v1
    kind: NetworkPolicy
    metadata:
      name: deny-by-default
    spec:
      podSelector: {}
      policyTypes:
      - Ingress
  2. Enable Audit Logging

    apiVersion: config.openshift.io/v1
    kind: Audit
    metadata:
      name: cluster
    spec:
      profile: WriteRequestBodies
  3. Regular Updates

    # Check for available updates
    oc adm upgrade
     
    # Apply update
    oc adm upgrade --to-latest=true

Next Steps