the term "Application" can be a difficult thing to define
Equation: App = OCI/SRE
Our New Stack:
OpenShift extends the basic collection of K8s primitives to provide additional features related to developer interaction, multitennant security, and collaborative image maintenance
Quickly compose multi-service solutions
https://github.com/kubernetes/kubernetes/issues/11492Deploy an image from DockerHub:
oc new-app kubernetes/guestbook -o json
Build from a local source folder, or from a Dockerfile:
oc new-app . -o yaml
Add source layers to an operationally-maintained base:
oc new-app openshift/nodejs~https://github.com/ryanj/pillar-base -o json
Run with -o
to view the generated object list, then try piping the resulting object list to "oc create -f -
"
Templates contain a list of objects which document your application composition
Templates also include support for basic parameter injection, but may need to be customized per deployment pipeline stage
Convert a parameterized template to a primitive object list:
oc process -f template.json -p KEY=VALUE
Submit a processed template (or any list of k8s object primitives) to the k8s API with "oc create
":
oc process -f template.yaml -p KEY=VALUE | oc create -f -
Install a template into the current project, making it easier to reuse:
oc create -f template.json
Create an application from an installed template, from a file, or from a url:
oc new-app -f template.json
Nodejs and MongoDB multi-service application example:
oc new-app -f https://raw.githubusercontent.com/ryanj/restify-mongodb-parks/master/restify-mongodb-parks-template.json
definition
to
Combines source repos and operationally-maintained builder images to produce application images
Available as a standalone project, for use with Jenkins or other external builder processes: github.com/openshift/source-to-image
For this example, we will deploy a fork of the pillar-base
repo by clicking on "Add to Project" in the web console. Then, select a nodejs base image, name your webservice, and enter it's github source url
Optionally, explore the "Advanced routing, build, and deployment options" before starting your build with the "Create" button
Example repo source: github.com/ryanj/pillar-base
The web console uses a socket stream to report status changes as they occur throughout the cluster
After the build task has completed, find the NAME
of the pod where your image has been deployed:
oc get pods
As with the core APIs, the CLI output is consistently formatted, following established patterns:
kubectl get pods
Iterate on container-based solutions
Make a minor edit to your local repo's index.html
file,
then test your changes before you commit by synching content into your hosted container:
oc rsync --exclude='node_modules*' . PODNAME:
Make sure to use a valid PODNAME
from:
oc get pods
Set up a commit WebHook to automate image production
If you're running OpenShift locally in a VM, try using ultrahook to proxy webhook events to your laptop
Or, use GitHub's web-based editor to make a minor change
If you don't have a working webhook to automate the build process, it can also be started manually:
oc start-build pillar-base
Get more control of your container rollout and update processes by selecting appropriate deployment strategies for your fleet of managed containers
Courtesy of Red Hat:
these slides: bit.ly/sig-apps-openshift