9.9.2 Deploy a container image
This section covers deploying a container image to OpenShift.
Task 9.9.2.2: Deploy a container image
As you know from other techlabs, an easy way to create applications in OpenShift is using oc new-app
Let’s create an application for the go-hello-world image that we built before.
oc new-app appuio/go-hello-world --as-deployment-config
Since OpenShift 4.5
oc new-app
creates a Deployment not a DeploymentConfig. We let it create a DeploymentConfig by adding the --as-deployment-config
flag.--> Found container image 5779c56 (11 days old) from for "appuio/go-hello-world:latest"
* This image will be deployed in deployment config "go-hello-world"
* Port 8080/tcp will be load balanced by service "go-hello-world"
* Other containers can access this service through the hostname "go-hello-world"
--> Creating resources ...
deploymentconfig.apps.openshift.io "go-hello-world" created
service "go-hello-world" created
--> Success
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose svc/go-hello-world'
Run 'oc status' to view your app.
To access the application from outside OpenShift, a route is needed:
oc create route edge --service=go-hello-world --insecure-policy=Redirect
Run the following command to determine the host of the newly created route.
oc get routes.route.openshift.io go-hello-world -o template --template '{{.spec.host}}{{"\n"}}'
go-hello-world-<username>.techlab.openshift.ch
Now you can test the go-hello-world application over the route.
Last modified April 23, 2024: Merge d34c5926ff16b8bc9f7b32ff13bf99099b781bae into c5b829fcdb844bd0ad3db1d881bbfad357cc0e73 (afbe5bd)