Skip to content

Latest commit

 

History

History
80 lines (51 loc) · 1.71 KB

04-Practice-Test-Advance-Kubectl-Commands.md

File metadata and controls

80 lines (51 loc) · 1.71 KB

Practice Test for Advance Kubectl Commands

Solution

  1. Check Solution

    kubectl get nodes -o json > /opt/outputs/nodes.json
    
  2. Check Solution

    kubectl get node node01 -o json > /opt/outputs/node01.json
    
  3. Check Solution

    kubectl get nodes -o=jsonpath='{.items[*].metadata.name}' > /opt/outputs/node_names.txt
    
  4. Check Solution

    kubectl get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}' > /opt/outputs/nodes_os.txt
    
  5. Check Solution

    kubectl config view --kubeconfig=my-kube-config -o jsonpath="{.users[*].name}" > /opt/outputs/users.txt
    
  6. Check Solution

    kubectl get pv --sort-by=.spec.capacity.storage > /opt/outputs/storage-capacity-sorted.txt
    
  7. Check Solution

    kubectl get pv --sort-by=.spec.capacity.storage -o=custom-columns=NAME:.metadata.name,CAPACITY:.spec.capacity.storage > /opt/outputs/pv-and-capacity-sorted.txt
    
  8. Check Solution

    kubectl config view --kubeconfig=my-kube-config -o jsonpath="{.contexts[?(@.context.user=='aws-user')].name}" > /opt/outputs/aws-context-name