I’ve found this doc Istio / Kubernetes Ingress but it’s not relevant anymore because kind: Ingress
uses newer api in Kubernetes v1.24.
kubectl apply -f - <<EOF
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: istio
name: ingress
spec:
rules:
- host: httpbin.example.com
http:
paths:
- path: /status/*
backend:
serviceName: httpbin
servicePort: 8000
EOF
error: unable to recognize "STDIN": no matches for kind "Ingress" in version "networking.k8s.io/v1beta1"
Tried to fix this declaration based on original nginx Ingress declaration but it still doesn’t work as intended.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: httpbin-istio-ingress
annotations:
kubernetes.io/ingress.class: istio
spec:
rules:
- host: httpbin.example.com
http:
paths:
- path: /status
pathType: Prefix
backend:
service:
name: httpbin
port:
number: 8000
ingressClassName: istio
$ kubectl get ing
NAME CLASS HOSTS ADDRESS PORTS AGE
httpbin-istio-ingress istio httpbin.example.com 192.168.1.70 80 99m
$ curl -s -I -HHost:httpbin.example.com "http://192.168.1.70/status/200"
HTTP/1.1 404 Not Found
date: Mon, 14 Mar 2022 21:39:18 GMT
server: istio-envoy
transfer-encoding: chunked
httpbin
service is working well through ClusterIP
:
$ curl -I -s http://10.108.162.227:8000/status/200
HTTP/1.1 200 OK
server: istio-envoy
date: Mon, 14 Mar 2022 21:40:52 GMT
content-type: text/html; charset=utf-8
access-control-allow-origin: *
access-control-allow-credentials: true
content-length: 0
x-envoy-upstream-service-time: 1
x-envoy-decorator-operation: httpbin.default.svc.cluster.local:8000/*
What am I doing wrong?