Skip to content

Instantly share code, notes, and snippets.

@DerPauli
Last active August 12, 2019 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DerPauli/68bf3e7a61da199275e78cf4a9ca8186 to your computer and use it in GitHub Desktop.
Save DerPauli/68bf3e7a61da199275e78cf4a9ca8186 to your computer and use it in GitHub Desktop.
RedHat OpenShift cheat sheet
## Basic
# create new project
oc new-app <git_project> \
--source-secret=<optional_secret(basic auth + crt)> \
--build-env <build_environment_variables> \
--context-dir=<dir_for_dockerfile> \
-o yaml > <outfile>
# create a secret
oc create secret generic <secret_name> \
--from-literal=username=<basic_auth_name> \
--from-literal=password=<basic_auth_pw> \
--from-file=ca.crt=<path_to_file>.crt
# change uploaded objects
oc edit <bc/dc/object_type>/<project_name>
# print out uploaded object
oc describe <object_type> <project_name>
## Template
# upload a template from file to a specific project
oc create -f <path_to_tmpl_file>{.yaml|.json} -n <project_name>
# convert a template file into objects (to stdout)
oc process <path_to_tmpl_file>{.yaml|.json}
# convert and upload the new built objects to project
oc process <uploaded_template_name> | oc create -f -
# create a template from uploaded objects
oc export all --as-template=<template_name> > <template_filename>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment