root@ubuntu:~/kubernetes-ingress/deployments/common# kubectl explain IngressClass
KIND:     IngressClass
VERSION:  networking.k8s.io/v1beta1

DESCRIPTION:
     IngressClass represents the class of the Ingress, referenced by the Ingress
     Spec. The `ingressclass.kubernetes.io/is-default-class` annotation can be
     used to indicate that an IngressClass should be considered default. When a
     single IngressClass resource has this annotation set to true, new Ingress
     resources without a class specified will be assigned this default class.

FIELDS:
   apiVersion   <string>
     APIVersion defines the versioned schema of this representation of an
     object. Servers should convert recognized schemas to the latest internal
     value, and may reject unrecognized values. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

   kind <string>
     Kind is a string value representing the REST resource this object
     represents. Servers may infer this from the endpoint the client submits
     requests to. Cannot be updated. In CamelCase. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

   metadata     <Object>
     Standard object's metadata. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

   spec <Object>
     Spec is the desired state of the IngressClass. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

root@ubuntu:~/kubernetes-ingress/deployments/common# kubectl explain IngressClass.spec
KIND:     IngressClass
VERSION:  networking.k8s.io/v1beta1

RESOURCE: spec <Object>

DESCRIPTION:
     Spec is the desired state of the IngressClass. More info:
     https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

     IngressClassSpec provides information about the class of an Ingress.

FIELDS:
   controller   <string>
     Controller refers to the name of the controller that should handle this
     class. This allows for different "flavors" that are controlled by the same
     controller. For example, you may have different Parameters for the same
     implementing controller. This should be specified as a domain-prefixed path
     no more than 250 characters in length, e.g. "acme.io/ingress-controller".
     This field is immutable.

   parameters   <Object>
     Parameters is a link to a custom resource containing additional
     configuration for the controller. This is optional if the controller does
     not require extra parameters.

root@ubuntu:~/kubernetes-ingress/deployments/common# kubectl explain IngressClass.spec.controller
KIND:     IngressClass
VERSION:  networking.k8s.io/v1beta1

FIELD:    controller <string>

DESCRIPTION:
     Controller refers to the name of the controller that should handle this
     class. This allows for different "flavors" that are controlled by the same
     controller. For example, you may have different Parameters for the same
     implementing controller. This should be specified as a domain-prefixed path
     no more than 250 characters in length, e.g. "acme.io/ingress-controller".
     This field is immutable.

 

root@ubuntu:~/kubernetes-ingress/deployments/common# kubectl create -f   ingress-k8s-class.yaml
error: error validating "ingress-k8s-class.yaml": error validating data: ValidationError(IngressClass.spec): invalid type for io.k8s.api.networking.v1beta1.IngressClassSpec: got "string", expected "map"; if you choose to ignore these errors, turn validation off with --validate=false
root@ubuntu:~/kubernetes-ingress/deployments/common# cat ingress-k8s-class.yaml
apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  name: nginx-k8s
  # annotations:
  #   ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller:kubernetes.io/ingress-controller
root@ubuntu:~/kubernetes-ingress/deployments/common# cat ingress-
ingress-class.yaml      ingress-k8s-class.yaml  
root@ubuntu:~/kubernetes-ingress/deployments/common# cat ingress-class.yaml 
apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  name: nginx-org
  # annotations:
  #   ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: nginx.org/ingress-controller

 

 

root@ubuntu:~/kubernetes-ingress/deployments/common# kubectl get ingressclass
NAME        CONTROLLER                         PARAMETERS   AGE
nginx-k8s   kubernetes.io/ingress-controller   <none>       14s
nginx-org   nginx.org/ingress-controller       <none>       4h30m
root@ubuntu:~/kubernetes-ingress/deployments/common#