Applications Deployment
Templates
- Applications can be deployed by using templates
- To get what are the resources that will be created with the template:
oc process -f mysql-template.yaml -o yaml
- Parameters can be used to customise the deployment of templates. To list all the parameters available in a template:
oc process -f mysql-template.yaml --parameters
- To create a deployment based off a template:
oc new-app --template mysql-template
- To create a deployment based off a template with parameter:
oc new-app --template mysql-template --params MYSQL_USER=admin
Deployment
- Declarative deployment of applications
oc create -f my-app-deployment.yaml
oc new-app --file=./my-app-deployment.yaml
Set Deployment Environment Variables
oc set env deployment/my-db MYSQL_USERNAME=mysql MYSQL_DATABASE=sampledb
Source to Image Deployment
- Source can be a git repository
- During source to image deployment, a golden image (the image which the source will be building upon), and context directory need to be defined
- Deployment with git source
oc new-app --name=hello https://github.com/xxx -i php:7.4-ubi8 --context-dir php-helloworld
- A new
BuildConfig
will be created to build the image. ABuild
resource will be created for the actual building of image. A pod will also be created for the building. - Once the image build is completed, it will be pushed to a
ImageStream