Created
December 13, 2022 18:34
-
-
Save whitneygriffith/eaf6e8cc3b1bfc6d6ccfd7bf4a2a1e83 to your computer and use it in GitHub Desktop.
Collecting Istio Metrics for TCP Services in AKS
This file contains 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
random=$RANDOM | |
# Create AKS Cluster | |
az aks create -g "osm-rg-$random" -n "osm-aks-$random" --enable-managed-identity --node-count 1 --enable-addons monitoring --enable-msi-auth-for-monitoring --generate-ssh-keys --attach-acr "osmacr$random" | |
# Connect to AKS Cluster in Local Environment | |
az aks get-credentials --resource-group "osm-rg-$random" --name "osm-aks-$random" | |
# Install istio 1.15 | |
istioctl install --set profile=demo -y | |
kubectl label namespace default istio-injection=enabled | |
# Deploy Sample App | |
curl -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/platform/kube/bookinfo.yaml > bookinfo.yaml | |
kubectl apply -f bookinfo.yaml | |
kubectl exec "$(kubectl get pod -l app=ratings -o jsonpath='{.items[0].metadata.name}')" -c ratings -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>" | |
# Deploy Ratings v2 | |
curl -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/platform/kube/bookinfo-ratings-v2.yaml > ratingsv2.yaml | |
kubectl apply -f ratingsv2.yaml | |
# Deploy Mongodb | |
curl -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/platform/kube/bookinfo-db.yaml > mongodb.yaml | |
kubectl apply -f mongodb.yaml | |
# Create destination rules | |
curl -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/networking/destination-rule-all.yaml > destination-rule-all.yaml | |
kubectl apply -f destination-rule-all.yaml | |
# Create virtual service ratings | |
curl -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/networking/virtual-service-ratings-db.yaml > virtual-service-ratings-db.yaml | |
kubectl apply -f virtual-service-ratings-db.yaml | |
# Gateway | |
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/platform/kube/bookinfo.yaml | |
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.16/samples/bookinfo/networking/bookinfo-gateway.yaml | |
echo "waiting for public ip address..." | |
timeout 10s bash -c 'until kubectl get service/istio-ingressgateway -n istio-system --output=jsonpath='{.status.loadBalancer}' | grep "ingress"; do : ; done' | |
# https://istio.io/latest/docs/setup/getting-started/#determining-the-ingress-ip-and-ports | |
INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | |
INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}') | |
GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT | |
curl http://"$GATEWAY_URL/productpage" #http://20.85.173.59/productpage | |
# Verify Metrics are generated and collected | |
istioctl dashboard prometheus # Graph -> istio_tcp_connections_opened_total -> Execute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment