Knative: Operator’s Handbook

Direct endpoints for Revisions

In default domains, you've learned that every KService gets an internal and external domain name. But what if you are splitting traffic between multiple Revisions, and you still need “dedicated domains” that are routed directly to a specific revision (and skip traffic splitting)?

For this, you need to specify a tag value in the spec.traffic elements of your KService you configured while splitting traffic.

This creates additional domain names (both internal and external), prefixed with the specified tag, that routes directly to a particular Revision:

{TAG}-{NAME}.{NAMESPACE}.svc.cluster.local
{TAG}-{NAME}.{NAMESPACE}.example.com

For example after deploying v1 and v2 of your app like here:

[...]
spec:
  traffic:
  - revisionName: hello-kjzfl # v1
    percent: 50
    tag: old
  - revisionName: hello-js4x4 # v2
    percent: 50
    tag: new

As a result, you now get a dedicated route to these revisions on domains:

You can see these URLs by running kubectl describe ksvc hello.

Tip: Dedicated tag for your latest and older Revisions

If you want the ability to directly visit your latest ready revision, create a traffic rule that receives no traffic, and tag it with a name like latest:

  - latestRevision: true
    percent: 0
    tag: latest

Similarly, you can keep your older Revisions in the traffic: list and tag them with their name and 0% traffic to have an ability to always reach them.

Configuring the name format

To customize the defaukt {.Tag}-{.Name} format, edit the config-network ConfigMap in knative-serving namespace.

Search for tagTemplate, read its doc and add a new field under data: section.