# Manage Knative routes
# Add route
You can add additional HTTP(S) routes pointing to your Knative apps by creating new serving.knative.dev/Route
resources:
# another-route.yaml
apiVersion: serving.knative.dev/v1
kind: Route
metadata:
name: another-route
namespace: demo
spec:
traffic:
- configurationName: hello-world # name of your Knative app / service
latestRevision: true
percent: 100
$ kubectl -n demo apply -f another-route.yaml
$ kubectl -n demo get route
NAME URL READY REASON
another-route https://another-route.demo.kube-plus.cloud True
hello-world https://hello-world.demo.kube-plus.cloud True
# List routes
Get a list of all current Knative routes within a namespace (demo
in the example below) by using the kn -n <namespace> route list
command as described here (opens new window) in detail.
$ kn -n demo route list
NAME URL READY
another-route https://another-route.demo.kube-plus.cloud True
hello-world https://hello-world.demo.kube-plus.cloud True
# Inspect a route
$ kn -n demo route describe hello-world
Name: hello-world
Namespace: demo
Age: 45m
URL: https://hello-world.demo.kube-plus.cloud
Service: hello-world
Traffic Targets:
100% @latest (hello-world-00001)
Conditions:
OK TYPE AGE REASON
++ Ready 44m
++ AllTrafficAssigned 45m
++ CertificateProvisioned 44m
++ IngressReady 44m
# Traffic management
With Knative routes you can also manage traffic routing to different revisions of an application / service, by modifying the traffic
spec of the service resource.
Initially your application might have a traffic
spec where 100% of traffic is routed to the latestRevision
of the service.
And then you can modify the spec so that traffic is split between multiple revisions, for example sending 50% of traffic to the current revision and 50% of traffic to another revision.
For example to split traffic for a service named example
, by sending 80% of traffic to the revision green
and 20% of traffic to the revision blue
, you could run the following command:
$ kn service update example-service --traffic green=80 --traffic blue=20
Consult this detailed documentation on Knative Traffic Management (opens new window) for more information.
# Routing blue/green deployments
Especially of interest might the section about routing with blue/green deployments (opens new window)