Skip to content

Instantly share code, notes, and snippets.

@rduque1
Last active September 23, 2022 13:53
Show Gist options
  • Save rduque1/990f7fcade1a19205f23f13b0ac7e049 to your computer and use it in GitHub Desktop.
Save rduque1/990f7fcade1a19205f23f13b0ac7e049 to your computer and use it in GitHub Desktop.

Revisions

  1. rduque1 revised this gist Sep 20, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion kubernetes_cheat_sheet.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ describe pod -n <namespace> <pod-name>
    get node vmmts02 -ojsonpath='{.status.capacity.pods}{"\n"}'

    # scale a deployment
    kubectl scale -n bfc-app-analytics --replicas=1 deployment job-manager-deployment
    kubectl scale -n <namespace> --replicas=1 deployment <deployment-name>

    # list images
    k3s crictl images
  2. rduque1 created this gist Sep 20, 2022.
    20 changes: 20 additions & 0 deletions kubernetes_cheat_sheet.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    # get number of running pods
    kubectl get -A pods --field-selector=status.phase=Running --output json | jq -j '.items | length'

    # get number of NOT running pods
    kubectl get -A pods --field-selector=status.phase!=Running --output json | jq -j '.items | length'

    # find out why a pod is in pending
    describe pod -n <namespace> <pod-name>

    # get a node max number of pods
    get node vmmts02 -ojsonpath='{.status.capacity.pods}{"\n"}'

    # scale a deployment
    kubectl scale -n bfc-app-analytics --replicas=1 deployment job-manager-deployment

    # list images
    k3s crictl images

    # list containers
    k3s crictl ps