paul
paul

Reputation: 13471

Istio VirtualService not used in k8s Service

Hi I'm very newby in Istio/K8s, and I'm trying to make a service that I have test-service to use a new VirtualService that I've created.

Here the steps that I did

 kubectl config set-context --current --namespace my-namespace

I create my VirtualService

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: test-service
  namespace: my-namespace
spec:
  hosts:
  - test-service
  http:
  - fault:
      delay:
        fixedDelay: 60s
        percentage:
          value: 100
    route:
    - destination:
        host: test-service
        port:
          number: 9100

Then I apply into K8s

kubectl apply -f test-service.yaml

But now when I invoke the test-service using gRPC I can reach the service, but the fault with the delay is not happening.

I dont know in which log I can see of this test-service is using the VirtualService that I created or not

Here my gRPC Service config:

{
    "kind": "Service",
    "apiVersion": "v1",
    "metadata": {
        "name": "test-service",
        "namespace": "my-namespace",
        "selfLink": "/api/v1/namespaces/my-namespace/services/test-service",
        "uid": "8a9bc730-4125-4b52-b373-7958796b5df7",
        "resourceVersion": "317889736",
        "creationTimestamp": "2021-07-07T10:39:54Z",
        "labels": {
            "app": "test-service",
            "app.kubernetes.io/managed-by": "Helm",
            "version": "v1"
        },
        "annotations": {
            "meta.helm.sh/release-name": "test-service",
            "meta.helm.sh/release-namespace": "my-namespace"
        },
        "managedFields": [
            {
                "manager": "Go-http-client",
                "operation": "Update",
                "apiVersion": "v1",
                "time": "2021-07-07T10:39:54Z",
                "fieldsType": "FieldsV1",
                "fieldsV1": {
                    "f:metadata": {
                        "f:annotations": {
                            ".": {},
                            "f:meta.helm.sh/release-name": {},
                            "f:meta.helm.sh/release-namespace": {}
                        },
                        "f:labels": {
                            ".": {},
                            "f:app": {},
                            "f:app.kubernetes.io/managed-by": {},
                            "f:version": {}
                        }
                    },
                    "f:spec": {
                        "f:ports": {
                            ".": {},
                            "k:{\"port\":9100,\"protocol\":\"TCP\"}": {
                                ".": {},
                                "f:port": {},
                                "f:protocol": {},
                                "f:targetPort": {}
                            }
                        },
                        "f:selector": {
                            ".": {},
                            "f:app": {}
                        },
                        "f:sessionAffinity": {},
                        "f:type": {}
                    }
                }
            },
            {
                "manager": "dashboard",
                "operation": "Update",
                "apiVersion": "v1",
                "time": "2022-01-14T15:51:28Z",
                "fieldsType": "FieldsV1",
                "fieldsV1": {
                    "f:spec": {
                        "f:ports": {
                            "k:{\"port\":9100,\"protocol\":\"TCP\"}": {
                                "f:name": {}
                            }
                        }
                    }
                }
            }
        ]
    },
    "spec": {
        "ports": [
            {
                "name": "test-service",
                "protocol": "TCP",
                "port": 9100,
                "targetPort": 9100
            }
        ],
        "selector": {
            "app": "test-service"
        },
        "clusterIP": "****************",
        "type": "ClusterIP",
        "sessionAffinity": "None"
    },
    "status": {
        "loadBalancer": {}
    }
}

Upvotes: 1

Views: 565

Answers (1)

KubePony
KubePony

Reputation: 154

According to the Istio documentation, configuring fault only works for HTTP traffic, not for gRPC:

https://istio.io/latest/docs/reference/config/networking/virtual-service/#HTTPFaultInjection

Upvotes: 2

Related Questions