In a cluster kubernetes environment I have Traefik v3.2.1 and CertManager 1.16.1 and a program I am testing. when I try to apply this file: 022-red-ing.yml I get this error:
error: error validating "022-red-ing.yml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
I would like to define the file correctly but I am missing information since the documentation from where I copied it did not stated the apiVersion and kind.
The file is currently like this:
cat 022-red-ing.yml
apiVersion: networking.k8s.io/v1
kind: Ingress
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- program.example.domain
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: tls-program-ingress-http
mode: SIMPLE
- hosts:
- program.example.domain
port:
name: program-frontend
number: 80
protocol: HTTP
tls:
httpsRedirect: true
- hosts:
- '*'
port:
name: http
number: 80
protocol: HTTP
what apiVersion and kind should I set? If I prepend this code:
apiVersion: extensions/v1beta1
kind: Ingress
I get another error. right now when I do:
kubectl apply -f 022-red-ing.yml
I get
error: error when retrieving current configuration of:
Resource: "networking.k8s.io/v1, Resource=ingresses", GroupVersionKind: "networking.k8s.io/v1, Kind=Ingress"
Name: "", Namespace: "default"
from server for: "022-red-ing.yml": resource name may not be empty
I'm doing something wrong.
I'm almost positive that it is not, because that file is not a valid Kubernetes manifest (it's missing the
apiVersion
,kind
, andmetadata
sections).From the error message (
No matches for kind "Ingress" in version "extensions/v1beta1"
), it looks like you're using the incorrectapiVersion
in the manifest. Instead of:You need:
This is straight from the official documentation; it's not clear why you're using the wrong value, but it suggests you may be reading outdated material.