Home > OS >  No matches for kind"gateway" and "virtualservice"
No matches for kind"gateway" and "virtualservice"

Time:10-07

I am using Docker Desktop version 3.6.0 which has Kubernetes 1.21.3.

I am following this tutorial to get started on Istio

https://istio.io/latest/docs/setup/getting-started/

Istio is properly installed as per the instructions.

Now whenever i try to apply the Istio configuration

by issuing the command kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml.

I get the following error

unable to recognize "samples/bookinfo/networking/bookinfo-gateway.yaml": no matches for kind "Gateway" in version "networking.istio.io/v1alpha3"
unable to recognize "samples/bookinfo/networking/bookinfo-gateway.yaml": no matches for kind "VirtualService" in version "networking.istio.io/v1alpha3"

I checked in internet and found that the Gateway and VirtualService resources are missing.

If i perform kubectl get crd i get no resources found

Content of bookinfo-gatway.yaml

    apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - "*"
  gateways:
  - bookinfo-gateway
  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

CodePudding user response:

Your issue seems to be related with the apiVersion rather than the object itself.

Try

kubectl explain gateway

and check the VERSION parameter. It probably will be networking.istio.io/v1beta1.

EDIT

I installed istio, and this is what it should look like:

# kubectl explain gateway
KIND:     Gateway
VERSION:  networking.istio.io/v1beta1

DESCRIPTION:
     <empty>

FIELDS:
   apiVersion   <string>
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   kind <string>
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata     <Object>
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

   spec <Object>
     Configuration affecting edge load balancer. See more details at:
     https://istio.io/docs/reference/config/networking/gateway.html

   status       <>

CodePudding user response:

The CRDs for istio should be installed as part of the istioctl install process, I'd recommend re-running the install if you don't have them available.

>>> ~/.istioctl/bin/istioctl install --set profile=demo -y
 Istio core installed
 Istiod installed
 Egress gateways installed
 Ingress gateways installed
 Installation complete

kubectl get po -n istio-system should look like

>>> kubectl get po -n istio-system
NAME                                   READY   STATUS    RESTARTS   AGE
istio-egressgateway-7ddb45fcdf-ctnp5   1/1     Running   0          3m20s
istio-ingressgateway-f7cdcd7dc-zdqhg   1/1     Running   0          3m20s
istiod-788ff675dd-9p75l                1/1     Running   0          3m32s

Otherwise your initial install has gone wrong somewhere.

  • Related