axonweb3 / axon-devops

4 stars 12 forks source link

k8s-deploy: error resource mapping not found for name #66

Closed zzhengzhuo closed 2 years ago

zzhengzhuo commented 2 years ago

When I am deploying axon according to https://github.com/nervosnetwork/axon-devops/blob/main/k8s-deploy/README.md and running command make axon-deploy, it gives me error error: resource mapping not found for name: "axon-ingress" namespace: "axon" from "./k8s/ingress/axon-ingress.yaml": no matches for kind "Ingress" in version "extensions/v1beta1". The logs are:

./k8s/axon/deploy.sh deploy
DEBUG create configmap for axons, please wait...
configmap/node1-toml created
configmap/node2-toml created
configmap/node3-toml created
configmap/node4-toml created
configmap/genesis created
configmap/db-options created
DEBUG deploy axons, please wait...
service/axon1 unchanged
statefulset.apps/axon1 created
service/axon2 unchanged
statefulset.apps/axon2 created
service/axon3 unchanged
statefulset.apps/axon3 created
service/axon4 unchanged
statefulset.apps/axon4 created
service/axon-chain unchanged
error: resource mapping not found for name: "axon-ingress" namespace: "axon" from "./k8s/ingress/axon-ingress.yaml": no matches for kind "Ingress" in version "extensions/v1beta1"
ensure CRDs are installed first
persistentvolume/axon-logs-pv configured
persistentvolumeclaim/axon-logs-pvc configured
DEBUG waiting for axons running...
axons not stable,please have a check

Running Environment

liya2017 commented 2 years ago

Did you deploy the ingress-controller? doc: https://kubernetes.io/zh/docs/concepts/services-networking/ingress/

zzhengzhuo commented 2 years ago

Maybe I should learn more about k8s. However, IMHO, the doc may need a guide that starting from zero. Appreciate for your time, I will close this issue.

liya2017 commented 2 years ago

Maybe I should learn more about k8s. However, IMHO, the doc may need a guide that starting from zero. Appreciate for your time, I will close this issue.

Yes, will update the doc later

e00dan commented 2 years ago

Can we reopen the issue?

I get the same problem and looks like this repository is using a deprecated version of Kubernetes extensions. Check: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#ingress-v122

I think k8s-deploy/k8s/ingress/axon-ingress.yaml should be using apiVersion: networking.k8s.io/v1 instead of apiVersion: extensions/v1beta1 (deprecated).

cc @liya2017 @zzhengzhuo

liya2017 commented 2 years ago

I think k8s-deploy/k8s/ingress/axon-ingress.yaml should be using apiVersion: networking.k8s.io/v1 instead of apiVersion: extensions/v1beta1 (deprecated).

Thanks, will have a try later.

And do you mean get the error error: resource mapping not found for name: "axon-ingress" namespace: "axon" from "./k8s/ingress/axon-ingress.yaml": no matches for kind "Ingress" in version "extensions/v1beta1" ensure CRDs are installed first? If yes ,please follow https://github.com/axonweb3/axon-devops/issues/66#issuecomment-1124469398.

e00dan commented 2 years ago

I think k8s-deploy/k8s/ingress/axon-ingress.yaml should be using apiVersion: networking.k8s.io/v1 instead of apiVersion: extensions/v1beta1 (deprecated).

Thanks, will have a try later.

And do you mean get the error error: resource mapping not found for name: "axon-ingress" namespace: "axon" from "./k8s/ingress/axon-ingress.yaml": no matches for kind "Ingress" in version "extensions/v1beta1" ensure CRDs are installed first? If yes ,please follow #66 (comment).

Yes. My version of k8:

➜  k8s-deploy git:(35406eb) ✗ kubectl version --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.25.0
Kustomize Version: v4.5.7
Server Version: v1.25.0

I tried running nginx ingress by using helm command and without and it didn't help:

helm upgrade --install ingress-nginx ingress-nginx   --repo https://kubernetes.github.io/ingress-nginx   --namespace nginx-ingress --create-namespace

It seems that after updating the file is started working:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  namespace: axon
  annotations:
    kubernetes.io/ingress.class: "nginx"
  name: axon-ingress
spec:
  rules:
  - host: axon1-testnet-monitor.nervos.tech
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: axon1
            port:
              number: 8100

  - host: axon2-testnet-monitor.nervos.tech
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: axon2
            port:
              number: 8100

  - host: axon3-testnet-monitor.nervos.tech
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: axon3
            port:
              number: 8100

  - host: axon4-testnet-monitor.nervos.tech
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: axon4
            port:
              number: 8100