- Take me to Practice Test
Solutions to the deployments practice test
-
How many pods exist on the system?
kubectl get pods
Count the number of pods (if any)
-
How many ReplicaSets exist on the system?
kubectl get replicasets
Count the number of ReplicaSets (if any)
-
How many Deployments exist on the system?
kubectl get deployments
Count the number of Deployments (if any)
-
How many Deployments exist on the system now?
kubectl get deployments
Count the number of Deployments (if any)
-
How many ReplicaSets exist on the system now?
kubectl get replicasets
Count the number of ReplicaSets (if any)
-
How many Pods exist on the system?
kubectl get pods
Count 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
READY
column -
What is the image used to create the pods in the new deployment?
kubectl describe deployment
Look under the containers section.
Another way - run the following and check the
IMAGES
columnkubectl get deployment -o wide
-
Why do you think the deployment is not ready?
kubectl describe pods
Look 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.yaml
Note the error
Edit the file with
vi
...The value for
kind
is incorrect. It should beDeployment
with 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.yaml
with 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: httpd
kubectl create -f my-deployment.yaml
Or we could create it imperatively...
kubectl create deployment httpd-frontend --image=httpd:2.4-alpine --replicas=3