MicroK8s : Observability を有効にする2024/06/14 |
Observability アドオンを有効にして、Prometheus による MicroK8s クラスターの各種メトリクスの収集を行います。 |
|
[1] | プライマリーノードで Observability アドオンを有効にします。 |
root@dlp:~# microk8s enable observability Infer repository core for addon observability Addon core/dns is already enabled Addon core/helm3 is already enabled Addon core/hostpath-storage is already enabled Enabling observability Release "kube-prom-stack" does not exist. Installing it now. NAME: kube-prom-stack LAST DEPLOYED: Fri Jun 14 02:31:34 2024 NAMESPACE: observability STATUS: deployed REVISION: 1 NOTES: kube-prometheus-stack has been installed. Check its status by running: kubectl --namespace observability get pods -l "release=kube-prom-stack" Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator. Release "loki" does not exist. Installing it now. NAME: loki LAST DEPLOYED: Fri Jun 14 02:31:58 2024 NAMESPACE: observability STATUS: deployed REVISION: 1 NOTES: The Loki stack has been deployed to your cluster. Loki can now be added as a datasource in Grafana. See http://docs.grafana.org/features/datasources/loki/ for more detail. Release "tempo" does not exist. Installing it now. NAME: tempo LAST DEPLOYED: Fri Jun 14 02:32:00 2024 NAMESPACE: observability STATUS: deployed REVISION: 1 TEST SUITE: None Adding argument --authentication-kubeconfig to nodes. Adding argument --authentication-kubeconfig to nodes. Adding argument --authorization-kubeconfig to nodes. Adding argument --authorization-kubeconfig to nodes. Restarting nodes. Note: the observability stack is setup to monitor only the current nodes of the MicroK8s cluster. For any nodes joining the cluster at a later stage this addon will need to be set up again. Observability has been enabled (user/pass: admin/prom-operator)root@dlp:~# microk8s kubectl get services -n observability NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 2m39s kube-prom-stack-grafana ClusterIP 10.152.183.146 <none> 80/TCP 2m45s kube-prom-stack-kube-prome-alertmanager ClusterIP 10.152.183.160 <none> 9093/TCP 2m45s kube-prom-stack-kube-prome-operator ClusterIP 10.152.183.193 <none> 443/TCP 2m45s kube-prom-stack-kube-prome-prometheus ClusterIP 10.152.183.178 <none> 9090/TCP 2m45s kube-prom-stack-kube-state-metrics ClusterIP 10.152.183.75 <none> 8080/TCP 2m45s kube-prom-stack-prometheus-node-exporter ClusterIP 10.152.183.44 <none> 9100/TCP 2m45s loki ClusterIP 10.152.183.110 <none> 3100/TCP 2m33s loki-headless ClusterIP None <none> 3100/TCP 2m33s loki-memberlist ClusterIP None <none> 7946/TCP 2m33s prometheus-operated ClusterIP None <none> 9090/TCP 2m39s tempo ClusterIP 10.152.183.252 <none> 3100/TCP,16687/TCP,16686/TCP,6831/UDP,6832/UDP,14268/TCP,14250/TCP,9411/TCP,55680/TCP,55681/TCP,4317/TCP,4318/TCP,55678/TCP 2m31sroot@dlp:~# microk8s kubectl get pods -n observability NAME READY STATUS RESTARTS AGE alertmanager-kube-prom-stack-kube-prome-alertmanager-0 2/2 Running 1 (2m53s ago) 2m58s kube-prom-stack-grafana-5d449986fb-q5r6b 3/3 Running 0 3m4s kube-prom-stack-kube-prome-operator-7744b7b479-sq69t 1/1 Running 0 3m4s kube-prom-stack-kube-state-metrics-548b48db88-ftzb5 1/1 Running 0 3m4s kube-prom-stack-prometheus-node-exporter-hngnz 1/1 Running 0 3m4s kube-prom-stack-prometheus-node-exporter-vsbws 1/1 Running 0 3m4s loki-0 1/1 Running 0 2m52s loki-promtail-fl6st 1/1 Running 0 2m52s loki-promtail-qq5pp 1/1 Running 0 2m52s prometheus-kube-prom-stack-kube-prome-prometheus-0 2/2 Running 0 2m57s tempo-0 2/2 Running 0 2m50s # 外部からもアクセスできるようにする場合は 要ポートフォワードする # Prometheus UI root@dlp:~# microk8s kubectl port-forward -n observability service/prometheus-operated --address 0.0.0.0 9090:9090 Forwarding from 0.0.0.0:9090 -> 9090 # Grafana UI root@dlp:~# microk8s kubectl port-forward -n observability service/kube-prom-stack-grafana --address 0.0.0.0 3000:80 Forwarding from 0.0.0.0:3000 -> 3000 |
[2] | ローカルネットワーク内の任意のクライアントコンピューターで Web ブラウザーを起動し、
[http://(MicroK8s プライマリーノードのホスト名 または IP アドレス):(設定したポート)/]
にアクセスして、Prometheus や Grafana の UI が表示されれば OK です。 なお、Grafana の [デフォルトユーザー/パスワード] は [admin/prom-operator] です。 |
Sponsored Link |
|