Search code examples
kubernetesistiocert-manageristio-gatewayistio-operator

Why I cant find istio gateway under namespace of istio-system or any other namespace after creating?


I have set up istio for my k8s cluster and it seems successfully working. The istioctl also works and return version 1.17.2 which is compatible with my k8s cluster. Deployment output is as follows.

k8s@k8master-virtual-machine:~$ kubectl get pods -n istio-system
NAME                                   READY   STATUS    RESTARTS   AGE
istio-egressgateway-85649899f8-ccgs4   1/1     Running   0          2m58s
istio-ingressgateway-f56888458-bzkfk   1/1     Running   0          2m58s
istiod-64848b6c78-74s48                1/1     Running   0          3m2s

k8s@k8master-virtual-machine:~/istio-yamls$ kubectl get rolebindings -n istio-system
NAME                       ROLE                            AGE
istio-egressgateway-sds    Role/istio-egressgateway-sds    27m
istio-ingressgateway-sds   Role/istio-ingressgateway-sds   27m
istiod                     Role/istiod                     27m
istiod-istio-system        Role/istiod-istio-system        27m

k8s@k8master-virtual-machine:~/istio-yamls$ kubectl get roles -n istio-system
NAME                       CREATED AT
istio-egressgateway-sds    2023-05-25T06:48:22Z
istio-ingressgateway-sds   2023-05-25T06:48:22Z
istiod                     2023-05-25T06:48:18Z
istiod-istio-system        2023-05-25T06:48:16Z

Problem: The very strange problem I faced is as follows. When I apply my gateway file with kubectl apply -f gateway.yaml it shows created.

k8s@k8master-virtual-machine:~/istio-yamls$ kubectl apply -f gateway.yaml
gateway.networking.istio.io/testmy-gateway created

But when I use the get command to see the status I see no resources found.

k8s@k8master-virtual-machine:~/istio-yamls$ kubectl get gateway -n istio-system
No resources found in istio-system namespace.

In my YAML file, I used the namespace istio-system as this is my yaml file.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: testmy-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:

  - port:
      number: 80
      name: gw-http
      protocol: HTTP
    hosts:
    - '*'

What I have done to fix it? I look to the gateway in all namespaces and I found nothing. I uninstall istio and delete its namespace CRDs and all the data to start clean and still face the same issue. I create a new k8s cluster with the same resources and deploy this Istio setup it works perfectly.

I found a StackOverflow question like my problem but the answer is just one comment. I am struggling to understand the logic behind it.

What Do I want? As the same Istio setup and yaml files perfectly work on another cluster, it means something is wrong with this cluster. I have tried everything to find the problem but no luck. I need to find out why my gateway file is deployed here but not shown. OR Please Explain the other question how does that information matter? I even check the gateway name and deeply it and found the same issue. Any help suggestions and support will be appreciated. Thanks in Advance.


Solution

  • When I run kubectl get crd | grep gateways I saw four gateways

    gateways.gateway.networking.k8s.io
    gateways.networking.istio.io
    gateways.networking.istio.local
    httpgateways.gateway.solo.io
    

    I deleted all of them with this command kubectl delete crd gateways......... After I run istioctl install --set profile=demo -y It install imp CRD again.

    When I deploy again the gateway.yaml file it was showing an error

    Error from server (NotFound): Unable to list "gateway.solo.io/v1, Resource=gateways": the server could not find the requested resource (get gateways.gateway.solo.io)
    

    Finally, I restart all 3 deployments from istio-system namespace

    NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
    istio-egressgateway    1/1     1            1           138m
    istio-ingressgateway   1/1     1            1           138m
    istiod                 1/1     1            1           138m
    

    Now when I deploy the gateway.yaml file it works.

    However, I am still looking for some explanation of why these crd and gateways matter and what are their roles? How come they are not deleted when I clean everything?

    I hope this helps someone.