A deployment is used to manage the pods that are created to run an application. The deployment ensures that the desired number of pod replicas are running and can handle updates to the application by rolling out new versions of the pods. The deployment creates and manages a replica set, which in turn manages the pods.
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end end Deployment -->|Creates/Manages| Replica_Set Replica_Set -->|Manages| Pod1 Replica_Set -->|Manages| Pod2 Replica_Set -->|Manages| Pod3 style Deployment fill:#90CAF9 style Replica_Set fill:#FFE082 style Pods fill:#FFCCBC
It is also noteworthy that a route provides a URL that can be used to access the application from outside the OpenShift cluster. For example, if the route is configured to use the hostname myapp.mydomain.com, then users can access the application by navigating to http://myapp.mydomain.com. The route will forward the request to the service, which will then forward the request to one of the pods that are running the application.
Container] Pod2[Pod 2
Container] Pod3[Pod 3
Container] end SVC[Service] Route[Route] end USER[External User] --> Route --> SVC SVC --> Pod1 SVC --> Pod2 SVC --> Pod3 style SVC fill:#A5D6A7 style Pods fill:#FFCCBC style USER fill:#CE93D8
There are various ways to deploy an app.
- From GitHub (https://github.com)
- From Docker Hub (https://hub.docker.com)
- From an image
- From an image stream
- From a build
- From a template
- From a JSON or YAML file (templates)
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
Before importing an image, the oc get images command can be used to determine if the image has already been imported.
~]# oc get images
NAME IAMGE REFERENCE
sha256:0089883f8e4387618946cd24378a447b8cf7e5dfaa146b94acab27fc5e170a14 registry.example.com/jboss-webserver-3/webserver30-tomcat8-openshift@sha256:0089883f8e4387618946cd24378a447b8cf7e5dfaa146b94acab27fc5e170a14
sha256:0155e28b6b10d6fba7144df9ce33105acbab32766836baacc67c76b900a58772 registry.example.com/redhat-sso-7/sso70-openshift@sha256:0155e28b6b10d6fba7144df9ce33105acbab32766836baacc67c76b900a58772
sha256:03416282b034b93614ab2af74441ce481226bcf0b0b6c614cacd1b6f008f9792 registry.example.com/jboss-eap-6/eap64-openshift@sha256:03416282b034b93614ab2af74441ce481226bcf0b0b6c614cacd1b6f008f9792
sha256:03795eb1e54f94ffb822b8b3997b5f5bbeaa20bdf1234567890128d1eb58054b registry.example.com/rhpam-7/rhpam72-businesscentral-openshift@sha256:03795eb1e54f94ffb822b8b3997b5f5bbeaa20bdf1234567890128d1eb58054b
The oc new-build command can be used to import an image from an external registry, such as GitHub. In this example, an image named camel-app is imported.
~]$ oc new-build fabric8/s2i-java~https://github.com/monodot/simple-camel-spring-boot-app --name=camel-app
--> Found container image ec41b73 (20 months old) from Docker Hub for "fabric8/s2i-java"
Java Applications
-----------------
Platform for building and running plain Java applications (fat-jar and flat classpath)
Tags: builder, java
* An image stream tag will be created as "s2i-java:latest" that will track the source image
* A source build using source code from https://github.com/monodot/simple-camel-spring-boot-app will be created
* The resulting image will be pushed to image stream tag "my-demo-app:latest"
* Every time "s2i-java:latest" changes a new build will be triggered
--> Creating resources with label build=camel-app ...
imagestream.image.openshift.io "s2i-java" created
imagestream.image.openshift.io "camel-app" created
buildconfig.build.openshift.io "camel-app" created
--> Success
The oc get builds command can then be used to determine if the build is running.
~]$ oc get builds
NAME TYPE FROM STATUS STARTED DURATION
camel-app-1 Source Git Running 2 minutes ago
And the oc get imagestreams command should return something like this.
~]$ oc get is | grep -i demo
camel-app image-registry.openshift-image-registry.svc:5000/foo/camel-app
Did you find this article helpful?
If so, consider buying me a coffee over at 