Metric API'nin çalışıyor olması gerekir. Eğer çalışmıyorsa çıktı şöyledir
Örnek
Şöyle yaparız
$ kubectl top nodes error: Metrics API not available
Sürekli izlemek için Linux watch komutu kullanılabilir. Şöyle yaparız
watch kubectl top node -n 5
1. NODE
Örnek
Şöyle yaparız. POD çıktısından farklı olarak yüzde olarak ta gösteriyor
$ kubectl top nodes NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% rlwy-08-qvq55-master-0.c.product-oce-private.internal 695m 17% 4043Mi 32% rlwy-08-qvq55-master-1.c.product-oce-private.internal 1180m 30% 7622Mi 61% rlwy-08-qvq55-master-2.c.product-oce-private.internal 1035m 26% 6613Mi 53% rlwy-08-qvq55-worker-a-8w7bw.c.product-oce-private.internal 608m 3% 9107Mi 16% rlwy-08-qvq55-worker-a-fk8qq.c.product-oce-private.internal 516m 3% 6788Mi 12% rlwy-08-qvq55-worker-a-k2lnr.c.product-oce-private.internal 483m 3% 7480Mi 13% rlwy-08-qvq55-worker-a-ks2xp.c.product-oce-private.internal 694m 4% 9105Mi 16% rlwy-08-qvq55-worker-a-lmk99.c.product-oce-private.internal 816m 5% 24555Mi 44% rlwy-08-qvq55-worker-a-nkv8m.c.product-oce-private.internal 473m 2% 7159Mi 13% rlwy-08-qvq55-worker-a-qfd5m.c.product-oce-private.internal 1327m 8% 7019Mi 12% rlwy-08-qvq55-worker-a-qj47h.c.product-oce-private.internal 406m 2% 6292Mi 11% rlwy-08-qvq55-worker-a-rf9m9.c.product-oce-private.internal 646m 4% 7031Mi 12% rlwy-08-qvq55-worker-a-vkzs7.c.product-oce-private.internal 1222m 7% 6616Mi 12% rlwy-08-qvq55-worker-a-zsxq2.c.product-oce-private.internal 547m 3% 8582Mi 15%
2. POD
Metrics API'yi kullanarak POD tarafından kullanılan CPU ve MEMORY bilgisini gösterir. Yüzde olarak göstermiyor
Metrics API'yi bu bilgiyi sağlayan şey ise Metrics Server. Açıklaması şöyle
When the pod is running, we can then use the ‘kubectl top’ command which is available through the Metrics API to reveal information such as container CPU and memory usage in bytes.
These metrics can be accessed either with the kubectl top command, or by a controller in the cluster, for example Horizontal Pod Autoscaler, to make decisions on what to do when a container passes a specified threshold.
NOTE: The API requires the metrics server to be deployed in the cluster. Otherwise it will not be available.
MEMORY alanında gösterilen bilgi JVM heap kullanımı değildir. Açıklaması burada
Örnek
Şöyle yaparız
$ kubectl top pod --all-namespaces NAMESPACE NAME CPU(cores) MEMORY(bytes) default hello-node-55b49fb9f8-fzb5q 0m 10Mi kube-system coredns-5c98db65d4-jjz8s 4m 11Mi kube-system coredns-5c98db65d4-txdpc 4m 13Mi kube-system etcd-minikube 29m 43Mi kube-system heapster-b6n49 0m 16Mi kube-system influxdb-grafana-sq7nb 1m 37Mi kube-system kube-addon-manager-minikube 8m 5Mi kube-system kube-apiserver-minikube 47m 254Mi kube-system kube-controller-manager-minikube 20m 35Mi kube-system kube-proxy-cvcdj 2m 9Mi kube-system kube-scheduler-minikube 2m 10Mi kube-system kubernetes-dashboard-7b8ddcb5m 0m 14Mi kube-system metrics-server-84bb785897-nt4xs 0m 8Mi kube-system storage-provisioner 0m 27Mi
Örnek
Şöyle yaparız
kubectl top pod --containers
Örnek
Şöyle yaparız
$ kubectl top pod -n rlwy-08 W0923 11:08:47.830819 1958517 top_pod.go:140] Using json format to get metrics. Next release will switch to protocol-buffers, switch early by passing --use-protocol-buffers flag NAME CPU(cores) MEMORY(bytes) adv-vitess-cluster-az1-vtctld-a22f4b1a-85b49c8546-9mzhk 2m 32Mi adv-vitess-cluster-az1-vtctld-a22f4b1a-85b49c8546-nhrlg 2m 29Mi adv-vitess-cluster-az1-vtgate-498e7697-78977564ff-fbxs4 1m 30Mi adv-vitess-cluster-az1-vtgate-498e7697-78977564ff-lz8x5 2m 32Mi adv-vitess-cluster-etcd-07a83994-1 34m 46Mi adv-vitess-cluster-etcd-07a83994-2 37m 48Mi adv-vitess-cluster-etcd-07a83994-3 31m 40Mi rlwy-08-fault-monitoring-events-collector-0 2m 350Mi rlwy-08-fault-monitoring-events-collector-1 5m 341Mi rlwy-08-prometheus-filestat-exporter-6f99dfbf54-4ptlf 1m 14Mi rlwy-08-prometheus-ofcs-backlog-size-exporter-5644c6486f-dt6qp 5m 10Mi rlwy-08-prometheus-ps-stats-exporter-85c54466bf-shgb6 94m 29Mi rlwy-08-prometheus-rescue-mode-exporter-5fdc759bcd-kkjcm 41m 21Mi rlwy-08-sftp-7bdc8f7f85-td6xz 2m 6Mi rlwy-08-sql-exporter-86dc94f497-krjkd 1m 21Mi rlwy-gui-7965bc5ffb-gdrd4 4m 501Mi rlwy-oam-green-0 137m 5028Mi vitess-operator-67b5bf658-fttph 7m 141Mi
Hiç yorum yok:
Yorum Gönder