OC(1)
β¨ NAME β¨
hey bestie! π so you're looking at the OC(1) manpage from June 2016, and we're about to dive into oc rollback β the command that literally rewinds part of your application back to a previous deployment. it's giving time machine energy, no cap. π°οΈ
oc rollback β revert part of an application back to a previous deployment. periodt. π
πΈ SYNOPSIS πΈ
oc rollback [OPTIONS]
π DESCRIPTION π
okay so when you run this command, your deployment configuration gets updated to match a previous deployment. literally rewind. by default, only the pod and container configuration will be changed β scaling or trigger settings are left as-is. so the main character vibes change, but the side characters stay put. π
β οΈ important tea: environment variables and volumes are included in rollbacks, so if you've recently updated security credentials in your environment, your previous deployment may not have the correct values. it's like rewinding a group chat and realizing you left the old messages on read. π
any image triggers present in the rolled back configuration will be disabled with a warning. this is to help prevent your rolled back deployment from being replaced by a triggered deployment soon after your rollback. basically, the triggers get benched so your rollback can have its moment. to re-enable the triggers, use the set triggers command. β¨
if you want to review the outcome of the rollback, pass --dry-run to print a human-readable representation of the updated deployment configuration instead of executing the rollback. this is useful if you're not sure what the outcome will be. it's like a preview before you post. π
π OPTIONS π
--allow-missing-template-keys=trueβ if true, ignore any errors in templates when a field or map key is missing in the template. only applies to golang and jsonpath output formats. so if your template is a little messy, this lets it slide. π--change-scaling-settings=falseβ if true, include the previous deployment's replicationController replica count and selector in the rollback. so you're bringing back the old scaling vibes too. π¦--change-strategy=falseβ if true, include the previous deployment's strategy in the rollback. strategy = the plot twist of your deployment, and you can rewind it. π--change-triggers=falseβ if true, include the previous deployment's triggers in the rollback. triggers = what makes new deployments happen, so this lets you bring back the old triggers (but remember, they might be disabled by default β see description above!). β οΈ-d,--dry-run=falseβ instead of performing the rollback, describe what the rollback will look like in human-readable form. literally just a preview, no cap. π-o,--output=""β output format. one of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file). pick your fave. π--show-managed-fields=falseβ if true, keep the managedFields when printing objects in JSON or YAML format. managedFields = the metadata tea, so this keeps it. π΅--template=""β template string or path to template file to use when-o=go-template,-o=go-template-file. the template format is golang templates [β¨http://golang.org/pkg/text/template/#pkg-overviewβ©]. so if you're fancy with templates, this is your moment. β¨--to-version=0β a config version to rollback to. specifying version 0 is the same as omitting a version (the version will be auto-detected). this option is ignored when specifying a deployment. so you can pick a specific version, but 0 means auto-magic. πͺ
π¦ OPTIONS INHERITED FROM PARENT COMMANDS π¦
--as=""β username to impersonate for the operation. user could be a regular user or a service account in a namespace. so you can be like "i'm someone else" for this operation. π--as-group=[]β group to impersonate for the operation, this flag can be repeated to specify multiple groups. you can stack these like friendship bracelets. πΏ--as-uid=""β UID to impersonate for the operation. that's the user ID, not the vibe. π³--as-user-extra=[]β user extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key. extra extra, read all about it. π°--cache-dir="/homeless-shelter/.kube/cache"β default cache directory. it's literally where the cache lives, no cap. ποΈ--certificate-authority=""β path to a cert file for the certificate authority. CA = the trust anchor, so this is important for security. π--client-certificate=""β path to a client certificate file for TLS. TLS = the secure handshake, and this is your client's ID. π³--client-key=""β path to a client key file for TLS. the key to your client cert, keep it secret. π€«--cluster=""β the name of the kubeconfig cluster to use. pick your cluster like you pick a filter. πΈ--context=""β the name of the kubeconfig context to use. context = the whole vibe of cluster+user+namespace, so this is a big deal. π--disable-compression=falseβ if true, opt-out of response compression for all requests to the server. so no zipping, just raw data. π¦--insecure-skip-tls-verify=falseβ if true, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure. > β οΈ WARNING: this is literally insecure, so only do it if you know what you're doing! no cap, this is a security risk. π¨--kubeconfig=""β path to the kubeconfig file to use for CLI requests. kubeconfig = the config file that knows your clusters, so point it where you need. π--kuberc=""β path to the kuberc file to use for preferences. this can be disabled by exportingKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=off. kuberc = your preferences file, and you can turn it off two ways. ποΈ--match-server-version=falseβ require server version to match client version. so if true, the server and client must be twinning exactly. π―-n,--namespace=""β if present, the namespace scope for this CLI request. namespaces = the rooms in your cluster, so this picks which room. πͺ--profile="none"β name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex). profiling = performance tea, and you can pick which one. π΅--profile-output="profile.pprof"β name of the file to write the profile to. where the profiling data goes, default isprofile.pprof. π--request-timeout="0"β the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). a value of zero means don't timeout requests. so 0 = wait forever, no cap. β³-s,--server=""β the address and port of the Kubernetes API server. the server = where the magic happens, so point it there. π--tls-server-name=""β server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used. so this overrides the name for cert checks. π―--token=""β bearer token for authentication to the API server. token = your key to the kingdom, keep it secret. ποΈ--user=""β the name of the kubeconfig user to use. pick the user like you pick a username. π€--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code. so warnings become dealbreakers, and the command will fail. π
π EXAMPLE π
okay bestie, here are some real examples to slay your rollback game:
# Perform a rollback to the last successfully completed deployment for a deployment config
oc rollback frontend
# See what a rollback to version 3 will look like, but do not perform the rollback
oc rollback frontend --to-version=3 --dry-run
# Perform a rollback to a specific deployment
oc rollback frontend-2
# Perform the rollback manually by piping the JSON of the new config back to oc
oc rollback frontend -o json | oc replace dc/frontend -f -
# Print the updated deployment configuration in JSON format instead of performing the rollback
oc rollback frontend -o json
π₯ SEE ALSO π₯
also check out oc(1) for the whole OpenShift CLI fam. π
π HISTORY π
fun fact: this manpage is from June 2016, and it's ported from the Kubernetes man-doc generator. iconic. π
this page is part of the Openshift CLI User Manuals, version Openshift, dated June 2016. made with π by your favorite Unix bestie. stay slaying! πβ¨
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms