Links to Your Services
You have a few services running on Tilt. And they’re all green!
Now you want to navigate to them to see how they look.
Tilt standardizes your dev environment so that on every dashboard, you have links
to the services that you’re running. And Tilt takes care of the plumbing that makes
those links work, from
kubectl port-forward to public tunnels like
Displaying a Static Link
All resources in your Tiltfile support a
link to add links manually.
For example, you may want to point users to a database URL for a database reset workflow.
If your Tiltfile contains:
k8s_resource( workload='blog-site', links=[ 'blog-db.storage.acme.com', link('internal-eng.acme.com/docs/blog-db-reset', 'Blog db reset docs') ] )
then you will see the new links show up on the main dashboard.
You can also see the links on the individual resource page.
You can specify links for:
- Local servers run with
- Kubernetes servers with
- and Docker Compose servers with
kubectl port-forward tunnel
Kubernetes provides port
to allow you to access via your local machine with
Tilt exposes this feature through a configuration in
k8s_resource. For example, if you have in your
localhost:4002 will be connected to container port 4002.
Tilt automatically displays a link at the top of the screen. No need to manually create it with the
localhost:9000 will be connected to container port 4002.
Bulk Creation of
kubectl port-forward tunnels
If you’re starting out with Kubernetes and still exploring,
kubefwd can bulk-forward all your services automatically, rather
than forcing you to pick and choose which services you want tunnels for.
kubefwd operator will create port-forwards for every service
in the namespace you’re deploying to.
# kubefwd all namespaces Tilt deploys to. v1alpha1.extension_repo(name='default', url='https://github.com/tilt-dev/tilt-extensions') v1alpha1.extension(name='kubefwd:config', repo_name='default', repo_path='kubefwd')
The only downside of
kubefwd is that Tilt will need to prompt you for
privileges, because it changes the DNS on your local machine.
For more details, refer to the kubefwd extension documentation.
Naming All Those Port Forwards
A resource may have multiple port forwards. You can configure them with:
k8s_resource( workload='blog-site', port_forwards=['9000:4002', '9001:4003'] )
And you would see:
In this case, a user may not know which port forward corresponds to which part of your app, without reading the Tiltfile.
Tilt allows you to specify custom port forward names, displaying them instead of
localhost:<port-forward>. For example, specifying this in the Tiltfile
k8s_resource( workload='blog-site', port_forwards=[ port_forward(9000, 4002, name='blog-hero-post'), port_forward(9001, 4003, name='blog-archives') ] )
would show this in Tilt:
Read more in the
ngrok can create public tunnels for your services,
to expose them on a public URL rather than on
Tilt has an
ngrok operator that adds buttons to the Tilt UI, which you can
click to start/stop the public tunnel when you need it.
For more info, see: