kubectl

kubectl [command] [TYPE] [NAME] [flags]
  • command

    • create
    • get
    • delete
    • describe
  • TYPE (to specify resource types)

    kubectl get pod pod1
    kubectl get pods pod1
    kubectl get po pod1
  • NAME (to specify resource name, if not specified, list all the resources)
    image.png

Generate a yaml

  • kubectl create

    # Generate a yaml but not actually create the deployment
    kubectl create deployment DeployTest --image=nginx -o yaml --dry-run
    
    kubectl create deployment DeployTest --image=nginx -o yaml --dry-run > m1.yaml
  • kubectl get
    Export a yaml from a deployed application
    image.png