
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.
Replicas is the number of pods that should be created for the deployment.
When deploying an application using the oc new-app command, if the --as-deployment-config flag is not used, the application will be created as a deployment, not a deployment config. In this scenario, a replica set will be used to create the pods.
If the --as-deployment-config flag is used, the application will be created as a deployment config. In this scenario, a replication controller will be used to create the pods.
The oc get deploymentconfigs command can be used to view the applications that have been deployed using the --as-deployment-config flag.
~]$ oc get deploymentconfigs
NAME REVISION DESIRED CURRENT TRIGGERED BY
my-app 1 1 1 config,image(my-app:latest)
The oc get replicationcontrollers (or oc get rc) command can be used to list the replication controllers. In this example, the deployment config has 1 replica which means that 1 pod should be created for the deployment.
~]$ oc get rc
NAME DESIRED CURRENT READY AGE
my-app-1 1 1 1 42s
Here is a sample YAML that could be used to create a replication controller.
apiVersion: v1
kind: ReplicationController
metadata:
name: my-replication-controller
namespace: my-project
spec:
replicas: 2
selector:
app: my-app
template:
metadata:
name: my-app
labels:
app: my-app
spec:
containers:
- name: my-app
image: >-
image-registry.openshift-image-registry.svc:5000/openshift/my-app:latest
ports:
- containerPort: 8080
The oc get pods command can be used to display the pods. In this example, as expected, one pod was created for the deployment config.
~]# oc get pods
NAME READY STATUS RESTARTS AGE
my-app-5b9879db6d-9mzm2 1/1 Running 0 8d
Did you find this article helpful?
If so, consider buying me a coffee over at