项目作者: NTTDATA-EMEA

项目描述 :
The viewnode shows Kubernetes cluster nodes with their pods and containers.
高级语言: Go
项目地址: git://github.com/NTTDATA-EMEA/viewnode.git
创建时间: 2021-07-10T18:00:07Z
项目社区:https://github.com/NTTDATA-EMEA/viewnode

开源协议:Apache License 2.0

下载


Warning! This repository is archived and should not be used anymore. The active development was moved to the following repo: https://github.com/NTTDATA-DACH/viewnode

viewnode

The viewnode shows Kubernetes cluster nodes with their pods and containers.
It is very useful when you need to monitor multiple resources such as nodes, pods or containers in a dynamic environment like a CI/CD platform.

  1. The viewnode shows nodes with their pods and containers.
  2. You can find the source code and usage documentation at GitHub: https://github.com/NTTDATA-EMEA/viewnode.
  3. Usage:
  4. viewnode [flags]
  5. viewnode [command]
  6. Available Commands:
  7. help Help about any command
  8. version Plugin Version
  9. Flags:
  10. -A, --all-namespaces use all namespaces
  11. -d, --debug run in debug mode (shows stack trace in case of errors)
  12. -h, --help help for viewnode
  13. -n, --namespace string namespace to use
  14. -f, --node-filter string show only nodes according to filter
  15. -p, --pod-filter string show only pods according to filter
  16. -c, --show-containers show containers in pod
  17. -t, --show-pod-start-times show start times of pods
  18. -r, --show-requests-and-limits show requests and limits for containers' cpu and memory (requires -c flag)
  19. --show-running-only show running pods only
  20. Use "viewnode [command] --help" for more information about a command.

Installation

The viewnode is written in go, so just download the correct executable suitable for your platform from the releases and run it.
You can also download the source code and compile it.

If you copy the executable file into your PATH, you can use it like a kubectl command, i.e. without the hyphen:

  1. kubectl viewnode --show-running-only

Usage examples

Showing nodes and pods:

  1. $ viewnode
  2. namespace: jenkins-onprem
  3. 8 pod(s) in total
  4. 0 unscheduled pod(s)
  5. 3 running node(s) with 8 scheduled pod(s):
  6. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-8fws running 2 pod(s) (linux/amd64)
  7. * docker-in-the-cloud-341-ffkt5-2k64t (running)
  8. * docker-in-the-cloud-86-822pd-d6p3d (running)
  9. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-b0np running 2 pod(s) (linux/amd64)
  10. * docker-in-the-cloud-338-3wc8r-n1t7z (running)
  11. * docker-in-the-cloud-340-cms5r-pxxq7 (running)
  12. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-v1vr running 4 pod(s) (linux/amd64)
  13. * docker-in-the-cloud-337-4c4lm-q3mtp (running)
  14. * docker-in-the-cloud-339-4x9dq-0xd3q (running)
  15. * docker-in-the-cloud-342-r5khq-9cx2w (running)
  16. * liveness-test-4-boom (failed)

Showing nodes, pods and containers:

  1. $ viewnode --show-containers
  2. namespace: jenkins-onprem
  3. 8 pod(s) in total
  4. 0 unscheduled pod(s)
  5. 3 running node(s) with 8 scheduled pod(s):
  6. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-8fws running 2 pod(s) (linux/amd64)
  7. * docker-in-the-cloud-341-ffkt5-2k64t (running) (3: default/running docker-daemon/running jnlp/running)
  8. * docker-in-the-cloud-86-822pd-d6p3d (running) (3: default/running docker-daemon/running jnlp/terminated)
  9. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-b0np running 2 pod(s) (linux/amd64)
  10. * docker-in-the-cloud-338-3wc8r-n1t7z (running) (3: default/running docker-daemon/running jnlp/running)
  11. * docker-in-the-cloud-340-cms5r-pxxq7 (running) (3: default/running docker-daemon/running jnlp/running)
  12. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-v1vr running 4 pod(s) (linux/amd64)
  13. * docker-in-the-cloud-337-4c4lm-q3mtp (running) (3: default/running docker-daemon/running jnlp/running)
  14. * docker-in-the-cloud-339-4x9dq-0xd3q (running) (3: default/running docker-daemon/running jnlp/running)
  15. * docker-in-the-cloud-342-r5khq-9cx2w (running) (3: default/running docker-daemon/running jnlp/running)
  16. * liveness-test-4-boom (failed) (3: dead-container/terminated liveness1/running liveness2/running)

Showing nodes and pods with their start times:

  1. $ viewnode --show-pod-start-times
  2. namespace: jenkins-onprem
  3. 8 pod(s) in total
  4. 0 unscheduled pod(s)
  5. 3 running node(s) with 8 scheduled pod(s):
  6. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-8fws running 2 pod(s) (linux/amd64)
  7. * docker-in-the-cloud-341-ffkt5-2k64t (running/Thu Aug 26 09:36:04 CEST 2021)
  8. * docker-in-the-cloud-86-822pd-d6p3d (running/Thu Aug 19 09:09:20 CEST 2021)
  9. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-b0np running 2 pod(s) (linux/amd64)
  10. * docker-in-the-cloud-338-3wc8r-n1t7z (running/Thu Aug 26 09:36:02 CEST 2021)
  11. * docker-in-the-cloud-340-cms5r-pxxq7 (running/Thu Aug 26 09:36:04 CEST 2021)
  12. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-v1vr running 4 pod(s) (linux/amd64)
  13. * docker-in-the-cloud-337-4c4lm-q3mtp (running/Thu Aug 26 09:35:36 CEST 2021)
  14. * docker-in-the-cloud-339-4x9dq-0xd3q (running/Thu Aug 26 09:36:03 CEST 2021)
  15. * docker-in-the-cloud-342-r5khq-9cx2w (running/Thu Aug 26 09:36:05 CEST 2021)
  16. * liveness-test-4-boom (failed/Wed Aug 25 15:07:52 CEST 2021)

You can also combine show options:

  1. $ viewnode --show-pod-start-times --show-containers
  2. namespace: jenkins-onprem
  3. 8 pod(s) in total
  4. 0 unscheduled pod(s)
  5. 3 running node(s) with 8 scheduled pod(s):
  6. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-8fws running 2 pod(s) (linux/amd64)
  7. * docker-in-the-cloud-341-ffkt5-2k64t (running/Thu Aug 26 09:36:04 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  8. * docker-in-the-cloud-86-822pd-d6p3d (running/Thu Aug 19 09:09:20 CEST 2021) (3: default/running docker-daemon/running jnlp/terminated)
  9. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-b0np running 2 pod(s) (linux/amd64)
  10. * docker-in-the-cloud-338-3wc8r-n1t7z (running/Thu Aug 26 09:36:02 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  11. * docker-in-the-cloud-340-cms5r-pxxq7 (running/Thu Aug 26 09:36:04 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  12. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-v1vr running 4 pod(s) (linux/amd64)
  13. * docker-in-the-cloud-337-4c4lm-q3mtp (running/Thu Aug 26 09:35:36 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  14. * docker-in-the-cloud-339-4x9dq-0xd3q (running/Thu Aug 26 09:36:03 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  15. * docker-in-the-cloud-342-r5khq-9cx2w (running/Thu Aug 26 09:36:05 CEST 2021) (3: default/running docker-daemon/running jnlp/running)
  16. * liveness-test-4-boom (failed/Wed Aug 25 15:07:52 CEST 2021) (3: dead-container/terminated liveness1/running liveness2/running)

As well as filter nodes and pods:

  1. $ viewnode --node-filter v1vr
  2. namespace: jenkins-onprem
  3. 4 pod(s) in total
  4. 0 unscheduled pod(s)
  5. 1 running node(s) with 4 scheduled pod(s):
  6. - gke-dcgsecigke001-dcgsecigke001-linux-1cd8c3b9-v1vr running 4 pod(s) (linux/amd64)
  7. * docker-in-the-cloud-337-4c4lm-q3mtp (running)
  8. * docker-in-the-cloud-339-4x9dq-0xd3q (running)
  9. * docker-in-the-cloud-342-r5khq-9cx2w (running)
  10. * liveness-test-4-boom (failed)

Very popular is combining viewnode with watch command e.g. watching all nodes, pods and containers every second can be configured as follows:

  1. watch -n1 viewnode --show-pod-start-times --show-containers

Compatibility

The viewnode was tested against Google Cloud Platform with Kubernetes v1.19.
It should however work with all clouds supported by client-go.