本地Open Shift升级咨询:从1.2.0升级至3.6/3.7或最新版
Hey there! Let's break down how to upgrade your local OpenShift 1.2.0 setup (from the thesteve0/openshift-origin Vagrant box) to either 3.6/3.7 or a more recent release. I'll cover two reliable methods—one for in-place upgrades, and a cleaner approach using a fresh Vagrant environment (better for big version jumps).
Option 1: In-Place Upgrade to OpenShift 3.6/3.7
This works if you want to keep your existing environment, but note that jumping from 1.2 to 3.x has significant API and configuration changes—always back up your data first!
Step 1: Backup your cluster resources
Log into your cluster and export all project configurations to a local file:oc export all --all-namespaces > openshift-resources-backup.yamlIf you have persistent data (like databases), copy it off the Vagrant VM to your local machine:
vagrant scp default:/path/to/your/persistent/data ./local-backup/Step 2: SSH into the Vagrant VM
vagrant sshStep 3: Update the OpenShift YUM repo
The old 1.2 repo is likely no longer active. Edit the repo file to point to the 3.6 or 3.7 CentOS 7 repository:
For 3.7, create/edit/etc/yum.repos.d/openshift-origin.repowith:[openshift-origin] name=OpenShift Origin 3.7 baseurl=https://mirror.openshift.com/pub/openshift-v3/repositories/centos7/origin/v3.7/ enabled=1 gpgcheck=0For 3.6, replace
v3.7in the baseurl withv3.6.Step 4: Stop OpenShift services
sudo systemctl stop origin-master-api origin-master-controllers origin-nodeStep 5: Upgrade OpenShift packages
sudo yum update origin* -yStep 6: Verify the upgrade
Check the installed version:oc versionYou should see output showing 3.6.x or 3.7.x.
Step 7: Restart services and validate the cluster
sudo systemctl start origin-master-api origin-master-controllers origin-nodeWait a few minutes, then check if all nodes and pods are healthy:
oc get nodes oc get pods --all-namespaces
⚠️ Note: Some older 1.2 resources might not be compatible with 3.x APIs. If you run into issues, use your backup to recreate resources in the upgraded cluster.
Option 2: Fresh Vagrant Environment (Recommended for Big Version Jumps)
Since 1.2 is drastically different from 3.6/3.7, starting fresh avoids compatibility headaches.
Step 1: Backup your data
Follow the same backup steps as Option 1 to save your project resources and persistent data.Step 2: Destroy the old Vagrant environment
vagrant destroy -fStep 3: Update your Vagrantfile
Replace the old box reference with an official 3.6/3.7 OpenShift Origin box. For example, for 3.7:config.vm.box = "openshift/origin" config.vm.box_version = "v3.7.2"For 3.6, use
box_version = "v3.6.1".Step 4: Start the new environment
vagrant upThis will pull the new 3.x box and set up the cluster automatically.
Step 5: Restore your backup
SSH into the new VM, log into the cluster, and recreate your projects and resources:oc create -f openshift-resources-backup.yamlThen copy your persistent data back to the appropriate paths in the new VM.
Upgrading to the Latest Version (OKD)
If you want the most recent release (now called OKD, the community version of OpenShift), note that OKD 4.x uses a different architecture (Operator-based) than 3.x. The Vagrant deployment method for 4.x is different from your original 1.2 setup, but you can:
- Use the official OKD 4.x local cluster tools like
crc(CodeReady Containers) for a single-node cluster. - Find updated Vagrant boxes for OKD 4.x (though they're less common than 3.x boxes).
For a smooth transition, starting fresh with crc is usually the easiest way to run the latest OKD locally.
内容的提问来源于stack exchange,提问作者u123

