Knative Reverse Proxy (knrp) for local development of Knative application with/without magic DNS.
go install github.com/injustease/knrp@latestThe easiest way is using Knative quickstart.
Fetch the External IP.
# Kourier
kubectl --namespace kourier-system get service kourier
# Istio
kubectl --namespace istio-system get service istio-ingressgateway
# Contour
kubectl --namespace contour-external get service envoyExample output Kourier (External IP is pending and it is intentional, use localhost instead), e.g. localhost:80 or simply localhost.
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kourier LoadBalancer 10.96.97.137 <pending> 80:32354/TCP,443:32488/TCP 33mFetch the Service URL.
# kn
kn service list
# kubectl
kubectl get services.serving.knative.devExample output with service hello in the namespace default, e.g. http://hello.default.example.com.
# without magic DNS
NAME URL LATEST AGE CONDITIONS READY REASON
hello http://hello.default.example.com hello-00001 34m 3 OK / 3 True
# with magic DNS
NAME URL LATEST AGE CONDITIONS READY REASON
hello http://hello.default.127.0.0.1.sslip.io hello-00001 34m 3 OK / 3 True Command knrp <gateway> <service>
knrp localhost http://hello.default.127.0.0.1.sslip.ioOutput knrp.
2022/04/06 16:05:19 knrp run at port: 52070For more information run knrp --help.
You now expose Knative service to the internet with ngrok by using knrp address.
ngrok http 52070