Last active
July 13, 2024 12:59
-
-
Save CollinShoop/422d1a651f4435a5141c1b053653cab0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get the Istio prometheus pod name | |
| PROMETHEUS_POD=$(kubectl get pods -n istio-system --selector=app.kubernetes.io/name=prometheus -o name) | |
| echo ${PROMETHEUS_POD:?} | |
| # forward prometheus API since curl isn't available on the pod | |
| kubectl port-forward -n istio-system ${PROMETHEUS_POD:?} 9090:9090 | |
| # in a new terminal | |
| curl http://localhost:9090/api/v1/query?query=up | jq | |
| # Example output (kind cluster) | |
| { | |
| "status": "success", | |
| "data": { | |
| "resultType": "vector", | |
| "result": [ | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker2", | |
| "job": "kubernetes-nodes-cadvisor", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker2", | |
| "kubernetes_io_os": "linux", | |
| "role": "app" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker2", | |
| "job": "kubernetes-nodes", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker2", | |
| "kubernetes_io_os": "linux", | |
| "role": "app" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "instance": "10.244.0.4:9153", | |
| "job": "kubernetes-service-endpoints", | |
| "k8s_app": "kube-dns", | |
| "kubernetes_io_cluster_service": "true", | |
| "kubernetes_io_name": "CoreDNS", | |
| "namespace": "kube-system", | |
| "node": "istio-testing-control-plane", | |
| "service": "kube-dns" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-control-plane", | |
| "job": "kubernetes-nodes-cadvisor", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-control-plane", | |
| "kubernetes_io_os": "linux" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "app": "istiod", | |
| "install_operator_istio_io_owning_resource": "unknown", | |
| "instance": "10.244.3.2:15014", | |
| "istio": "pilot", | |
| "istio_io_dataplane_mode": "none", | |
| "istio_io_rev": "default", | |
| "job": "kubernetes-pods", | |
| "namespace": "istio-system", | |
| "node": "istio-testing-worker", | |
| "operator_istio_io_component": "Pilot", | |
| "pod": "istiod-dd9d8ccf7-mw5w4", | |
| "pod_template_hash": "dd9d8ccf7", | |
| "sidecar_istio_io_inject": "false" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker3", | |
| "job": "kubernetes-nodes", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker3", | |
| "kubernetes_io_os": "linux", | |
| "role": "ingress" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "app": "istio-egressgateway", | |
| "chart": "gateways", | |
| "heritage": "Tiller", | |
| "install_operator_istio_io_owning_resource": "unknown", | |
| "instance": "10.244.2.2:15020", | |
| "istio": "egressgateway", | |
| "istio_io_rev": "default", | |
| "job": "kubernetes-pods", | |
| "namespace": "istio-system", | |
| "node": "istio-testing-worker2", | |
| "operator_istio_io_component": "EgressGateways", | |
| "pod": "istio-egressgateway-84c4ddc8dc-jc5ln", | |
| "pod_template_hash": "84c4ddc8dc", | |
| "release": "istio", | |
| "service_istio_io_canonical_name": "istio-egressgateway", | |
| "service_istio_io_canonical_revision": "latest", | |
| "sidecar_istio_io_inject": "false" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "instance": "localhost:9090", | |
| "job": "prometheus" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker", | |
| "job": "kubernetes-nodes", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker", | |
| "kubernetes_io_os": "linux" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-control-plane", | |
| "job": "kubernetes-nodes", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-control-plane", | |
| "kubernetes_io_os": "linux" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "instance": "172.18.0.5:6443", | |
| "job": "kubernetes-apiservers" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "app": "istio-ingressgateway", | |
| "chart": "gateways", | |
| "heritage": "Tiller", | |
| "install_operator_istio_io_owning_resource": "unknown", | |
| "instance": "10.244.3.3:15020", | |
| "istio": "ingressgateway", | |
| "istio_io_rev": "default", | |
| "job": "kubernetes-pods", | |
| "namespace": "istio-system", | |
| "node": "istio-testing-worker", | |
| "operator_istio_io_component": "IngressGateways", | |
| "pod": "istio-ingressgateway-7945c4df97-zqvk5", | |
| "pod_template_hash": "7945c4df97", | |
| "release": "istio", | |
| "service_istio_io_canonical_name": "istio-ingressgateway", | |
| "service_istio_io_canonical_revision": "latest", | |
| "sidecar_istio_io_inject": "false" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker", | |
| "job": "kubernetes-nodes-cadvisor", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker", | |
| "kubernetes_io_os": "linux" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "instance": "10.244.0.3:9153", | |
| "job": "kubernetes-service-endpoints", | |
| "k8s_app": "kube-dns", | |
| "kubernetes_io_cluster_service": "true", | |
| "kubernetes_io_name": "CoreDNS", | |
| "namespace": "kube-system", | |
| "node": "istio-testing-control-plane", | |
| "service": "kube-dns" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| }, | |
| { | |
| "metric": { | |
| "__name__": "up", | |
| "beta_kubernetes_io_arch": "amd64", | |
| "beta_kubernetes_io_os": "linux", | |
| "instance": "istio-testing-worker3", | |
| "job": "kubernetes-nodes-cadvisor", | |
| "kubernetes_io_arch": "amd64", | |
| "kubernetes_io_hostname": "istio-testing-worker3", | |
| "kubernetes_io_os": "linux", | |
| "role": "ingress" | |
| }, | |
| "value": [ | |
| 1720875431.887, | |
| "1" | |
| ] | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment