Fault Injection - delays and aborts not working in Istio

8/8/2019

I've configured Istio to delay/abort http-traffic with 30 seconds to my catalogue-service, yet when i refresh my page, the catalogue shows without any delays.

This is a setup in Google's GKE. I'm using the sock-shop demo to test several aspects of Istio's functionality.

My current setup is as follows: This is my yaml-file containing all the services and deployments (shortened to the configuration of Catalogue and the front-end, which uses the catalogue):

#################################################
# Catalogue-db
#################################################
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: catalogue-db-v1
  labels:
    name: catalogue-db
    version: v1
  namespace: sock-shop
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: catalogue-db
        version: v1
    spec:
      containers:
      - name: catalogue-db
        image: weaveworksdemos/catalogue-db:0.3.0
        env:
          - name: MYSQL_ROOT_PASSWORD
            value: fake_password
          - name: MYSQL_DATABASE
            value: socksdb
        ports:
        - name: mysql
          containerPort: 3306
      nodeSelector:
        beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
  name: catalogue-db
  labels:
    name: catalogue-db
  namespace: sock-shop
spec:
  ports:
    # the port that this service should serve on
  - port: 3306
    targetPort: 3306
  selector:
    name: catalogue-db
---
######################################################
#Catalogue
######################################################
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: catalogue
  labels:
    name: catalogue
    version: v1
  namespace: sock-shop
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: catalogue
        version: v1
    spec:
      containers:
      - name: catalogue
        image: weaveworksdemos/catalogue:0.3.5
        ports:
        - containerPort: 80
        securityContext:
          runAsNonRoot: true
          runAsUser: 10001
          capabilities:
            drop:
              - all
            add:
              - NET_BIND_SERVICE
          readOnlyRootFilesystem: true
      nodeSelector:
        beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
  name: catalogue
  labels:
    name: catalogue
  namespace: sock-shop
spec:
  ports:
    # the port that this service should serve on
  - port: 80
    name: http-catalogue
    targetPort: 80
  selector:
    name: catalogue
---
##############################################
# Front-End
##############################################
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: front-end-v1
  labels:
     name: front-end
     version: v1
  namespace: sock-shop
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: front-end
        version: v1
    spec:
      containers:
      - name: front-end
        image: weaveworksdemos/front-end:0.3.12
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 8079
        securityContext:
          runAsNonRoot: true
          runAsUser: 10001
          capabilities:
            drop:
              - all
          readOnlyRootFilesystem: true
      nodeSelector:
        beta.kubernetes.io/os: linux
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: front-end-v2
  labels:
     name: front-end
     version: v2
  namespace: sock-shop
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: front-end
        version: v2
    spec:
      containers:
      - name: front-end
        image: vinayakinfrac/front-end:0.3.12
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 8079
        securityContext:
          runAsNonRoot: true
          runAsUser: 10001
          capabilities:
            drop:
              - all
          readOnlyRootFilesystem: true
      nodeSelector:
        beta.kubernetes.io/os: linux
---
apiVersion: v1
kind: Service
metadata:
  name: front-end
  labels:
    name: front-end
  namespace: sock-shop
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 8079
    name: http-front-end
    nodePort: 30001
  selector:
    name: front-end

This is the destinationrule for my catalogue:

apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: catalogue
  namespace: sock-shop
spec:
  host: catalogue
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL
  subsets:
  - name: v1
    labels:
      version: v1

And this is the virtualservice, which includes the fault-injection:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: catalogue
  namespace: sock-shop
spec:
  hosts:
  - catalogue
  http:
  - fault:
      delay:
        fixedDelay: 30s
        percent: 100
    route:
    - destination:
        host: catalogue.sock-shop.svc.cluster.local
        subset: v1
-- Patrick Weyn
config
google-kubernetes-engine
istio

1 Answer

8/8/2019

Seems like it was a mistake on my part. I've tried again with the same configurations as posted in the original question, and it works now.

-- Patrick Weyn
Source: StackOverflow