|
| 1 | +1. Get the application URL by running these commands: |
| 2 | +{{- if contains "NodePort" .Values.service.type }} |
| 3 | + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kube-summary-exporter.fullname" . }}) |
| 4 | + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") |
| 5 | + echo http://$NODE_IP:$NODE_PORT |
| 6 | +{{- else if contains "LoadBalancer" .Values.service.type }} |
| 7 | + NOTE: It may take a few minutes for the LoadBalancer IP to be available. |
| 8 | + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "kube-summary-exporter.fullname" . }}' |
| 9 | + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kube-summary-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") |
| 10 | + echo http://$SERVICE_IP:{{ .Values.service.port }} |
| 11 | +{{- else if contains "ClusterIP" .Values.service.type }} |
| 12 | + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kube-summary-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") |
| 13 | + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") |
| 14 | + echo "Visit http://127.0.0.1:9779 to use your application" |
| 15 | + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 9779:$CONTAINER_PORT |
| 16 | +{{- end }} |
| 17 | + |
| 18 | +2. kube-summary-exporter provides the following endpoints: |
| 19 | + - /: Home page with links to other endpoints |
| 20 | + - /nodes: Metrics for all nodes in the cluster |
| 21 | + - /node/{node}: Metrics for a specific node |
| 22 | + - /metrics: Prometheus metrics about the exporter itself |
| 23 | + |
| 24 | +3. Example Prometheus scrape configuration: |
| 25 | + Add the following to your Prometheus configuration to scrape metrics: |
| 26 | + |
| 27 | + - job_name: "kubernetes-summary" |
| 28 | + kubernetes_sd_configs: |
| 29 | + - role: node |
| 30 | + relabel_configs: |
| 31 | + - source_labels: [__meta_kubernetes_node_label_role] |
| 32 | + action: replace |
| 33 | + target_label: role |
| 34 | + - source_labels: [__meta_kubernetes_node_name] |
| 35 | + regex: (.+) |
| 36 | + target_label: __metrics_path__ |
| 37 | + replacement: /node/${1} |
| 38 | + - target_label: __address__ |
| 39 | + replacement: {{ include "kube-summary-exporter.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} |
0 commit comments