DevOps Classroom notes 01/Mar/2026

Istio on AKS

  • Refer Here for the steps to be followed
  • Before trying apps ensure we do the following steps
kubectl create namespace bookinfo

kubectl label namespace bookinfo istio.io/rev="$REVISION" --overwrite

kubectl get ns bookinfo --show-labels

kubectl apply -f https://raw.githubusercontent.com/istio/istio/refs/tags/1.29.0/samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfo
  • Deploy the virtual service
kubectl apply -n bookinfo -f - <<'EOF'
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: bookinfo-gateway-external
spec:
  selector:
    istio: aks-istio-ingressgateway-external
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: bookinfo-vs-external
spec:
  hosts:
  - "*"
  gateways:
  - bookinfo-gateway-external
  http:
  - match:
    - uri: { exact: /productpage }
    - uri: { prefix: /static }
    - uri: { exact: /login }
    - uri: { exact: /logout }
    - uri: { prefix: /api/v1/products }
    route:
    - destination:
        host: productpage
        port:
          number: 9080
EOF
INGRESS_HOST_EXTERNAL=$(kubectl -n aks-istio-ingress get svc aks-istio-ingressgateway-external -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
INGRESS_PORT_EXTERNAL=$(kubectl -n aks-istio-ingress get svc aks-istio-ingressgateway-external -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
GATEWAY_URL_EXTERNAL=$INGRESS_HOST_EXTERNAL:$INGRESS_PORT_EXTERNAL

echo "http://$GATEWAY_URL_EXTERNAL/productpage"

curl -s "http://$GATEWAY_URL_EXTERNAL/productpage" | grep -o "<title>.*</title>"

Prometheus Grafana LOKI & Promtail

  • Prometheus => store and scrape metrics
  • Grafana => Visualize
  • LOKI => Logstore
  • Promtail => forwards the logs

  • Prometheus + Grafana
  • Promtail + Loki + Grafana
  • Create a namespace and install kube-prometheus stack
kubectl create ns monitoring
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install monitoring prometheus-community/kube-prometheus-stack \
  --namespace monitoring \
  --create-namespace

  • Now to access grafana
kubectl get svc -n monitoring
kubectl port-forward -n monitoring svc/monitoring-grafana 3000:80 --address 0.0.0.0
# Access 3000 by navigating to ports section
  • Username is admin for password
kubectl get secret --namespace monitoring monitoring-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

  • For kube metrics watch recording
  • Lets deploy a sample application
kubectl create ns demo-metrics
kubectl apply -n demo-metrics -f - <<'YAML'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prom-example
spec:
  replicas: 3
  selector:
    matchLabels:
      app: prom-example
  template:
    metadata:
      labels:
        app: prom-example
    spec:
      containers:
      - name: prom-example
        image: quay.io/brancz/prometheus-example-app:v0.5.0
        ports:
        - name: web
          containerPort: 8080
YAML
  • lets create a service for this
kubectl apply -n demo-metrics -f - <<'YAML'
apiVersion: v1
kind: Service
metadata:
  name: prom-example
  labels:
    app: prom-example
spec:
  type: ClusterIP
  ports:
  - name: web
    port: 8080
    targetPort: 8080
    protocol: TCP
  selector:
    app: prom-example
YAML
  • Create a service monitor (crd)
kubectl apply -n demo-metrics -f - <<'YAML'
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: prom-example
  labels:
    release: monitoring
spec:
  selector:
    matchLabels:
      app: prom-example
  endpoints:
  - port: web
    path: /metrics
    interval: 30s
YAML
  • Create values.yaml
loki:
  commonConfig:
    replication_factor: 3
  schemaConfig:
    configs:
      - from: "2024-04-01"
        store: tsdb
        object_store: s3
        schema: v13
        index:
          prefix: loki_index_
          period: 24h
  pattern_ingester:
      enabled: true
  limits_config:
    allow_structured_metadata: true
    volume_enabled: true
  ruler:
    enable_api: true

minio:
  enabled: true

deploymentMode: SingleBinary

singleBinary:
  replicas: 3

# Zero out replica counts of other deployment modes
backend:
  replicas: 0
read:
  replicas: 0
write:
  replicas: 0

ingester:
  replicas: 0
querier:
  replicas: 0
queryFrontend:
  replicas: 0
queryScheduler:
  replicas: 0
distributor:
  replicas: 0
compactor:
  replicas: 0
indexGateway:
  replicas: 0
bloomCompactor:
  replicas: 0
bloomGateway:
  replicas: 0
  • Installing loki
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

helm install loki grafana/loki --namespace monitoring
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%