Practice Test - Deployments
- Take me to Practice Test
Solutions to the deployments practice test
-
How many pods exist on the system?
kubectl get podsCount the number of pods (if any)
-
How many ReplicaSets exist on the system?
kubectl get replicasetsCount the number of ReplicaSets (if any)
-
How many Deployments exist on the system?
kubectl get deploymentsCount the number of Deployments (if any)
-
How many Deployments exist on the system now?
kubectl get deploymentsCount the number of Deployments (if any)
-
How many ReplicaSets exist on the system now?
kubectl get replicasetsCount the number of ReplicaSets (if any)
-
How many Pods exist on the system?
kubectl get podsCount the number of pods (if any)
-
Out of all the existing PODs, how many are ready?
From the output of the previous command, check the
READYcolumn -
What is the image used to create the pods in the new deployment?
kubectl describe deploymentLook under the containers section.
Another way - run the following and check the
IMAGEScolumnkubectl get deployment -o wide -
Why do you think the deployment is not ready?
kubectl describe podsLook under the events section.
-
Create a new Deployment using the deployment-definition-1.yaml file located at /root/.
There is an issue with the file, so try to fix it.kubectl create -f deployment-definition-1.yamlNote the error
Edit the file with
vi…The value for
kindis incorrect. It should beDeploymentwith a capitalD. Update the deployment definition and create the deployment with the above command. -
Create a new Deployment with the below attributes using your own deployment definition file.
Create a deployment definition file in
vi, e.g.my-deployment.yamlwith the followingapiVersion: apps/v1 kind: Deployment metadata: labels: app: httpd-frontend name: httpd-frontend spec: replicas: 3 selector: matchLabels: app: httpd-frontend template: metadata: labels: app: httpd-frontend spec: containers: - image: httpd:2.4-alpine name: httpdkubectl create -f my-deployment.yamlOr we could create it imperatively…
kubectl create deployment httpd-frontend --image=httpd:2.4-alpine --replicas=3