{
  "version": 1,
  "collections": [
    {
      "id": "45146376-6431-58da-8525-8b04022f8e97",
      "name": "kubectl",
      "color": "#326ce5"
    }
  ],
  "snippets": [
    {
      "id": "e5b13c65-dd08-5158-978e-1a3cf9086180",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Show the current context",
      "body": "kubectl config current-context",
      "description": "",
      "tags": [
        "context"
      ]
    },
    {
      "id": "a75d554e-ba99-59f7-892c-7077a97e1cb5",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "List contexts",
      "body": "kubectl config get-contexts",
      "description": "",
      "tags": [
        "context"
      ]
    },
    {
      "id": "97942769-1568-5e40-87a4-3cd335c1fb90",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Switch context",
      "body": "kubectl config use-context {{context}}",
      "description": "",
      "tags": [
        "context"
      ]
    },
    {
      "id": "9b7d43f6-9368-5aa4-9847-05cbd443e2f5",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Set the default namespace",
      "body": "kubectl config set-context --current --namespace={{namespace}}",
      "description": "",
      "tags": [
        "context"
      ]
    },
    {
      "id": "efcee7b4-48c9-5e56-8422-f85f0d02c8e1",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Pods with their nodes and IPs",
      "body": "kubectl get pods -n {{namespace:default}} -o wide",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "ec80f63b-d212-5cef-90de-718672c94e7a",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Pods in every namespace",
      "body": "kubectl get pods -A",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "ccb7d701-6c4d-535c-8d00-79875a7920d2",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Watch pods change",
      "body": "kubectl get pods -n {{namespace:default}} -w",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "fc7e8dd9-b0f8-508b-b5d0-3184f0cec0ab",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Pods with a label",
      "body": "kubectl get pods -n {{namespace:default}} -l {{label}}",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "12336cb3-8d98-50bf-9c06-dc92db4e33a3",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Describe a resource",
      "body": "kubectl describe {{kind:pod|deployment|service|node}} {{name}} -n {{namespace:default}}",
      "description": "The Events at the bottom usually say why something isn’t starting.",
      "tags": [
        "get"
      ]
    },
    {
      "id": "ca52b4e3-8532-53de-ada2-9c3083a10b92",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Get a resource as YAML",
      "body": "kubectl get {{kind:deployment|service|configmap|pod}} {{name}} -n {{namespace:default}} -o yaml",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "d9fb8c07-dd97-5567-994f-bcc27f0add3b",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Recent events, newest last",
      "body": "kubectl get events -n {{namespace:default}} --sort-by=.lastTimestamp",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "510256c4-c4e2-5d58-bd7d-2a3d20b9daff",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Explain a field",
      "body": "kubectl explain {{field:deployment.spec.strategy}}",
      "description": "",
      "tags": [
        "get"
      ]
    },
    {
      "id": "f3bb61e2-4e30-580f-8017-663f44720a34",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Tail logs for a deployment",
      "body": "kubectl logs -f deployment/{{deployment}} -n {{namespace:default}} --since={{since:10m}}",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "2042d9d3-cbe8-5fe4-9e80-d021def1fa23",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Logs from before a crash",
      "body": "kubectl logs {{pod}} -n {{namespace:default}} --previous",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "efbecaec-88a5-5a45-a3a8-d4a86bc82b7f",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Logs from one container",
      "body": "kubectl logs {{pod}} -c {{container}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "a051267d-64ad-5692-b7fe-82722275b97d",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Shell into a pod",
      "body": "kubectl exec -it {{pod}} -n {{namespace:default}} -- {{shell:sh|bash}}",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "293b19f9-a76e-5f25-97f8-a3de6170f09a",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Port-forward a service",
      "body": "kubectl port-forward svc/{{service}} {{local_port:8080}}:{{remote_port:80}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "77d1a523-e4c4-56ba-8c22-b9ae90d7971c",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Throwaway debug pod",
      "body": "kubectl run debug --rm -it --image={{image:busybox}} --restart=Never -n {{namespace:default}} -- sh",
      "description": "Handy for testing DNS and connectivity from inside the cluster.",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "34cae0fd-2ade-5efd-ac48-2cb7941106c8",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "CPU and memory by pod",
      "body": "kubectl top pods -n {{namespace:default}} --sort-by={{by:cpu|memory}}",
      "description": "Needs metrics-server in the cluster.",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "e614cfc2-d66f-56c8-875d-7cca8f2e54d0",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Copy a file out of a pod",
      "body": "kubectl cp {{namespace:default}}/{{pod}}:{{path}} {{dest:.}}",
      "description": "",
      "tags": [
        "debug"
      ]
    },
    {
      "id": "84546d55-d698-5db1-b7d0-4ef61e2bd56e",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "See what apply would change",
      "body": "kubectl diff -f {{file}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "9f546525-1c5a-5428-9394-0309e8ca240e",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Apply a file",
      "body": "kubectl apply -f {{file}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "186b080a-b344-582f-9af5-b7496368c35e",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Scale a deployment",
      "body": "kubectl scale deployment/{{deployment}} --replicas={{replicas:3}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "c5c02802-49a7-512e-929d-4d6f81e5afaa",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Restart a deployment",
      "body": "kubectl rollout restart deployment/{{deployment}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "6bb48c2c-5ffd-5ac6-b805-6b7d2f611f52",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Watch a rollout",
      "body": "kubectl rollout status deployment/{{deployment}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "5a0c8004-72f5-554e-9a86-d4e5b4ed5abd",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Roll back a deployment",
      "body": "kubectl rollout undo deployment/{{deployment}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "1ed4df6f-dcae-56d1-9601-501ecc18cc14",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Change a container’s image",
      "body": "kubectl set image deployment/{{deployment}} {{container}}={{image}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "2a777710-1f99-5280-b9c1-0b4f9ddb6830",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Delete a resource",
      "body": "kubectl delete {{kind:pod|deployment|service|job}} {{name}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "deployments"
      ]
    },
    {
      "id": "bfdb713b-38e8-5875-aacb-4cbf7afeabc2",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Create a secret",
      "body": "kubectl create secret generic {{name}} --from-literal={{key}}={{value}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "secrets"
      ]
    },
    {
      "id": "730f1f4b-89d4-5e6a-871f-3f3f9e31b682",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Read a secret’s value",
      "body": "kubectl get secret {{name}} -n {{namespace:default}} -o jsonpath='{.data.{{key}}}' | base64 --decode",
      "description": "",
      "tags": [
        "secrets"
      ]
    },
    {
      "id": "c66ac2c5-3368-5856-947c-194381984387",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Create a ConfigMap from a file",
      "body": "kubectl create configmap {{name}} --from-file={{file}} -n {{namespace:default}}",
      "description": "",
      "tags": [
        "secrets"
      ]
    },
    {
      "id": "a2de22eb-eac2-5c27-babd-073fdbf1dac7",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "List nodes",
      "body": "kubectl get nodes -o wide",
      "description": "",
      "tags": [
        "nodes"
      ]
    },
    {
      "id": "7a17304a-0e77-5bb8-b876-d4dd756e2b87",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Drain a node for maintenance",
      "body": "kubectl drain {{node}} --ignore-daemonsets --delete-emptydir-data",
      "description": "",
      "tags": [
        "nodes"
      ]
    },
    {
      "id": "87075c0e-28c8-578f-9554-efc9c69bf0ff",
      "collectionId": "45146376-6431-58da-8525-8b04022f8e97",
      "title": "Put a node back in service",
      "body": "kubectl uncordon {{node}}",
      "description": "",
      "tags": [
        "nodes"
      ]
    }
  ]
}
