hello-kubernetes icon indicating copy to clipboard operation
hello-kubernetes copied to clipboard

Ingress example not working

Open kimllee opened this issue 3 years ago • 2 comments

Hello,

The ingress example isn't working because now the api used is the networking v1 and the syntax doesn't seem to be recognized Tested with GKE 1.21.5 Thank you.

Name:             hello-kubernetes-ingress
Namespace:        hello-kubernetes
Address:          
Default backend:  default-http-backend:80 (10.20.0.7:8080)
TLS:
  hello-prod terminates XXXXXXXXXXX
Rules:
  Host        Path  Backends
  ----        ----  --------
  *           
              /hello-world(/|$)(.*)   hello-kubernetes-hello-world:80 (10.20.0.31:8080,10.20.1.30:8080)
Annotations:  acme.cert-manager.io/http01-edit-in-place: true
              cert-manager.io/cluster-issuer: letsencrypt
              kubernetes.io/ingress.class: nginx
              nginx.ingress.kubernetes.io/rewrite-target: /$2
Events:
  Type     Reason          Age                   From                      Message
  ----     ------          ----                  ----                      -------
  Warning  Rejected        <invalid>             nginx-ingress-controller  hello-kubernetes/hello-kubernetes-ingress was rejected: with error: spec.rules[0].host: Required value
  Warning  Rejected        <invalid>             nginx-ingress-controller  hello-kubernetes/hello-kubernetes-ingress was rejected: with error: spec.rules[0].host: Required value
  Warning  Rejected        <invalid>             nginx-ingress-controller  spec.rules[0].host: Required value
  Warning  Rejected        <invalid>             nginx-ingress-controller  spec.rules[0].host: Required value

kimllee avatar Jan 12 '22 09:01 kimllee

The ingress example probably shouldn't be there at all as Ingress configuration is typically cluster-specific.

dcorbe avatar Mar 04 '22 09:03 dcorbe

My adapted / working example on K3S 1.23

# hello-kubernetes-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-kubernetes-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - http:
      paths:
      - pathType: Prefix #Exact
        backend:
          service:
             name: hello-kubernetes-hello-world
             port: 
              number: 80
        path: /hello-world(/|$)(.*)
      - pathType: Prefix #Exact   
        backend:
          service:
             name: hello-kubernetes-custom-message
             port: 
                number: 80
        path: /custom-message(/|$)(.*)

frayos avatar Sep 12 '22 17:09 frayos