apache / apisix-ingress-controller

APISIX Ingress Controller for Kubernetes
https://apisix.apache.org/
Apache License 2.0
975 stars 338 forks source link

no matches for kind "ApisixRoute" in version "apisix.apache.org/v2beta1" #608

Closed tutuV closed 2 years ago

tutuV commented 2 years ago

Issue description

"apisix.apache.org/v2beta1" is not ok. "apisix.apache.org/v2alpha1" is ok. why ?

Environment

image

tao12345666333 commented 2 years ago

Please provide more information

What happened:

What you expected to happen:

tutuV commented 2 years ago

@tao12345666333 helm install apisix apisix/apisix --namespace ingress-apisix helm install apisix-ingress-controller apisix/apisix-ingress-controller --namespace ingress-apisix helm install apisix-dashboard apisix/apisix-dashboard --namespace ingress-apisix

kubectl get all -n ingress-apisix image

kubectl apply -f deploy-httpd.yaml image

kubectl apply -f apisix-route.yaml image

if i use apisix.apache.org/v2beta1, that wont be ok. why ????????????????????????????????

kubectl get ApisixRoute test-route -n web-ns // SERVICE INGRESS PORT SERVICE is empty. why??????????????????????? image

kubectl describe ApisixRoute test-route -n web-ns image

How do I access "www.test.com/index" ?????????????????????????????

Where can I find information about apisix-ingress-controller (I only saw the docs directory in the Github package)????????

In "??????" There are four questions

tutuV commented 2 years ago

@tao12345666333 curl www.test.com:31495/index docker logs -f apisix-gateway-container容器

2021/07/30 10:29:19 [error] 46#46: 4527056 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer 2021/07/30 10:29:19 [error] 46#46: 4422815 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer

10.244.2.1 - - [30/Jul/2021:10:29:45 +0000] www.test.com:31495 "GET /index HTTP/1.1" 404 196 0.002 "-" "curl/7.29.0" 10.244.2.21:80 404 0.001 "http://www.test.com:31495"

2021/07/30 10:32:32 [error] 44#44: 4540224 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer 2021/07/30 10:32:32 [error] 44#44: 4540224 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to parse domain: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, etcd key: /apisix/ssl, context: ngx.timer

tokers commented 2 years ago

@tao12345666333 curl www.test.com:31495/index docker logs -f apisix-gateway-container容器

2021/07/30 10:29:19 [error] 46#46: 4527056 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer 2021/07/30 10:29:19 [error] 46#46: 4422815 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer

10.244.2.1 - - [30/Jul/2021:10:29:45 +0000] www.test.com:31495 "GET /index HTTP/1.1" 404 196 0.002 "-" "curl/7.29.0" 10.244.2.21:80 404 0.001 "http://www.test.com:31495"

2021/07/30 10:32:32 [error] 44#44: 4540224 [lua] resolver.lua:35: parse_domain(): failed to parse domain: apisix-etcd.ingress-apisix.svc.cluster.local, error: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, context: ngx.timer 2021/07/30 10:32:32 [error] 44#44: 4540224 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to parse domain: failed to query the DNS server: dns lookup pool exceeded retries (1): timeout, etcd key: /apisix/ssl, context: ngx.timer

It seems the DNS resolve was failed. You may try to check the availability of your kube-dns service.

tokers commented 2 years ago

your apisix-ingress-controller version (2.7);

We don't have such a version, please don't joke and paste the correct one.

tokers commented 2 years ago

Also, you may try to paste the result of kubectl get crds.

tao12345666333 commented 2 years ago

if i use apisix.apache.org/v2beta1, that wont be ok. why ????????????????????????????????

because of the default apisixRouteVersion is "apisix.apache.org/v2alpha1" https://github.com/apache/apisix-helm-chart/blob/f2602a84f93dc0362b0f4c14987e620993ac9bfa/charts/apisix-ingress-controller/values.yaml#L96

tao12345666333 commented 2 years ago

@tutuV can you provide more informations about kubernetes system componetes?

kubectl get pods -n kube-system
tutuV commented 2 years ago

@tao12345666333 I set up the environment again, ran the Echo service, Everything is fine except that kubectl get ApiRoute is not quite right. Maybe there was something wrong with the network.If there is no further suggestion, I will close the issue.

tokers commented 2 years ago

@tao12345666333 I set up the environment again, ran the Echo service, Everything is fine except that kubectl get ApiRoute is not quite right. Maybe there was something wrong with the network.If there is no further suggestion, I will close the issue.

What's the exact error you suffered from?

tao12345666333 commented 2 years ago

@tutuV any update?

sekfung commented 2 years ago

@tao12345666333 Following this article Install Ingress APISIX on Tencent TKE , and I tried to proxy my service. I got the same problem: no matches for kind "ApisixRoute" in version "apisix.apache.org/v2beta1"

And I have set config.kubernetes.ingressVersion=networking/v1beta1 because my Kubernetes version is between v1.14 and v1.19

Environment

your apisix version (2.7); your apisix-ingress-controller version (2.7); your Kubernetes cluster version (1.18.4);

kubectl get pods -n kube-system

NAME                                  READY   STATUS    RESTARTS   AGE
coredns-65d9c796fc-cd5pd              1/1     Running   0          10d
csi-cbs-controller-678fd94fd6-h6hwd   6/6     Running   0          83m
csi-cbs-node-cmzqq                    2/2     Running   3          80m
ip-masq-agent-j9xpm                   1/1     Running   0          80m
kube-proxy-b4lxb                      1/1     Running   0          80m
node-local-dns-kjtrz                  1/1     Running   0          80m
node-problem-detector-jfk9m           1/1     Running   0          80m
oom-guard-9swbk                       2/2     Running   0          80m
serf-agent-5xrcg                      1/1     Running   0          80m
serf-holder-7bf6bb75c6-wf7hg          1/1     Running   0          10d
tke-bridge-agent-8crp5                1/1     Running   1          80m
tke-cni-agent-x94rv                   1/1     Running   0          80m
tke-eni-agent-h8gxr                   1/1     Running   1          80m
tke-eni-ipamd-7879558d8f-gbwss        1/1     Running   0          83m
kubectl get crds
NAME                                              CREATED AT
apisixclusterconfigs.apisix.apache.org            2021-08-20T09:31:21Z
apisixconsumers.apisix.apache.org                 2021-08-20T09:31:21Z
apisixroutes.apisix.apache.org                    2021-08-20T09:31:21Z
apisixtlses.apisix.apache.org                     2021-08-20T09:31:21Z
apisixupstreams.apisix.apache.org                 2021-08-20T09:31:21Z
eipclaims.networking.tke.cloud.tencent.com        2021-08-13T09:47:50Z
nginxingresses.cloud.tencent.com                  2021-08-20T04:55:29Z
nodeeniconfigs.networking.tke.cloud.tencent.com   2021-08-13T09:47:47Z
tkeserviceconfigs.cloud.tencent.com               2021-08-13T08:46:29Z
volumesnapshotclasses.snapshot.storage.k8s.io     2021-08-20T10:03:34Z
volumesnapshotcontents.snapshot.storage.k8s.io    2021-08-20T10:03:34Z
volumesnapshots.snapshot.storage.k8s.io           2021-08-20T10:03:34Z
vpcenis.networking.tke.cloud.tencent.com          2021-08-13T09:47:51Z
vpcipclaims.networking.tke.cloud.tencent.com      2021-08-13T09:47:48Z
vpcips.networking.tke.cloud.tencent.com           2021-08-13T09:47:49Z

Could you give me some help? thx

tao12345666333 commented 2 years ago

Can you show me your helm list results?

sekfung commented 2 years ago

@tao12345666333 helm list return nothing

tokers commented 2 years ago

@sekfung Could you show us the result of kubectl get crds.

sekfung commented 2 years ago

@tokers Hi, here

kubectl get crds
NAME                                              CREATED AT
apisixclusterconfigs.apisix.apache.org            2021-08-20T09:31:21Z
apisixconsumers.apisix.apache.org                 2021-08-20T09:31:21Z
apisixroutes.apisix.apache.org                    2021-08-20T09:31:21Z
apisixtlses.apisix.apache.org                     2021-08-20T09:31:21Z
apisixupstreams.apisix.apache.org                 2021-08-20T09:31:21Z
eipclaims.networking.tke.cloud.tencent.com        2021-08-13T09:47:50Z
nginxingresses.cloud.tencent.com                  2021-08-20T04:55:29Z
nodeeniconfigs.networking.tke.cloud.tencent.com   2021-08-13T09:47:47Z
tkeserviceconfigs.cloud.tencent.com               2021-08-13T08:46:29Z
volumesnapshotclasses.snapshot.storage.k8s.io     2021-08-20T10:03:34Z
volumesnapshotcontents.snapshot.storage.k8s.io    2021-08-20T10:03:34Z
volumesnapshots.snapshot.storage.k8s.io           2021-08-20T10:03:34Z
vpcenis.networking.tke.cloud.tencent.com          2021-08-13T09:47:51Z
vpcipclaims.networking.tke.cloud.tencent.com      2021-08-13T09:47:48Z
vpcips.networking.tke.cloud.tencent.com           2021-08-13T09:47:49Z
sober-wang commented 2 years ago

So How to fix the problem ? I met it, too.

[root@k8smaster05 cloudbg]# kubectl  apply -f myhttp-ingress.yaml 
ingress.networking.k8s.io/myhttp-ingress configured
error: unable to recognize "myhttp-ingress.yaml": no matches for kind "ApisixRoute" in version "apisix.apache.org/v2alpha1"
[root@k8smaster05 cloudbg]# cat myhttp-ingress.yaml 
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: myhttp-ingress
  namespace: ws
  annotations:
    kubernetes.io/ingress.class: apisix
spec:
  rules:
  - host: myhttp.storm.io
    http:
      paths:
      - backend:
          serviceName: myhttp-svc
          servicePort: 9527
        path: /

---
apiVersion: apisix.apache.org/v2alpha1
kind: ApisixRoute
metadata:
  name: myhttp-route
  namespace: ws 
spec:
  http:
  - name: myhttp-route
    match:
       hosts:
       - myhttp.apisix-route.storm.io
       paths:
       - /*
    backend:
      serviceName: myhttp-svc
      servicePort: 9527
[root@k8smaster05 cloudbg]# [root@k8smaster05 cloudbg]# kubectl -n ws describe  configmaps myapisix-ingress-controller-configmap 
Name:         myapisix-ingress-controller-configmap
Namespace:    ws
Labels:       app.kubernetes.io/instance=myapisix-ingress-controller
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=apisix-ingress-controller
              app.kubernetes.io/version=1.1.0
              helm.sh/chart=apisix-ingress-controller-0.6.0
Annotations:  meta.helm.sh/release-name: myapisix-ingress-controller
              meta.helm.sh/release-namespace: ws

Data
====
config.yaml:
----
# log options
log_level: "info"
log_output: "stderr"
http_listen: ":8080"
enable_profiling: true
kubernetes:
  kubeconfig: ""
  resync_interval: "6h"
  app_namespaces:
  - "*"
  ingress_class: "apisix"
  ingress_version: "networking/v1"
  apisix_route_version: "apisix.apache.org/v2beta1"
apisix:
  base_url: "http://apisix-admin:9180/apisix/admin"
  admin_key: "edd1c9f034335f136f87ad84b625c8f1"

Events:  <none>
[root@k8smaster05 cloudbg]# 

my environment.

tokers commented 2 years ago

@sober-wang How did you deploy apisix-ingress-controller? Just install it or do you upgrade it from an old version?

tao12345666333 commented 2 years ago

@sekfung please run this command:

kubectl get crd apisixroutes.apisix.apache.org -o jsonpath='{ .spec.versions[*].name }' -A                    

you will get the following output:

✗ kubectl get crd apisixroutes.apisix.apache.org -o jsonpath='{ .spec.versions[*].name }' -A
v1 v2alpha1 v2beta1
sekfung commented 2 years ago

@tao12345666333 Ok. I got v1 v2alpha1, and i don't know why v2beta1 not supported in my env.

 ~  kubectl get crd apisixroutes.apisix.apache.org -o jsonpath='{ .spec.versions[*].name }' -A

v1 v2alpha1%

So I try to change it to v2alpha1, it works.

tokers commented 2 years ago

@tao12345666333 Ok. I got v1 v2alpha1, and i don't know why v2beta1 not supported in my env.

 ~  kubectl get crd apisixroutes.apisix.apache.org -o jsonpath='{ .spec.versions[*].name }' -A

v1 v2alpha1%

So I try to change it to v2alpha1, it works.

Seems that you don't use the lastest helm chart to deploy the apisix-ingress-controller, otherwise the v2beta1 should be there.

tao12345666333 commented 2 years ago

This issue has not been updated for too long. You can try to update to the latest version to verify if there are any problems.

I will close this issue. Feel free to reopen it, if you have any question.