Search for a command to run...
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.
CRC provides a minimal OpenShift 4 cluster that runs on your local machine. This is ideal for development and testing.
# 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
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
For production environments, OpenShift can be installed on various platforms:
# Get cluster credentials
oc login -u kubeadmin -p <password> <cluster_url>
# View cluster status
oc get nodes
oc get clusterversion
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: htpasswd_provider
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpasswd-secret
apiVersion: config.openshift.io/v1
kind: Storage
metadata:
name: cluster
spec:
storageClassDevices:
- devicePaths:
- /dev/sdb
storageClassName: standard
volumeMode: Block
Configure Network Policies
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-by-default
spec:
podSelector: {}
policyTypes:
- Ingress
Enable Audit Logging
apiVersion: config.openshift.io/v1
kind: Audit
metadata:
name: cluster
spec:
profile: WriteRequestBodies
Regular Updates
# Check for available updates
oc adm upgrade
# Apply update
oc adm upgrade --to-latest=true