⬅️ Back to Kubernetes overview
Create a deployment with httpd
oc create deployment --image=ubi8/httpd-24 httpd So what is the difference? There is still a pod, but with a weird name
oc get pod
oc describe pod httpd-7769f8f85b-5wcxt # replace the pod name with yours!Pod is "Controlled By" a ReplicaSet
oc get replicaset
oc describe replicaset httpd-7769f8f85b # replace the replicaset name with yours!ReplicaSet is "Controlled By" the Deployment we've just created
oc get deployment
oc describe deployment httpd # this is the name we explicitly supplied during creation of the deploymentLabels are properties attached to each object. Selectors filter these items and can help you typing or even remembering the automatically generated resource names.
oc get pods --selector app=httpd
# the short version:
oc get pods -l app=httpdLet's scale the deployment to more instances and watch what happens
oc get pods --watch --output wide
oc scale deployment httpd --replicas=2See the new pods? What happens if we delete an existing pod?
oc delete pod -l "app=httpd"To see some more results in the rollout handling afterwards, we are changing the image to an older version.
oc set image deployment httpd httpd-24=ubi8/httpd-24:1-340Check current pods
oc get podsDelete the created resources
oc delete deployment httpd- Create a new deployment with the Apache Webserver (httpd) and two replicas.
- Change the version and apply the new deployment, monitor the pod, resource & deployment resources.
- Restore the previous version of the deployment