kubeval
kubeval copied to clipboard
Failed initializing schema ingress-networking-v1.json 404
hello there, i was trying to validate ingresses, but I cannot do so because the schema URL gives me 404.
linux@sdombi-vpc-bastion:~$ cat ingress2.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
service:
name: test
port:
number: 80
linux@sdombi-vpc-bastion:~$ kubeval ingress2.yaml
ERR - ingress2.yaml: Failed initializing schema https://kubernetesjsonschema.dev/master-standalone/ingress-networking-v1.json: Could not read schema from HTTP, response status is 404 Not Found
linux@sdombi-vpc-bastion:~$ kubeval --version
Version: 0.16.1
Commit: f5dba6b486fa18b9179b91e15eb6f2b0f7a5a69e
Date: 2021-03-30T15:17:06Z
Am i doing something wrong here? Thanks for the help in advance.
Not isolated to ingress: Failed initializing schema https://kubernetesjsonschema.dev/master-standalone/certificate-cert-manager-v1.json: Could not read schema from HTTP, response status is 404 Not Found
Likewise. I can use versions that appear on main page https://kubernetesjsonschema.dev
But for example I can't specify various 1.20.x patches (or anything 1.20 for that matter) or 1.19 or the like
Will there be a patch soon? Or is there a workaround?
For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.
This should solve the errors related to Kubernetes versions.
Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?
For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.
This should solve the errors related to Kubernetes versions.
Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?
@yannh Nice work! Wondering if you tried getting your changes merged to this repo. It would be nice to have only one place to refer. That being said I don't know what's the process of merging PRs here, as I can see lots of them still unmerged.
As noted above to use newer schemas use command like below
kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master -d mydirectory
Thank you @jeremybusk and @yannh 🚀
For a long lasting fix, I applied an alias:
alias kubeval="kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master "
I've tried applying the fix:
for file in $(find ./output -type f -iname '*.y*ml'); do
kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master $file --strict
done
I'm getting:
1 error occurred:
* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/ingress-networking-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/ingress-networking-v1.json: EOF
1 error occurred:
* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/service-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/service-v1.json: EOF
1 error occurred:
* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/deployment-apps-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/deployment-apps-v1.json: EOF
1 error occurred:
* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/cronjob-batch-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/cronjob-batch-v1.json: EOF
Am I doing anything wrong?
For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.
This should solve the errors related to Kubernetes versions.
Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?
thanks! this is very helpful