-
Notifications
You must be signed in to change notification settings - Fork 3
/
demo_mixerless.sh
executable file
·49 lines (41 loc) · 1.68 KB
/
demo_mixerless.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env sh
SCRIPT_PATH="$(
cd "$(dirname "$0")" >/dev/null 2>&1
pwd -P
)/"
cd "$SCRIPT_PATH" || exit
source config
alias k="kubectl --kubeconfig $USER_CONFIG"
alias m="kubectl --kubeconfig $MESH_CONFIG"
echo "1 make sure about envoyfilters"
m get envoyfilter -n istio-system
echo "2 deploy prometheus"
k delete -f $ISTIO_SRC/samples/addons/prometheus.yaml
k apply -f $ISTIO_SRC/samples/addons/prometheus.yaml
echo "3 make sure about prometheus config"
# 请使用 ../mixerless/scrape_configs.yaml
k get cm prometheus -n istio-system -o jsonpath={.data.prometheus\\.yml} | grep job_name
## ==================================== ##
echo "4 init test namespace"
k delete ns test
m delete ns test
k create ns test
m create ns test
m label namespace test istio-injection=enabled
echo "5 init podinfo pod"
k apply -f $PODINFO_SRC/kustomize/deployment.yaml -n test
k apply -f $PODINFO_SRC/kustomize/service.yaml -n test
echo "6 access to generate metrics data"
podinfo_pod=$(k get po -n test -l app=podinfo -o jsonpath={.items..metadata.name})
echo "podinfo_pod=$podinfo_pod"
for i in {1..10}; do
k exec $podinfo_pod -c podinfod -n test -- curl -s podinfo:9898/version
echo
done
echo "7 check metrics data from envoy"
echo ":::: istio_requests_total ::::"
k exec $podinfo_pod -n test -c istio-proxy -- curl -s localhost:15090/stats/prometheus | grep istio_requests_total
# https://istio.io/latest/docs/ops/integrations/prometheus/
k exec $podinfo_pod -n test -c istio-proxy -- curl -s localhost:15020/stats/prometheus | grep istio_requests_total
echo ":::: istio_request_duration ::::"
k exec $podinfo_pod -n test -c istio-proxy -- curl -s localhost:15090/stats/prometheus | grep istio_request_duration