From 430a88ebc0467c41875c6b76fce91369e9d53ca9 Mon Sep 17 00:00:00 2001 From: NimbleArchitect <56797391+NimbleArchitect@users.noreply.github.com> Date: Fri, 5 Aug 2022 19:45:28 +0100 Subject: [PATCH] updated documentation for release 2.5 --- README.md | 221 +++++++++++++---------------- docs/examples.md | 351 ++++++++++++++++++++++------------------------- docs/usage.md | 26 ++++ 3 files changed, 289 insertions(+), 309 deletions(-) diff --git a/README.md b/README.md index 7c0d60a..4226cb9 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ ice lists detailed information about the containers present inside a * Use the show-namespace flag to output the pods namespace -[![asciicast](https://asciinema.org/a/501737.svg)](https://asciinema.org/a/504766) +[![asciicast](https://asciinema.org/a/512927.svg)](https://asciinema.org/a/512927) # Installation @@ -66,7 +66,7 @@ then copy ./bin/kubectl-ice to somewhere in your path and run ```kubectl-ice hel ## Usage if kubectl-ice is in your path you can replace the command ```kubectl-ice``` with ```kubectl ice``` (remove the dash) to make it feel more like a native kubectl command, this also works if you have kubectl set as an alias, for example - if k is aliased to kubectl you can type ```k ice subcommand``` instead of ```kubectl-ice subcommand``` + if k is aliased to kubectl you can type ```k ice status``` instead of ```kubectl-ice status``` The following commands are available for `kubectl-ice` @@ -92,16 +92,22 @@ ice also supports all the standard kubectl flags in addition to: ``` Flags: -A, --all-namespaces List containers from pods in all namespaces + --annotation string Show the selected annotation as a column -c, --container string Container name. If set shows only the named containers --context string The name of the kubeconfig context to use - --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows -n, --namespace string If present, the namespace scope for this CLI request + --node-label string Show the selected node label as a column + --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported + --pod-label string Show the selected pod label as a column --select string Filters pods based on their spec field, comma seperated list of FIELD OP VALUE, where OP can be one of ==, = and != -l, --selector string Selector (label query) to filter on --show-namespace Shows a column containing the pods namespace name for each container -t, --tree Display tree like view instead of the standard list --node-tree Displayes the tree with the nodes as the root + --show-node Show the node name column -T --show-type Show the container type column where: I = init container C = container @@ -132,11 +138,12 @@ Some examples are listed below but full [usage instructions](https://github.com/ Shows the currently used memory along with the configured memory requests and limits of all containers (side cars) in the pod named web-pod ``` shell $ kubectl-ice memory web-pod -CONTAINER USED REQUEST LIMIT %REQ %LIMIT -app-init 0 0 0 - - -app-watcher 5.25Mi 1M 512M 550.09 1.07 -app-broken 0 1M 512M - - -myapp 5.23Mi 1M 256M 548.45 2.14 +CONTAINER USED REQUEST LIMIT %REQ %LIMIT +app-init 0 0 0 - - +app-watcher 4.99Mi 1M 512M 523.06 1.02 +app-broken 0 1M 512M - - +myapp 4.98Mi 1M 256M 521.83 2.04 +debugger-k5znj 0 0 0 - - ``` ### Using labels @@ -144,12 +151,12 @@ using labels you can search all pods that are part of a deployment where the lab ``` shell $ kubectl-ice probes -l app=demoprobe PODNAME CONTAINER PROBE DELAY PERIOD TIMEOUT SUCCESS FAILURE CHECK ACTION -demo-probe-765fd4d8f7-7s5d7 web-frontend liveness 10 5 1 1 3 Exec /bin/true -demo-probe-765fd4d8f7-7s5d7 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health -demo-probe-765fd4d8f7-7s5d7 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ -demo-probe-765fd4d8f7-cqr6m web-frontend liveness 10 5 1 1 3 Exec /bin/true -demo-probe-765fd4d8f7-cqr6m web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health -demo-probe-765fd4d8f7-cqr6m nginx liveness 60 60 1 1 8 HTTPGet http://:80/ +demo-probe-765fd4d8f7-n6kc7 web-frontend liveness 10 5 1 1 3 Exec /bin/true +demo-probe-765fd4d8f7-n6kc7 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health +demo-probe-765fd4d8f7-n6kc7 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ +demo-probe-765fd4d8f7-x2zr6 web-frontend liveness 10 5 1 1 3 Exec /bin/true +demo-probe-765fd4d8f7-x2zr6 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health +demo-probe-765fd4d8f7-x2zr6 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ ``` ### Alternate status view @@ -157,120 +164,86 @@ the tree flag shows the containers and pods in a tree view, with values calculat ``` shell $ kubectl-ice status -l app=demoprobe --tree NAMESPACE NAME READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL AGE -ice Deployment/demo-probe true true 58 - - - - - -ice └─ReplicaSet/demo-probe-765fd4d8f7 true true 58 - - - - - -ice └─Pod/demo-probe-765fd4d8f7-7s5d7 true true 29 - - - - - -ice └─Container/nginx true true 0 Running - - - 45h -ice └─Container/web-frontend true true 29 Running - - - 16m -ice └─Pod/demo-probe-765fd4d8f7-cqr6m true true 29 - - - - - -ice └─Container/nginx true true 0 Running - - - 45h -ice └─Container/web-frontend true true 29 Running - - - 16m +ice Deployment/demo-probe true true 20 - - - - - +ice └─ReplicaSet/demo-probe-765fd4d8f7 true true 20 - - - - - +ice └─Pod/demo-probe-765fd4d8f7-n6kc7 true true 10 Running - - - 19h +ice └─Container/nginx true true 0 Running - - - 19h +ice └─Container/web-frontend true true 10 Running - - - 25m +ice └─Pod/demo-probe-765fd4d8f7-x2zr6 true true 10 Running - - - 19h +ice └─Container/nginx true true 0 Running - - - 19h +ice └─Container/web-frontend true true 10 Running - - - 25m ``` ### Pick and un-mix -Using the -A flag to search all namespaces we can exclude all init containers with the --match T!=I flag. The -T flag is optional and is provided to show the init container type is not in the output +Using the -A flag to search all namespaces we can exclude all standard containers with the --match T!=C flag. The -T flag is optional and is provided to show that only Init and Ephemeral containers are displayed ``` shell -$ kubectl-ice cpu -A -T --match T!=I -T NAMESPACE PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -C default web-pod app-watcher 5m 1m 1m 499.92 499.92 -C default web-pod app-broken 0m 1m 1m - - -C default web-pod myapp 5m 1m 1m 497.68 497.68 -C ice demo-memory-7ddb58cd5b-dzp5x web-frontend 993m 1m 1000m 99273.85 99.27 -C ice demo-memory-7ddb58cd5b-dzp5x nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-hxkbt web-frontend 997m 1m 1000m 99636.04 99.64 -C ice demo-memory-7ddb58cd5b-hxkbt nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-wn7tt web-frontend 997m 1m 1000m 99620.20 99.62 -C ice demo-memory-7ddb58cd5b-wn7tt nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-xq2t4 web-frontend 994m 1m 1000m 99331.01 99.33 -C ice demo-memory-7ddb58cd5b-xq2t4 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 -C ice demo-odd-cpu-5f947f9db4-4clnc nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-5z9w2 web-frontend 2m 1m 1000m 184.45 0.18 -C ice demo-odd-cpu-5f947f9db4-5z9w2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-62xjb web-frontend 3m 1m 1000m 235.40 0.24 -C ice demo-odd-cpu-5f947f9db4-62xjb nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-68f47 web-frontend 3m 1m 1000m 225.05 0.23 -C ice demo-odd-cpu-5f947f9db4-68f47 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-7hlxl web-frontend 3m 1m 1000m 223.38 0.22 -C ice demo-odd-cpu-5f947f9db4-7hlxl nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-7r5s2 web-frontend 3m 1m 1000m 232.54 0.23 -C ice demo-odd-cpu-5f947f9db4-7r5s2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-8qpl5 web-frontend 3m 1m 1000m 222.98 0.22 -C ice demo-odd-cpu-5f947f9db4-8qpl5 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-c5sv6 web-frontend 3m 1m 1000m 227.62 0.23 -C ice demo-odd-cpu-5f947f9db4-c5sv6 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-c7scd web-frontend 2m 1m 1000m 181.64 0.18 -C ice demo-odd-cpu-5f947f9db4-c7scd nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-d6qz6 web-frontend 3m 1m 1000m 224.07 0.22 -C ice demo-odd-cpu-5f947f9db4-d6qz6 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-jfwtd web-frontend 2m 1m 1000m 196.39 0.20 -C ice demo-odd-cpu-5f947f9db4-jfwtd nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-lkfs2 web-frontend 3m 1m 1000m 274.59 0.27 -C ice demo-odd-cpu-5f947f9db4-lkfs2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-q85pt web-frontend 2m 1m 1000m 181.88 0.18 -C ice demo-odd-cpu-5f947f9db4-q85pt nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-qdfnb web-frontend 3m 1m 1000m 209.83 0.21 -C ice demo-odd-cpu-5f947f9db4-qdfnb nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-tz4hj web-frontend 3m 1m 1000m 236.00 0.24 -C ice demo-odd-cpu-5f947f9db4-tz4hj nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-zsmwb web-frontend 3m 1m 1000m 204.67 0.20 -C ice demo-odd-cpu-5f947f9db4-zsmwb nginx 0m 1m 1000m - - -C ice demo-probe-765fd4d8f7-7s5d7 web-frontend 3m 125m 1000m 1.66 0.21 -C ice demo-probe-765fd4d8f7-7s5d7 nginx 0m 1m 1000m - - -C ice demo-probe-765fd4d8f7-cqr6m web-frontend 3m 125m 1000m 2.27 0.28 -C ice demo-probe-765fd4d8f7-cqr6m nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-2fnvf web-frontend 148m 125m 1000m 118.33 14.79 -C ice demo-random-cpu-55954b64b4-2fnvf nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-j5fgx web-frontend 306m 125m 1000m 244.62 30.58 -C ice demo-random-cpu-55954b64b4-j5fgx nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-kfc5q web-frontend 260m 125m 1000m 207.35 25.92 -C ice demo-random-cpu-55954b64b4-kfc5q nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-nd89h web-frontend 521m 125m 1000m 416.55 52.07 -C ice demo-random-cpu-55954b64b4-nd89h nginx 0m 1m 1000m - - -C ice web-pod app-watcher 5m 1m 1m 499.92 499.92 -C ice web-pod app-broken 0m 1m 1m - - -C ice web-pod myapp 5m 1m 1m 497.68 497.68 -C kube-system coredns-78fcd69978-qnjtj coredns 1m 100m 0m 0.93 - -C kube-system etcd-minikube etcd 9m 100m 0m 8.26 - -C kube-system kube-apiserver-minikube kube-apiserver 34m 250m 0m 13.22 - -C kube-system kube-controller-manager-minikube kube-controller-manager 7m 200m 0m 3.22 - -C kube-system kube-proxy-hdx8w kube-proxy 1m 0m 0m - - -C kube-system kube-scheduler-minikube kube-scheduler 2m 100m 0m 1.37 - -C kube-system metrics-server-77c99ccb96-kjq9s metrics-server 3m 100m 0m 2.40 - -C kube-system storage-provisioner storage-provisioner 1m 0m 0m - - +$ kubectl-ice cpu -A -T --match T!=C +T NAMESPACE PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT +I default web-pod app-init 0m 0m 0m - - +I ice demo-memory-7ddb58cd5b-5kf9g init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-csbds init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-d4zwp init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-pdm9c init-myservice 0m 1m 100m - - +I ice demo-odd-cpu-5f947f9db4-2g7p2 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-59jm6 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-6gzw7 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-6s97l init-myservice 0m 100m 100m - - +E ice demo-odd-cpu-5f947f9db4-6s97l debugger-vvz4z 0m 0m 0m - - +I ice demo-odd-cpu-5f947f9db4-86mb8 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-cwvdq init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-dcg8p init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-fhs8q init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-gzcrm init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-hf872 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-hft68 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-jp8fw init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-k2gtp init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-kj8s7 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-qtxp2 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-vg2d5 init-myservice 0m 100m 100m - - +I ice demo-random-cpu-55954b64b4-9t7m2 init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-km6bg init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-knc6n init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-vr4hg init-myservice 0m 120m 120m - - +I ice web-pod app-init 0m 0m 0m - - +E ice web-pod debugger-k5znj 0m 0m 0m - - ``` ### Filtered trees The tree view also allows us to use the --match flag to filter based on resource type (T column) so we include deployments only providing us with a nice total of memory used for each deployment ``` shell $ kubectl-ice mem -T --tree --match T==D -T NAMESPACE NAME USED REQUEST LIMIT %REQ %LIMIT -D ice Deployment/demo-memory 191.37Mi 11.44Mi 2334.59Mi 0.01 1.67 -D ice Deployment/demo-odd-cpu 119.67Mi 1556.40Mi 9338.38Mi 0.00 0.01 -D ice Deployment/demo-probe 6.43Mi 3.81Mi 976.56Mi 0.00 0.17 -D ice Deployment/demo-random-cpu 42.19Mi 389.10Mi 2334.59Mi 0.00 0.01 +T NAMESPACE NAME USED REQUEST LIMIT %REQ %LIMIT +D ice Deployment/demo-memory 328.13Mi 11.44Mi 2334.59Mi 0.01 2.87 +D ice Deployment/demo-odd-cpu 103.47Mi 1459.12Mi 8754.73Mi 0.00 0.01 +D ice Deployment/demo-random-cpu 15.69Mi 194.55Mi 1167.30Mi 0.00 0.01 +D ice Deployment/demo-odd-cpu 7.14Mi 97.27Mi 583.65Mi 0.00 0.01 +D ice Deployment/demo-probe 6.42Mi 3.81Mi 976.56Mi 0.00 0.17 +D ice Deployment/demo-random-cpu 21.33Mi 194.55Mi 1167.30Mi 0.00 0.01 ``` ### Status details using the details flag displays the timestamp and message columns ``` shell $ kubectl-ice status -l app=myapp --details -T PODNAME CONTAINER READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE -I web-pod app-init true - 0 Terminated Completed 0 0 2022-07-28 18:16:48 - -C web-pod app-broken false false 191 Waiting CrashLoopBackOff - - - back-off 5m0s restarting failed -C web-pod app-watcher true true 0 Running - - - 2022-07-28 18:17:07 - -C web-pod myapp true true 0 Running - - - 2022-07-28 18:17:32 - +T PODNAME CONTAINER READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE +I web-pod app-init true - 0 Terminated Completed 0 0 2022-08-04 19:00:53 - +C web-pod app-broken false false 68 Waiting CrashLoopBackOff - - - back-off 5m0s restarting failed +C web-pod app-watcher true true 0 Running - - - 2022-08-04 19:00:59 - +C web-pod myapp true true 0 Running - - - 2022-08-04 19:01:12 - +E web-pod debugger-k5znj false - 0 Terminated Completed 0 0 2022-08-04 19:02:59 - ``` ### Container status most commands work the same way including the status command which also lets you see which container(s) are causing the restarts and by using the optional --previous flag you can view the containers previous exit code ``` shell $ kubectl-ice status -l app=myapp --previous -PODNAME CONTAINER STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE -web-pod app-init - - - - - - -web-pod app-broken Terminated Error 1 0 2022-07-30 15:57:50 - -web-pod app-watcher - - - - - - -web-pod myapp - - - - - - +PODNAME CONTAINER STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE +web-pod app-init - - - - - - +web-pod app-broken Terminated Error 1 0 2022-08-05 13:59:58 - +web-pod app-watcher - - - - - - +web-pod myapp - - - - - - +web-pod debugger-k5znj - - - - - - ``` ### Advanced labels @@ -278,22 +251,22 @@ return cpu requests size and limits of each container where the pods have an app ``` shell $ kubectl-ice cpu -l "app in (useoddcpu)" -c web-frontend PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 -demo-odd-cpu-5f947f9db4-5z9w2 web-frontend 2m 1m 1000m 184.45 0.18 -demo-odd-cpu-5f947f9db4-62xjb web-frontend 3m 1m 1000m 235.40 0.24 -demo-odd-cpu-5f947f9db4-68f47 web-frontend 3m 1m 1000m 225.05 0.23 -demo-odd-cpu-5f947f9db4-7hlxl web-frontend 3m 1m 1000m 223.38 0.22 -demo-odd-cpu-5f947f9db4-7r5s2 web-frontend 3m 1m 1000m 232.54 0.23 -demo-odd-cpu-5f947f9db4-8qpl5 web-frontend 3m 1m 1000m 222.98 0.22 -demo-odd-cpu-5f947f9db4-c5sv6 web-frontend 3m 1m 1000m 227.62 0.23 -demo-odd-cpu-5f947f9db4-c7scd web-frontend 2m 1m 1000m 181.64 0.18 -demo-odd-cpu-5f947f9db4-d6qz6 web-frontend 3m 1m 1000m 224.07 0.22 -demo-odd-cpu-5f947f9db4-jfwtd web-frontend 2m 1m 1000m 196.39 0.20 -demo-odd-cpu-5f947f9db4-lkfs2 web-frontend 3m 1m 1000m 274.59 0.27 -demo-odd-cpu-5f947f9db4-q85pt web-frontend 2m 1m 1000m 181.88 0.18 -demo-odd-cpu-5f947f9db4-qdfnb web-frontend 3m 1m 1000m 209.83 0.21 -demo-odd-cpu-5f947f9db4-tz4hj web-frontend 3m 1m 1000m 236.00 0.24 -demo-odd-cpu-5f947f9db4-zsmwb web-frontend 3m 1m 1000m 204.67 0.20 +demo-odd-cpu-5f947f9db4-2g7p2 web-frontend 3m 1m 1000m 239.26 0.24 +demo-odd-cpu-5f947f9db4-59jm6 web-frontend 3m 1m 1000m 228.24 0.23 +demo-odd-cpu-5f947f9db4-6gzw7 web-frontend 137m 1m 1000m 13605.66 13.61 +demo-odd-cpu-5f947f9db4-6s97l web-frontend 3m 1m 1000m 242.12 0.24 +demo-odd-cpu-5f947f9db4-86mb8 web-frontend 3m 1m 1000m 236.35 0.24 +demo-odd-cpu-5f947f9db4-cwvdq web-frontend 135m 1m 1000m 13408.25 13.41 +demo-odd-cpu-5f947f9db4-dcg8p web-frontend 2m 1m 1000m 189.21 0.19 +demo-odd-cpu-5f947f9db4-fhs8q web-frontend 3m 1m 1000m 231.62 0.23 +demo-odd-cpu-5f947f9db4-gzcrm web-frontend 3m 1m 1000m 239.25 0.24 +demo-odd-cpu-5f947f9db4-hf872 web-frontend 2m 1m 1000m 196.35 0.20 +demo-odd-cpu-5f947f9db4-hft68 web-frontend 3m 1m 1000m 219.94 0.22 +demo-odd-cpu-5f947f9db4-jp8fw web-frontend 3m 1m 1000m 235.47 0.24 +demo-odd-cpu-5f947f9db4-k2gtp web-frontend 135m 1m 1000m 13417.88 13.42 +demo-odd-cpu-5f947f9db4-kj8s7 web-frontend 3m 1m 1000m 229.13 0.23 +demo-odd-cpu-5f947f9db4-qtxp2 web-frontend 3m 1m 1000m 262.48 0.26 +demo-odd-cpu-5f947f9db4-vg2d5 web-frontend 3m 1m 1000m 252.21 0.25 ``` ### Odditites and sorting @@ -301,7 +274,9 @@ given the listed output above the optional --oddities flag picks out the contain ``` shell $ kubectl-ice cpu -l "app in (useoddcpu)" -c web-frontend --oddities --sort '!%REQ' PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 +demo-odd-cpu-5f947f9db4-6gzw7 web-frontend 137m 1m 1000m 13605.66 13.61 +demo-odd-cpu-5f947f9db4-k2gtp web-frontend 135m 1m 1000m 13417.88 13.42 +demo-odd-cpu-5f947f9db4-cwvdq web-frontend 135m 1m 1000m 13408.25 13.41 ``` diff --git a/docs/examples.md b/docs/examples.md index 4a4104f..e18213e 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -2,11 +2,12 @@ Shows the currently used memory along with the configured memory requests and limits of all containers (side cars) in the pod named web-pod ``` shell $ kubectl-ice memory web-pod -CONTAINER USED REQUEST LIMIT %REQ %LIMIT -app-init 0 0 0 - - -app-watcher 5.25Mi 1M 512M 550.09 1.07 -app-broken 0 1M 512M - - -myapp 5.23Mi 1M 256M 548.45 2.14 +CONTAINER USED REQUEST LIMIT %REQ %LIMIT +app-init 0 0 0 - - +app-watcher 4.99Mi 1M 512M 523.06 1.02 +app-broken 0 1M 512M - - +myapp 4.98Mi 1M 256M 521.83 2.04 +debugger-k5znj 0 0 0 - - ``` ### Using labels @@ -14,12 +15,12 @@ using labels you can search all pods that are part of a deployment where the lab ``` shell $ kubectl-ice probes -l app=demoprobe PODNAME CONTAINER PROBE DELAY PERIOD TIMEOUT SUCCESS FAILURE CHECK ACTION -demo-probe-765fd4d8f7-7s5d7 web-frontend liveness 10 5 1 1 3 Exec /bin/true -demo-probe-765fd4d8f7-7s5d7 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health -demo-probe-765fd4d8f7-7s5d7 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ -demo-probe-765fd4d8f7-cqr6m web-frontend liveness 10 5 1 1 3 Exec /bin/true -demo-probe-765fd4d8f7-cqr6m web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health -demo-probe-765fd4d8f7-cqr6m nginx liveness 60 60 1 1 8 HTTPGet http://:80/ +demo-probe-765fd4d8f7-n6kc7 web-frontend liveness 10 5 1 1 3 Exec /bin/true +demo-probe-765fd4d8f7-n6kc7 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health +demo-probe-765fd4d8f7-n6kc7 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ +demo-probe-765fd4d8f7-x2zr6 web-frontend liveness 10 5 1 1 3 Exec /bin/true +demo-probe-765fd4d8f7-x2zr6 web-frontend readiness 5 5 1 1 3 Exec cat /tmp/health +demo-probe-765fd4d8f7-x2zr6 nginx liveness 60 60 1 1 8 HTTPGet http://:80/ ``` ### Named containers @@ -27,32 +28,32 @@ the optional container flag (-c) searchs all selected pods and lists only contai ``` shell $ kubectl-ice command -c web-frontend PODNAME CONTAINER COMMAND ARGUMENTS -demo-memory-7ddb58cd5b-dzp5x web-frontend python /myapp/halfmemapp.py - -demo-memory-7ddb58cd5b-hxkbt web-frontend python /myapp/halfmemapp.py - -demo-memory-7ddb58cd5b-wn7tt web-frontend python /myapp/halfmemapp.py - -demo-memory-7ddb58cd5b-xq2t4 web-frontend python /myapp/halfmemapp.py - -demo-odd-cpu-5f947f9db4-4clnc web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-5z9w2 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-62xjb web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-68f47 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-7hlxl web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-7r5s2 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-8qpl5 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-c5sv6 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-c7scd web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-d6qz6 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-jfwtd web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-lkfs2 web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-q85pt web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-qdfnb web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-tz4hj web-frontend python /myapp/oddcpuapp.py - -demo-odd-cpu-5f947f9db4-zsmwb web-frontend python /myapp/oddcpuapp.py - -demo-probe-765fd4d8f7-7s5d7 web-frontend sh -c touch /tmp/health; sleep 2000; exit 0 - -demo-probe-765fd4d8f7-cqr6m web-frontend sh -c touch /tmp/health; sleep 2000; exit 0 - -demo-random-cpu-55954b64b4-2fnvf web-frontend python /myapp/randomcpuapp.py - -demo-random-cpu-55954b64b4-j5fgx web-frontend python /myapp/randomcpuapp.py - -demo-random-cpu-55954b64b4-kfc5q web-frontend python /myapp/randomcpuapp.py - -demo-random-cpu-55954b64b4-nd89h web-frontend python /myapp/randomcpuapp.py - +demo-memory-7ddb58cd5b-5kf9g web-frontend python /myapp/halfmemapp.py - +demo-memory-7ddb58cd5b-csbds web-frontend python /myapp/halfmemapp.py - +demo-memory-7ddb58cd5b-d4zwp web-frontend python /myapp/halfmemapp.py - +demo-memory-7ddb58cd5b-pdm9c web-frontend python /myapp/halfmemapp.py - +demo-odd-cpu-5f947f9db4-2g7p2 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-59jm6 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-6gzw7 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-6s97l web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-86mb8 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-cwvdq web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-dcg8p web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-fhs8q web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-gzcrm web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-hf872 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-hft68 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-jp8fw web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-k2gtp web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-kj8s7 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-qtxp2 web-frontend python /myapp/oddcpuapp.py - +demo-odd-cpu-5f947f9db4-vg2d5 web-frontend python /myapp/oddcpuapp.py - +demo-probe-765fd4d8f7-n6kc7 web-frontend sh -c touch /tmp/health; sleep 2000; exit 0 - +demo-probe-765fd4d8f7-x2zr6 web-frontend sh -c touch /tmp/health; sleep 2000; exit 0 - +demo-random-cpu-55954b64b4-9t7m2 web-frontend python /myapp/randomcpuapp.py - +demo-random-cpu-55954b64b4-km6bg web-frontend python /myapp/randomcpuapp.py - +demo-random-cpu-55954b64b4-knc6n web-frontend python /myapp/randomcpuapp.py - +demo-random-cpu-55954b64b4-vr4hg web-frontend python /myapp/randomcpuapp.py - ``` ### Alternate status view @@ -60,98 +61,62 @@ the tree flag shows the containers and pods in a tree view, with values calculat ``` shell $ kubectl-ice status -l app=demoprobe --tree NAMESPACE NAME READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL AGE -ice Deployment/demo-probe true true 58 - - - - - -ice └─ReplicaSet/demo-probe-765fd4d8f7 true true 58 - - - - - -ice └─Pod/demo-probe-765fd4d8f7-7s5d7 true true 29 - - - - - -ice └─Container/nginx true true 0 Running - - - 45h -ice └─Container/web-frontend true true 29 Running - - - 16m -ice └─Pod/demo-probe-765fd4d8f7-cqr6m true true 29 - - - - - -ice └─Container/nginx true true 0 Running - - - 45h -ice └─Container/web-frontend true true 29 Running - - - 16m +ice Deployment/demo-probe true true 20 - - - - - +ice └─ReplicaSet/demo-probe-765fd4d8f7 true true 20 - - - - - +ice └─Pod/demo-probe-765fd4d8f7-n6kc7 true true 10 Running - - - 19h +ice └─Container/nginx true true 0 Running - - - 19h +ice └─Container/web-frontend true true 10 Running - - - 25m +ice └─Pod/demo-probe-765fd4d8f7-x2zr6 true true 10 Running - - - 19h +ice └─Container/nginx true true 0 Running - - - 19h +ice └─Container/web-frontend true true 10 Running - - - 25m ``` ### Pick and un-mix -Using the -A flag to search all namespaces we can exclude all init containers with the --match T!=I flag. The -T flag is optional and is provided to show the init container type is not in the output +Using the -A flag to search all namespaces we can exclude all standard containers with the --match T!=C flag. The -T flag is optional and is provided to show that only Init and Ephemeral containers are displayed ``` shell -$ kubectl-ice cpu -A -T --match T!=I -T NAMESPACE PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -C default web-pod app-watcher 5m 1m 1m 499.92 499.92 -C default web-pod app-broken 0m 1m 1m - - -C default web-pod myapp 5m 1m 1m 497.68 497.68 -C ice demo-memory-7ddb58cd5b-dzp5x web-frontend 993m 1m 1000m 99273.85 99.27 -C ice demo-memory-7ddb58cd5b-dzp5x nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-hxkbt web-frontend 997m 1m 1000m 99636.04 99.64 -C ice demo-memory-7ddb58cd5b-hxkbt nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-wn7tt web-frontend 997m 1m 1000m 99620.20 99.62 -C ice demo-memory-7ddb58cd5b-wn7tt nginx 0m 1m 1000m - - -C ice demo-memory-7ddb58cd5b-xq2t4 web-frontend 994m 1m 1000m 99331.01 99.33 -C ice demo-memory-7ddb58cd5b-xq2t4 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 -C ice demo-odd-cpu-5f947f9db4-4clnc nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-5z9w2 web-frontend 2m 1m 1000m 184.45 0.18 -C ice demo-odd-cpu-5f947f9db4-5z9w2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-62xjb web-frontend 3m 1m 1000m 235.40 0.24 -C ice demo-odd-cpu-5f947f9db4-62xjb nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-68f47 web-frontend 3m 1m 1000m 225.05 0.23 -C ice demo-odd-cpu-5f947f9db4-68f47 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-7hlxl web-frontend 3m 1m 1000m 223.38 0.22 -C ice demo-odd-cpu-5f947f9db4-7hlxl nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-7r5s2 web-frontend 3m 1m 1000m 232.54 0.23 -C ice demo-odd-cpu-5f947f9db4-7r5s2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-8qpl5 web-frontend 3m 1m 1000m 222.98 0.22 -C ice demo-odd-cpu-5f947f9db4-8qpl5 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-c5sv6 web-frontend 3m 1m 1000m 227.62 0.23 -C ice demo-odd-cpu-5f947f9db4-c5sv6 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-c7scd web-frontend 2m 1m 1000m 181.64 0.18 -C ice demo-odd-cpu-5f947f9db4-c7scd nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-d6qz6 web-frontend 3m 1m 1000m 224.07 0.22 -C ice demo-odd-cpu-5f947f9db4-d6qz6 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-jfwtd web-frontend 2m 1m 1000m 196.39 0.20 -C ice demo-odd-cpu-5f947f9db4-jfwtd nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-lkfs2 web-frontend 3m 1m 1000m 274.59 0.27 -C ice demo-odd-cpu-5f947f9db4-lkfs2 nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-q85pt web-frontend 2m 1m 1000m 181.88 0.18 -C ice demo-odd-cpu-5f947f9db4-q85pt nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-qdfnb web-frontend 3m 1m 1000m 209.83 0.21 -C ice demo-odd-cpu-5f947f9db4-qdfnb nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-tz4hj web-frontend 3m 1m 1000m 236.00 0.24 -C ice demo-odd-cpu-5f947f9db4-tz4hj nginx 0m 1m 1000m - - -C ice demo-odd-cpu-5f947f9db4-zsmwb web-frontend 3m 1m 1000m 204.67 0.20 -C ice demo-odd-cpu-5f947f9db4-zsmwb nginx 0m 1m 1000m - - -C ice demo-probe-765fd4d8f7-7s5d7 web-frontend 3m 125m 1000m 1.66 0.21 -C ice demo-probe-765fd4d8f7-7s5d7 nginx 0m 1m 1000m - - -C ice demo-probe-765fd4d8f7-cqr6m web-frontend 3m 125m 1000m 2.27 0.28 -C ice demo-probe-765fd4d8f7-cqr6m nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-2fnvf web-frontend 148m 125m 1000m 118.33 14.79 -C ice demo-random-cpu-55954b64b4-2fnvf nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-j5fgx web-frontend 306m 125m 1000m 244.62 30.58 -C ice demo-random-cpu-55954b64b4-j5fgx nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-kfc5q web-frontend 260m 125m 1000m 207.35 25.92 -C ice demo-random-cpu-55954b64b4-kfc5q nginx 0m 1m 1000m - - -C ice demo-random-cpu-55954b64b4-nd89h web-frontend 521m 125m 1000m 416.55 52.07 -C ice demo-random-cpu-55954b64b4-nd89h nginx 0m 1m 1000m - - -C ice web-pod app-watcher 5m 1m 1m 499.92 499.92 -C ice web-pod app-broken 0m 1m 1m - - -C ice web-pod myapp 5m 1m 1m 497.68 497.68 -C kube-system coredns-78fcd69978-qnjtj coredns 1m 100m 0m 0.93 - -C kube-system etcd-minikube etcd 9m 100m 0m 8.26 - -C kube-system kube-apiserver-minikube kube-apiserver 34m 250m 0m 13.22 - -C kube-system kube-controller-manager-minikube kube-controller-manager 7m 200m 0m 3.22 - -C kube-system kube-proxy-hdx8w kube-proxy 1m 0m 0m - - -C kube-system kube-scheduler-minikube kube-scheduler 2m 100m 0m 1.37 - -C kube-system metrics-server-77c99ccb96-kjq9s metrics-server 3m 100m 0m 2.40 - -C kube-system storage-provisioner storage-provisioner 1m 0m 0m - - +$ kubectl-ice cpu -A -T --match T!=C +T NAMESPACE PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT +I default web-pod app-init 0m 0m 0m - - +I ice demo-memory-7ddb58cd5b-5kf9g init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-csbds init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-d4zwp init-myservice 0m 1m 100m - - +I ice demo-memory-7ddb58cd5b-pdm9c init-myservice 0m 1m 100m - - +I ice demo-odd-cpu-5f947f9db4-2g7p2 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-59jm6 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-6gzw7 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-6s97l init-myservice 0m 100m 100m - - +E ice demo-odd-cpu-5f947f9db4-6s97l debugger-vvz4z 0m 0m 0m - - +I ice demo-odd-cpu-5f947f9db4-86mb8 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-cwvdq init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-dcg8p init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-fhs8q init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-gzcrm init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-hf872 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-hft68 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-jp8fw init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-k2gtp init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-kj8s7 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-qtxp2 init-myservice 0m 100m 100m - - +I ice demo-odd-cpu-5f947f9db4-vg2d5 init-myservice 0m 100m 100m - - +I ice demo-random-cpu-55954b64b4-9t7m2 init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-km6bg init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-knc6n init-myservice 0m 120m 120m - - +I ice demo-random-cpu-55954b64b4-vr4hg init-myservice 0m 120m 120m - - +I ice web-pod app-init 0m 0m 0m - - +E ice web-pod debugger-k5znj 0m 0m 0m - - ``` ### Filtered trees The tree view also allows us to use the --match flag to filter based on resource type (T column) so we include deployments only providing us with a nice total of memory used for each deployment ``` shell $ kubectl-ice mem -T --tree --match T==D -T NAMESPACE NAME USED REQUEST LIMIT %REQ %LIMIT -D ice Deployment/demo-memory 191.37Mi 11.44Mi 2334.59Mi 0.01 1.67 -D ice Deployment/demo-odd-cpu 119.67Mi 1556.40Mi 9338.38Mi 0.00 0.01 -D ice Deployment/demo-probe 6.43Mi 3.81Mi 976.56Mi 0.00 0.17 -D ice Deployment/demo-random-cpu 42.19Mi 389.10Mi 2334.59Mi 0.00 0.01 +T NAMESPACE NAME USED REQUEST LIMIT %REQ %LIMIT +D ice Deployment/demo-memory 328.13Mi 11.44Mi 2334.59Mi 0.01 2.87 +D ice Deployment/demo-odd-cpu 103.47Mi 1459.12Mi 8754.73Mi 0.00 0.01 +D ice Deployment/demo-random-cpu 15.69Mi 194.55Mi 1167.30Mi 0.00 0.01 +D ice Deployment/demo-odd-cpu 7.14Mi 97.27Mi 583.65Mi 0.00 0.01 +D ice Deployment/demo-probe 6.42Mi 3.81Mi 976.56Mi 0.00 0.17 +D ice Deployment/demo-random-cpu 21.33Mi 194.55Mi 1167.30Mi 0.00 0.01 ``` ### Labels and containers @@ -159,32 +124,34 @@ you can also search specific pods and list all containers with a specific name, ``` shell $ kubectl-ice cpu -l app=userandomcpu -c web-frontend PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-random-cpu-55954b64b4-2fnvf web-frontend 148m 125m 1000m 118.33 14.79 -demo-random-cpu-55954b64b4-j5fgx web-frontend 306m 125m 1000m 244.62 30.58 -demo-random-cpu-55954b64b4-kfc5q web-frontend 260m 125m 1000m 207.35 25.92 -demo-random-cpu-55954b64b4-nd89h web-frontend 521m 125m 1000m 416.55 52.07 +demo-random-cpu-55954b64b4-9t7m2 web-frontend 569m 125m 1000m 454.43 56.80 +demo-random-cpu-55954b64b4-km6bg web-frontend 449m 125m 1000m 358.72 44.84 +demo-random-cpu-55954b64b4-knc6n web-frontend 206m 125m 1000m 164.19 20.52 +demo-random-cpu-55954b64b4-vr4hg web-frontend 456m 125m 1000m 364.08 45.51 ``` ### Status details using the details flag displays the timestamp and message columns ``` shell $ kubectl-ice status -l app=myapp --details -T PODNAME CONTAINER READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE -I web-pod app-init true - 0 Terminated Completed 0 0 2022-07-28 18:16:48 - -C web-pod app-broken false false 191 Waiting CrashLoopBackOff - - - back-off 5m0s restarting failed -C web-pod app-watcher true true 0 Running - - - 2022-07-28 18:17:07 - -C web-pod myapp true true 0 Running - - - 2022-07-28 18:17:32 - +T PODNAME CONTAINER READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE +I web-pod app-init true - 0 Terminated Completed 0 0 2022-08-04 19:00:53 - +C web-pod app-broken false false 68 Waiting CrashLoopBackOff - - - back-off 5m0s restarting failed +C web-pod app-watcher true true 0 Running - - - 2022-08-04 19:00:59 - +C web-pod myapp true true 0 Running - - - 2022-08-04 19:01:12 - +E web-pod debugger-k5znj false - 0 Terminated Completed 0 0 2022-08-04 19:02:59 - ``` ### Container status most commands work the same way including the status command which also lets you see which container(s) are causing the restarts and by using the optional --previous flag you can view the containers previous exit code ``` shell $ kubectl-ice status -l app=myapp --previous -PODNAME CONTAINER STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE -web-pod app-init - - - - - - -web-pod app-broken Terminated Error 1 0 2022-07-30 15:57:50 - -web-pod app-watcher - - - - - - -web-pod myapp - - - - - - +PODNAME CONTAINER STATE REASON EXIT-CODE SIGNAL TIMESTAMP MESSAGE +web-pod app-init - - - - - - +web-pod app-broken Terminated Error 1 0 2022-08-05 13:59:58 - +web-pod app-watcher - - - - - - +web-pod myapp - - - - - - +web-pod debugger-k5znj - - - - - - ``` ### Container images @@ -192,18 +159,18 @@ need to chack on the currently configured image versions use the image command ``` shell $ kubectl-ice image -l app=userandomcpu PODNAME CONTAINER PULL IMAGE -demo-random-cpu-55954b64b4-2fnvf init-myservice IfNotPresent busybox:1.28 -demo-random-cpu-55954b64b4-2fnvf web-frontend Always python:latest -demo-random-cpu-55954b64b4-2fnvf nginx IfNotPresent nginx:1.7.9 -demo-random-cpu-55954b64b4-j5fgx init-myservice IfNotPresent busybox:1.28 -demo-random-cpu-55954b64b4-j5fgx web-frontend Always python:latest -demo-random-cpu-55954b64b4-j5fgx nginx IfNotPresent nginx:1.7.9 -demo-random-cpu-55954b64b4-kfc5q init-myservice IfNotPresent busybox:1.28 -demo-random-cpu-55954b64b4-kfc5q web-frontend Always python:latest -demo-random-cpu-55954b64b4-kfc5q nginx IfNotPresent nginx:1.7.9 -demo-random-cpu-55954b64b4-nd89h init-myservice IfNotPresent busybox:1.28 -demo-random-cpu-55954b64b4-nd89h web-frontend Always python:latest -demo-random-cpu-55954b64b4-nd89h nginx IfNotPresent nginx:1.7.9 +demo-random-cpu-55954b64b4-9t7m2 init-myservice IfNotPresent busybox:1.28 +demo-random-cpu-55954b64b4-9t7m2 web-frontend Always python:latest +demo-random-cpu-55954b64b4-9t7m2 nginx IfNotPresent nginx:1.7.9 +demo-random-cpu-55954b64b4-km6bg init-myservice IfNotPresent busybox:1.28 +demo-random-cpu-55954b64b4-km6bg web-frontend Always python:latest +demo-random-cpu-55954b64b4-km6bg nginx IfNotPresent nginx:1.7.9 +demo-random-cpu-55954b64b4-knc6n init-myservice IfNotPresent busybox:1.28 +demo-random-cpu-55954b64b4-knc6n web-frontend Always python:latest +demo-random-cpu-55954b64b4-knc6n nginx IfNotPresent nginx:1.7.9 +demo-random-cpu-55954b64b4-vr4hg init-myservice IfNotPresent busybox:1.28 +demo-random-cpu-55954b64b4-vr4hg web-frontend Always python:latest +demo-random-cpu-55954b64b4-vr4hg nginx IfNotPresent nginx:1.7.9 ``` ### Advanced labels @@ -211,22 +178,22 @@ return cpu requests size and limits of each container where the pods have an app ``` shell $ kubectl-ice cpu -l "app in (useoddcpu)" -c web-frontend PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 -demo-odd-cpu-5f947f9db4-5z9w2 web-frontend 2m 1m 1000m 184.45 0.18 -demo-odd-cpu-5f947f9db4-62xjb web-frontend 3m 1m 1000m 235.40 0.24 -demo-odd-cpu-5f947f9db4-68f47 web-frontend 3m 1m 1000m 225.05 0.23 -demo-odd-cpu-5f947f9db4-7hlxl web-frontend 3m 1m 1000m 223.38 0.22 -demo-odd-cpu-5f947f9db4-7r5s2 web-frontend 3m 1m 1000m 232.54 0.23 -demo-odd-cpu-5f947f9db4-8qpl5 web-frontend 3m 1m 1000m 222.98 0.22 -demo-odd-cpu-5f947f9db4-c5sv6 web-frontend 3m 1m 1000m 227.62 0.23 -demo-odd-cpu-5f947f9db4-c7scd web-frontend 2m 1m 1000m 181.64 0.18 -demo-odd-cpu-5f947f9db4-d6qz6 web-frontend 3m 1m 1000m 224.07 0.22 -demo-odd-cpu-5f947f9db4-jfwtd web-frontend 2m 1m 1000m 196.39 0.20 -demo-odd-cpu-5f947f9db4-lkfs2 web-frontend 3m 1m 1000m 274.59 0.27 -demo-odd-cpu-5f947f9db4-q85pt web-frontend 2m 1m 1000m 181.88 0.18 -demo-odd-cpu-5f947f9db4-qdfnb web-frontend 3m 1m 1000m 209.83 0.21 -demo-odd-cpu-5f947f9db4-tz4hj web-frontend 3m 1m 1000m 236.00 0.24 -demo-odd-cpu-5f947f9db4-zsmwb web-frontend 3m 1m 1000m 204.67 0.20 +demo-odd-cpu-5f947f9db4-2g7p2 web-frontend 3m 1m 1000m 239.26 0.24 +demo-odd-cpu-5f947f9db4-59jm6 web-frontend 3m 1m 1000m 228.24 0.23 +demo-odd-cpu-5f947f9db4-6gzw7 web-frontend 137m 1m 1000m 13605.66 13.61 +demo-odd-cpu-5f947f9db4-6s97l web-frontend 3m 1m 1000m 242.12 0.24 +demo-odd-cpu-5f947f9db4-86mb8 web-frontend 3m 1m 1000m 236.35 0.24 +demo-odd-cpu-5f947f9db4-cwvdq web-frontend 135m 1m 1000m 13408.25 13.41 +demo-odd-cpu-5f947f9db4-dcg8p web-frontend 2m 1m 1000m 189.21 0.19 +demo-odd-cpu-5f947f9db4-fhs8q web-frontend 3m 1m 1000m 231.62 0.23 +demo-odd-cpu-5f947f9db4-gzcrm web-frontend 3m 1m 1000m 239.25 0.24 +demo-odd-cpu-5f947f9db4-hf872 web-frontend 2m 1m 1000m 196.35 0.20 +demo-odd-cpu-5f947f9db4-hft68 web-frontend 3m 1m 1000m 219.94 0.22 +demo-odd-cpu-5f947f9db4-jp8fw web-frontend 3m 1m 1000m 235.47 0.24 +demo-odd-cpu-5f947f9db4-k2gtp web-frontend 135m 1m 1000m 13417.88 13.42 +demo-odd-cpu-5f947f9db4-kj8s7 web-frontend 3m 1m 1000m 229.13 0.23 +demo-odd-cpu-5f947f9db4-qtxp2 web-frontend 3m 1m 1000m 262.48 0.26 +demo-odd-cpu-5f947f9db4-vg2d5 web-frontend 3m 1m 1000m 252.21 0.25 ``` ### Odditites and sorting @@ -234,7 +201,9 @@ given the listed output above the optional --oddities flag picks out the contain ``` shell $ kubectl-ice cpu -l "app in (useoddcpu)" -c web-frontend --oddities --sort '!%REQ' PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-odd-cpu-5f947f9db4-4clnc web-frontend 129m 1m 1000m 12826.49 12.83 +demo-odd-cpu-5f947f9db4-6gzw7 web-frontend 137m 1m 1000m 13605.66 13.61 +demo-odd-cpu-5f947f9db4-k2gtp web-frontend 135m 1m 1000m 13417.88 13.42 +demo-odd-cpu-5f947f9db4-cwvdq web-frontend 135m 1m 1000m 13408.25 13.41 ``` ### Pod volumes @@ -242,34 +211,35 @@ list all container volumes with mount points ``` shell $ kubectl-ice volumes web-pod CONTAINER VOLUME TYPE BACKING SIZE RO MOUNT-POINT -app-init kube-api-access-4vph2 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount +app-init kube-api-access-c47d7 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount app-watcher app ConfigMap app.py - false /myapp/ -app-watcher kube-api-access-4vph2 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount -app-broken kube-api-access-4vph2 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount +app-watcher kube-api-access-c47d7 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount +app-broken kube-api-access-c47d7 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount myapp app ConfigMap app.py - false /myapp/ -myapp kube-api-access-4vph2 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount +myapp kube-api-access-c47d7 Projected kube-root-ca.crt - true /var/run/secrets/kubernetes.io/serviceaccount ``` ### Pod exec command retrieves the command line and any arguments specified at the container level ``` shell $ kubectl-ice command web-pod -CONTAINER COMMAND ARGUMENTS -app-init sh -c sleep 2; exit 0 - -app-watcher python /myapp/mainapp.py - -app-broken sh -c sleep 2; exit 1 - -myapp python /myapp/mainapp.py - +CONTAINER COMMAND ARGUMENTS +app-init sh -c sleep 2; exit 0 - +app-watcher python /myapp/mainapp.py - +app-broken sh -c sleep 2; exit 1 - +myapp python /myapp/mainapp.py - +debugger-k5znj - - ``` ### Excluding rows use the --match flag to show only the output rows where the used memory column is greater than or equal to 3MB, this has the effect of exclusing any row where the used memory column is currently under 4096kB, the value 4096 can be replaced with any whole number in kilobytes ``` shell $ kubectl-ice mem -l app=userandomcpu --match 'used>=4096' -PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT -demo-random-cpu-55954b64b4-2fnvf web-frontend 8.29Mi 1M 256M 868.76 3.39 -demo-random-cpu-55954b64b4-j5fgx web-frontend 8.40Mi 1M 256M 881.05 3.44 -demo-random-cpu-55954b64b4-kfc5q web-frontend 8.36Mi 1M 256M 876.13 3.42 -demo-random-cpu-55954b64b4-nd89h web-frontend 8.36Mi 1M 256M 876.54 3.42 +PODNAME CONTAINER USED REQUEST LIMIT %REQ %LIMIT +demo-random-cpu-55954b64b4-9t7m2 web-frontend 6.71Mi 1M 256M 704.10 2.75 +demo-random-cpu-55954b64b4-km6bg web-frontend 8.29Mi 1M 256M 869.17 3.40 +demo-random-cpu-55954b64b4-knc6n web-frontend 5.41Mi 1M 256M 566.89 2.21 +demo-random-cpu-55954b64b4-vr4hg web-frontend 8.63Mi 1M 256M 904.81 3.53 ``` ### Extra selections @@ -277,8 +247,8 @@ using the --select flag allows you to filter the pod selection to only pods that ``` shell $ kubectl-ice status --select 'priorityClassName=system-cluster-critical' -A NAMESPACE PODNAME CONTAINER READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL AGE -kube-system coredns-78fcd69978-qnjtj coredns true true 0 Running - - - 17d -kube-system metrics-server-77c99ccb96-kjq9s metrics-server true true 0 Running - - - 17d +kube-system coredns-78fcd69978-qnjtj coredns true true 1 Running - - - 46h +kube-system metrics-server-77c99ccb96-kjq9s metrics-server true true 1 Running - - - 46h ``` ### Security information @@ -288,8 +258,11 @@ $ kubectl-ice security -n kube-system PODNAME CONTAINER ALLOW_PRIVILEGE_ESCALATION PRIVILEGED RO_ROOT_FS RUN_AS_NON_ROOT RUN_AS_USER RUN_AS_GROUP coredns-78fcd69978-qnjtj coredns false - true - - - etcd-minikube etcd - - - - - - +kindnet-2mhhp kindnet-cni - false - - - - +kindnet-qpdhv kindnet-cni - false - - - - kube-apiserver-minikube kube-apiserver - - - - - - kube-controller-manager-minikube kube-controller-manager - - - - - - +kube-proxy-f98q8 kube-proxy - true - - - - kube-proxy-hdx8w kube-proxy - true - - - - kube-scheduler-minikube kube-scheduler - - - - - - metrics-server-77c99ccb96-kjq9s metrics-server - - true true 1000 - @@ -303,8 +276,11 @@ $ kubectl-ice capabilities -n kube-system PODNAME CONTAINER ADD DROP coredns-78fcd69978-qnjtj coredns NET_BIND_SERVICE all etcd-minikube etcd - - +kindnet-2mhhp kindnet-cni NET_RAW,NET_ADMIN - +kindnet-qpdhv kindnet-cni NET_RAW,NET_ADMIN - kube-apiserver-minikube kube-apiserver - - kube-controller-manager-minikube kube-controller-manager - - +kube-proxy-f98q8 kube-proxy - - kube-proxy-hdx8w kube-proxy - - kube-scheduler-minikube kube-scheduler - - metrics-server-77c99ccb96-kjq9s metrics-server - - @@ -316,13 +292,16 @@ with the --node-label and --pod-label flags its possible to show the values of t ``` shell $ kubectl-ice status --node-label "beta.kubernetes.io/os" --pod-label "component" -n kube-system PODNAME CONTAINER beta.kubernetes.io/os component READY STARTED RESTARTS STATE REASON EXIT-CODE SIGNAL AGE -coredns-78fcd69978-qnjtj coredns linux - true true 0 Running - - - 17d -etcd-minikube etcd linux etcd true true 0 Running - - - 17d -kube-apiserver-minikube kube-apiserver linux kube-apiserver true true 0 Running - - - 17d -kube-controller-manager-minikube kube-controller-manager linux kube-controller-manager true true 0 Running - - - 17d -kube-proxy-hdx8w kube-proxy linux - true true 0 Running - - - 17d -kube-scheduler-minikube kube-scheduler linux kube-scheduler true true 0 Running - - - 17d -metrics-server-77c99ccb96-kjq9s metrics-server linux - true true 0 Running - - - 17d -storage-provisioner storage-provisioner linux - true true 1 Running - - - 17d +coredns-78fcd69978-qnjtj coredns linux - true true 1 Running - - - 46h +etcd-minikube etcd linux etcd true true 1 Running - - - 46h +kindnet-2mhhp kindnet-cni linux - true true 1 Running - - - 46h +kindnet-qpdhv kindnet-cni linux - true true 1 Running - - - 46h +kube-apiserver-minikube kube-apiserver linux kube-apiserver true true 1 Running - - - 46h +kube-controller-manager-minikube kube-controller-manager linux kube-controller-manager true true 1 Running - - - 46h +kube-proxy-f98q8 kube-proxy linux - true true 1 Running - - - 46h +kube-proxy-hdx8w kube-proxy linux - true true 1 Running - - - 46h +kube-scheduler-minikube kube-scheduler linux kube-scheduler true true 1 Running - - - 46h +metrics-server-77c99ccb96-kjq9s metrics-server linux - true true 1 Running - - - 46h +storage-provisioner storage-provisioner linux - true true 2 Running - - - 46h ``` diff --git a/docs/usage.md b/docs/usage.md index ba394d4..58f9346 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -89,6 +89,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -146,6 +148,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -201,6 +205,8 @@ Usage: Flags: --annotation string Show the selected annotation as a column -i, --include-init include init container(s) in the output, by default init containers are hidden + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root --oddities show only the outlier rows that dont fall within the computed range @@ -260,6 +266,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -318,6 +326,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -372,6 +382,8 @@ Usage: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -418,6 +430,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column -i, --include-init include init container(s) in the output, by default init containers are hidden + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root --oddities show only the outlier rows that dont fall within the computed range @@ -478,6 +492,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -535,6 +551,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -592,6 +610,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root --oddities show only the outlier rows that dont fall within the computed range @@ -650,6 +670,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported @@ -709,6 +731,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column -d, --details Display the timestamp instead of age along with the message column + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root --oddities show only the outlier rows that dont fall within the computed range @@ -772,6 +796,8 @@ Aliases: Flags: --annotation string Show the selected annotation as a column -d, --device show raw block device mappings within a container + -m, --match string Filters out results, comma seperated list of COLUMN OP VALUE, where OP can be one of ==,<,>,<=,>= and != + -M, --match-only string Filters out results but only calculates up visible rows --node-label string Show the selected node label as a column --node-tree Displayes the tree with the nodes as the root -o, --output string Output format, currently csv, list, json and yaml are supported