Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Service Mush: Debugging Istio Deployments

Service Mush: Debugging Istio Deployments

Sandeep Parikh

August 21, 2019
Tweet

More Decks by Sandeep Parikh

Other Decks in Technology

Transcript

  1. Hi, I’m Sandeep I write code, best practices, and work

    with technical practitioners (ops, devops, secops) to build and operate cloud native infrastructure. Find me @crcsmnky on Twitter and Github.
  2. Challenges More services to keep track of Network congestion Service

    reliability Inter and intra service security Aggregating metrics and logs
  3. Secure access and communications between some or all services Examine

    everything happening with your services with little to no instrumentation Manage the flow of traffic into, out of, and within your complex deployments How does Istio help?
  4. Istio is not without complexity Multiple control plane components →

    each generate lots of logs Large config model, multiple istio APIs → steep learning curve Istio policies are highly customizable → many paths to a failing state Istio sits on top of Kubernetes → which itself is complicated
  5. And Istio is still growing and evolving Shipping version 1.2

    Documentation is growing in size / reorganizing Tools ecosystem is growing but small (lots of CLI basics like curl and jq) Service Service Service Service Gateway
  6. What we’ll cover Let’s walk through • Traffic not routing

    correctly • Missing telemetry data • Authentication issues Goal: share an Istio debugging toolbox with you, through demos. How to diagnose and fix Istio configuration problems
  7. Recap: how Istio Pilot works Observes the service topology Converts

    Istio API resources into Envoy config Pushes Envoy config to the sidecar proxies Service A Service B proxy proxy Pilot
  8. Recap: Istio traffic API North-South controls like Gateway and ServiceEntry

    affect inter-cluster traffic, inbound and outbound, respectively. East-West controls like VirtualService and DestinationRule affect intra-cluster traffic, inbound and outbound, respectively. VirtualService DestinationRule Gateway ServiceEntry
  9. Demo: VirtualService woes weather frontend weather backend v1 weather backend

    v2 90% 10% weather frontend weather backend v1 weather backend v2 50% 50% But seeing this. Want this.
  10. Recap: how Mixer works Mixer has an open API and

    a pluggable architecture: Send telemetry, logs and traces to your system of choice Challenge: many ways to fail frontend proxy Mixer Adapters Mixer Open Policy Agent
  11. Missing metrics Standard Istio metrics are showing up in Prometheus

    (e.g. server request count). Custom workload metrics don’t appear. Why not? weather frontend weather backend v1 weather backend v2
  12. Annotations! In order for Prometheus to gather your custom metrics,

    you must supply annotations in your deployment’s spec.template.metadata that tell it where to grab them from. annotations: prometheus.io/scrape: "true" prometheus.io/port: "5000" prometheus.io/path: "/metrics"
  13. What about other Mixer issues? Troubleshooting • Confirming Mixer report

    calls • Identifying Mixer configuration problems • Examining Mixer logs • Reviewing handler and metrics configurations • Check out Missing Metrics on istio.io Because Mixer components are tightly coupled, you may have to re-apply the configuration. curl -L https://git.io/getLatestIstio | sh - for flag in true false; do helm template --set mixer.enabled=$FLAG --namespace istio-system install/kubernetes/helm/istio > mixer-$FLAG.yaml done diff --line-format=%L mixer-true.yaml mixer-false.yaml > mixer-config.yaml kubectl apply -f mixer-config.yaml
  14. Demo: enforce mTLS for weather-backend apiVersion: ... kind: "Policy" metadata:

    name: "weather-backend-mtls" spec: targets: - name: weather-backend peers: - mtls: {} apiVersion: ... kind: DestinationRule metadata: name: "dr-weather-backend" spec: host: "weather-backend.default" trafficPolicy: tls: mode: ISTIO_MUTUAL
  15. Demo: enforce mTLS for weather-backend weather frontend weather backend But

    seeing this. Want this. 200 weather frontend weather backend 503
  16. apiVersion: ... kind: DestinationRule metadata: name: "weather-backend" spec: host: "weather-backend.default"

    trafficPolicy: tls: mode: DISABLE subsets: - name: single labels: version: single - name: multiple labels: version: multiple DestinationRule Conflicts apiVersion: ... kind: DestinationRule metadata: name: "dr-weather-backend" spec: host: "weather-backend.default" trafficPolicy: tls: mode: ISTIO_MUTUAL apiVersion: ... kind: DestinationRule metadata: name: "weather-backend" spec: host: "weather-backend.default" trafficPolicy: tls: mode: ISTIO_MUTUAL subsets: - name: single labels: version: single - name: multiple labels: version: multiple Ok Conflict Ok
  17. What we covered How to determine if a VirtualService is

    working How to use istioctl How to parse Envoy logs How to diagnose Mixer rules and metrics How to diagnose Istio mTLS Policies
  18. Istio debugging toolbox istioctl Envoy status, TLS checks kubectl exec

    Mounted certs, Envoy debug logs stern Readability for k8s logs jq Read and filter JSON output sleep Pod for debugging east-west traffic curl Testing with HTTP requests And don’t forget the Istio docs!