Add a k8s cheat sheet to trooper docs
No-Try: true Docs-Preview: https://skia.org/?cl=190201 Bug: skia: Change-Id: Idd7d1838a648e1e73d76720dc07bd425ff7929a3 Reviewed-on: https://skia-review.googlesource.com/c/190201 Reviewed-by: Joe Gregorio <jcgregorio@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
c877ea2657
commit
9590f86e89
@ -62,3 +62,34 @@ Tips for troopers
|
||||
|
||||
- Read over the [Skolo maintenance doc](https://docs.google.com/document/d/1zTR1YtrIFBo-fRWgbUgvJNVJ-s_4_sNjTrHIoX2vulo/edit) for more detail on
|
||||
dealing with device alerts.
|
||||
|
||||
### Kubernetes cheat sheet ###
|
||||
|
||||
Much of the infrastructure runs on Kubernetes (aka k8s). Here are some handy commands:
|
||||
|
||||
# Show possibly problematic pods (i.e. non Running pods)
|
||||
# Look for pods that have been Pending or Terminating a long time
|
||||
kubectl get pods | grep -v Running
|
||||
|
||||
# Get pods by label (or without label)
|
||||
# (see https://skia-review.googlesource.com/c/skia-public-config/+/189960 for
|
||||
# how to implement this on other services)
|
||||
kubectl get pods -lappgroup=perf
|
||||
kubectl get pods -l 'appgroup notin (fiddle)'
|
||||
|
||||
# Get pods grouped by the nodes (i.e. VM) they run on
|
||||
kubectl get pods -o wide --sort-by="{.spec.nodeName}"
|
||||
|
||||
# Get and follow the logs for a pod
|
||||
kubectl logs -f [pod]
|
||||
|
||||
# Get a lot of info for a pod
|
||||
kubectl describe pod [pod]
|
||||
|
||||
# "SSH into" a running pod and poke around (might need /bin/sh instead of bash)
|
||||
kubectl exec -it [pod] /bin/bash
|
||||
|
||||
# delete pods matching a grep e.g. "Terminat"
|
||||
kubectl get pods | grep [search] | awk '{print $1}' | xargs -L 1 kubectl delete pod
|
||||
# delete pods and you really mean it
|
||||
kubectl get pods | grep [search] | awk '{print $1}' | xargs -L 1 kubectl delete pod --force --grace-period=0
|
Loading…
Reference in New Issue
Block a user