Problem scenario
When writing the configuration file of the ingress controller entry controller of kubernetes
kubectl apply -f ingress-srv.yaml
Three Errors:
-
- Error 1:
no matches for kind “Ingress” in version “networking.k8s.io/v1beta1”
- Error 2: pathType is wrong after I modified APIVersion to v1.
Error 3: Error from server (InternalError): error when creating “ingress-srv.yaml”: Internal error occurred: failed calling webhook “validate.nginx.ingress.kubernetes.io”: Post “https://ingress-nginx-controller-admission.ingress-nginx.svc:443/networking/v1/ingresses?timeout=10s”: dial tcp 10.102.20.133:443: connect: connection refused
Solution 1:
no matches for kind “Ingress” in version “networking.k8s.io/v1beta1”
Modify
apiVersion: networking.k8s.io/v1beta1
to
apiVersion: networking.k8s.io/v1
Solution 2:
pathType is wrong after I modified APIVersion to v1.
It is the version issue. here is the mofied codes below:
Original codes (report error):
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-srv
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: posts.com
http:
paths:
- path: /posts/create
backend:
serviceName: posts-clusterip-srv
servicePort: 4000
- path: /posts
backend:
serviceName: query-srv
servicePort: 4002
- path: /posts/?(.*)/comments
backend:
serviceName: comments-srv
servicePort: 4001
- path: /?(.*)
backend:
serviceName: client-srv
servicePort: 3000
Here is the modified code:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-srv
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
rules:
- host: posts.com
http:
paths:
- pathType: Prefix
path: "/posts/create"
backend:
service:
name: posts-clusterip-srv
port:
number: 4000
- pathType: Prefix
path: "/posts"
backend:
service:
name: query-srv
port:
number: 4002
- pathType: Prefix
path: "/posts/?(.*)/comments"
backend:
service:
name: comments-srv
port:
number: 4001
- pathType: Prefix
path: "/?(.*)"
backend:
service:
name: client-srv
port:
number: 3000
Solution 3:
1. First kubectl get ValidatingWebhookConfiguration
2. Then kubectl delete -A ValidatingWebhookConfiguration ingress-nginx-admission
3. Delete that admission, and then it’s normal
Read More:
- [Solved] Internal error occurred: failed calling webhook “validate.nginx.ingress.kubernetes.io”:
- k8s kubernetes ingress error: endpoints “default-http-backend“ not found
- error: error validating “ingress-tomcat6.yaml“: error validating data: [ValidationError(Ingress.spec
- kubernetes Error from server (AlreadyExists): error when creating “kubernetes-dashboard.yaml”: serv
- [Solved] Error from server (InternalError): error when creating “ingress.yaml”: Internal error occurred: fail
- [Solved] Rancher Add User Error: x509: certificate has expired Internal error occurred: failed calling webhook “rancherauth.cattle.io”:
- [Solved] Error: Could not get apiVersions from Kubernetes
- Kubernetes reported an error: matchexpressions: [] v1. Labelselector requirement (NIL)}: field is immutable
- [Solved] Kubernetes Error: failed to list *core.Secret: unable to transform key
- Error reporting and resolution of kubernetes installation
- Kubernetes create secret Error: Error from server (InternalError): Internal error occurred…
- Nginx Container Error: nginx: [emerg] mkdir() “/var/cache/nginx/client_temp“ failed (13: Permission denied)
- Kubernetes Error: Error in configuration: unable to read client-cert* unable to read client-key*
- [Solved] Docker Start nginx error: driver failed programming external connectivity on endpoint nginx
- [Solved] Playbook Start Nginx Error: Unable to start service nginx: Job for nginx.service fd with error code
- [Solved] MAC Nginx Error: ginx.pid“ failed (2: No such file or directory)
- [Solved] Windows Nginx Startup Error: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
- [Solved] Nginx Request 500 Error: CreateFile() “/temp/client_body_temp/0000000013” failed (5: Access is denied)
- Gitlab nginx wont start to work. [down: nginx: 1s, normally up, want up; run: log: (pid 20128)xxx]