- In Kubernetes, the smallest unit that you can deploy is a Pod which is one or more Docker containers that are grouped together.
- Usually, it's a single Docker container within a pod.
- For scaling and high availability, we need multiple instances of our application running. So we use Replication Controller to create replicas of pods.
- Replication Controller ensures that the required number of replicas are running at all times.
- A Deployment builds on replication controller with additional support for Application Lifecycle Management such as seamless upgrades, rollbacks, application revisioning, etc.
- As in previous web application, you can see its deployment configuration
Image indicates the docker image which is built from the Build configuration
Replicas indicates number of replica
Strategy indicates the deployment strategy. Rolling means the deployment will update the replicas one at a time
- In Triggers section shows when the deployment is triggered i.e.:
- When the Docker image changes, when the Build job runs
- When the deployment configuration changes
- The YAML file looks very similar to a deployment configuration in Kubernetes but they are not the same.
kind is DeploymentConfig instead of Deployment
apiVersion is specific to OpenShift
- The remaining sections are similar such as the specification, replicas, strategy, and template.
- image: >-
- containerPort: 8080
- type: ConfigChange
- Simply select previous deployment, and click
- By default, deployment strategy is Rolling Update
- Blue/Green deployment lets you test the green version first before switching the routing from all the users to them.
- A/B deployment lets you split the traffic to both blue and green versions and gradually increase to the new version until fully upgraded.
oc rollout latest dc/simple-webapp-docker
oc rollout history dc/simple-webapp-docker
oc rollout describe dc simple-webapp-docker
oc rollout undo dc/simple-webapp-docker
- From the previous
simple-webapp-docker application that we already build the Docker image.
- We will create a deployment for that by copying and modifying the YAML file from this documentation page.
- And add this YAML file to our project to create a new deployment.
- name: "simple-webapp-docker"
- containerPort: 8080
- type: "ConfigChange"
- type: "ImageChange"