Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 1.96 KB

23-Practice-Test-Imperative-Commands.md

File metadata and controls

72 lines (52 loc) · 1.96 KB

Practice Test - Imperative Commands

Solutions for Practice Test - Imperative Commands

  1. Information

  2. Deploy a pod named nginx-pod using the nginx:alpine image.
    kubectl run nginx-pod --image=nginx:alpine
    
  3. Deploy a redis pod using the redis:alpine image with the labels set to tier=db.
    kubectl run redis --image=redis:alpine -l tier=db
    
  4. Create a service redis-service to expose the redis application within the cluster on port 6379.
    kubectl expose pod redis --port=6379 --name redis-service
    
  5. Create a deployment named webapp using the image kodekloud/webapp-color with 3 replicas.
    kubectl create deployment webapp --image=kodekloud/webapp-color --replicas=3
    
  6. Create a new pod called custom-nginx using the nginx image and expose it on container port 8080.
    kubectl run custom-nginx --image=nginx --port=8080
    
  7. Create a new namespace called dev-ns.
    kubectl create ns dev-ns
    
  8. Create a new deployment called redis-deploy in the dev-ns namespace with the redis image. It should have 2 replicas.
    kubectl create deployment redis-deploy -n dev-ns --image redis --replicas 2
    
  9. Create a pod called httpd using the image httpd:alpine in the default namespace.
    Next, create a service of type ClusterIP by the same name (httpd).
    The target port for the service should be 80.
    kubectl run httpd --image httpd:alpine --expose --port 80