Skip to content

Latest commit

 

History

History
172 lines (116 loc) · 3.24 KB

14-Practice-Tests-ReplicaSet.md

File metadata and controls

172 lines (116 loc) · 3.24 KB

Practice Test - ReplicaSets

Solutions for the replicaset practice tests

  1. Run the command kubectl get pods and count the number of pods.

    $ kubectl get pods
    
  2. Run the command kubectl get replicaset and count the number of replicasets.

    $ kubectl get rs
    
  3. Run the command kubectl get replicaset

    $ kubectl get rs
    
  4. Run the command kubectl get replicaset and look at the count under the Desired column

    $ kubectl get rs
    
  5. Run the command kubectl describe replicaset and look under the containers section.

    $ kubectl describe replicaset (or)
    $ kubectl get rs -o wide
    
  6. Run the command kubectl get replicaset and look at the count under the Ready column

    $ kubectl get repplicaset
    
  7. Run the command kubectl describe pods and look under the events section.

    $ kubectl describe pods
    
  8. Run the command kubectl delete pod <podname>

    $ kubectl delete pod new-replica-set-XXXX
    
  9. Run the command kubectl get pods and count the number of PODs

    $ kubectl get pods
    
  10. ReplicaSets ensures that desired number of PODs always run

  11. The value for apiVersion is incorrect. Find the correct apiVersion for ReplicaSet.

    Get the apiVersion for replicaset

    $ kubectl explain replicaset|grep VERSION
    

    Update the replicaset definition file with correct version and create a replicaset

    $ kubectl create -f replicaset-definition-1.yaml
    
  12. The values for labels on lines 9 and 13 should match.

    Selector matchLabels should match with POD labels - Update the replicaset-definition-2.yaml
    $ kubectl create -f replicaset-definition-2.yaml
    
  13. Run the command kubectl delete replicaset

    $ kubectl delete replicaset replicaset-1
    $ kubectl delete rs replicaset-2
    
  14. Run the command kubectl edit replicaset new-replica-set, modify the image name to busybox and then save the file.

    $ kubectl edit replicaset new-replica-set
    
  15. Run the command kubectl edit replicaset new-replica-set, modify the replicas and then save the file.

    $ kubectl edit replicaset new-replica-set
    

    Another way

    $ kubectl scale --replicas=5 replicaset new-replica-set
    
  16. Run the command kubectl edit replicaset new-replica-set, modify the replicas and then save the file.

    $ kubectl edit replicaset new-replica-set
    

    Another way

    $ kubectl scale --replicas=2 replicaset new-replica-set