Services
How to interact with services running on DevZero Kubernetes
Interacting with a service
Identify the network that your device is currently on.
dz network lsThis will usually be the network that has current next to it.
For example,

Here, the current network is the default network with ID network-9f8c8bfece3b44ac97103ab79e495aa0.
Identify the service that you would like to expose.
Get the cluster ID that is currently running your service. You can do this by either visiting DevZero Dashboard: Cluster or by running
dz cluster lsFor example,

Say, we want to use abcd dev cluster with ID cluster-0901025e6f604624bf1296791c7b64b3.
Access the current kubeconfig to view the resources in the cluster, or visit DevZero Dashboard: Cluster
dz cluster kubeconfig cluster-0901025e6f604624bf1296791c7b64b3 --update-kubeconfigAccess the current kubeconfig to view the resources in the cluster,

Let's pick user-store that's running in the default namespace, and listening on port 8080.
Set up the operator to expose services.
dz cluster service setup-operator cluster-0901025e6f604624bf1296791c7b64b3 network-9f8c8bfece3b44ac97103ab79e495aa0Expose the service on that network.
dz cluster service expose cluster-0901025e6f604624bf1296791c7b64b3 default user-storeThen, get its URL

Interact with the service.
curl https://default-frontend.team-03f3f9b48aa3465ca-9f8c8bfece3b44ac97103ab79e495aa0.dv0.io/pingDeveloping/testing a service
This assumes the reader has gone through the steps in the previous section.
Say, this is currently the dependency graph for the services running in the cluster.

If the user is working on user-store, they can either:
- build a new container image and deploy it into the cluster to see it working end-to-end (slower)
- reroute traffic for the
user-storeservice to their instance ofuser-storerunning in the workspace or laptop (faster)

Intercept
For interception ([2] in list above), run:
dz cluster service intercept cluster-0901025e6f604624bf1296791c7b64b3 default user-store <target network ip>where <target network ip> is either your laptop or your workspace.
For example,
To get the network IPs,
% dz net status
Current Network: default
╭──────────────────────────────────┬─────────────────────────────────────────┬──────────────────────────────────┬────────────────────────┬─────────────────────────────────────────────────────────────╮
│ IP │ HOSTNAME │ OWNER │ OS │ STATUS │
├──────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────┼────────────────────────┼─────────────────────────────────────────────────────────────┤
│ 100.115.56.9 │ debosmits-air-zi36pvqw │ debo@devzero.io │ macOS │ online │
│ 100.126.73.89 │ broad-boa-ebks │ debo@devzero.io │ linux │ online │
│ 100.77.11.119 │ junco-sun-a7wfuvi9 │ debo@devzero.io │ js │ online │
│ 100.122.19.111 │ neutral-anteater-slxl │ debo@devzero.io │ linux │ active; relay "sea", tx 4830296 rx 8855784 │
╰──────────────────────────────────┴─────────────────────────────────────────┴──────────────────────────────────┴────────────────────────┴─────────────────────────────────────────────────────────────╯If your version of user-store is running on abcdsmits-air-zi36pvqw, run
dz cluster service intercept cluster-0901025e6f604624bf1296791c7b64b3 default user-store 100.115.56.9Restore
To restore the state for the user-store service to make it point to the version deployed on the cluster:
dz cluster service restore cluster-0901025e6f604624bf1296791c7b64b3 default user-storeExposing a service to the public internet
We are currently working with design partners on supporting this experience. If you would like to participate, please send an email to support@devzero.io, or visit https://devzero.io/dashboard and click the "chat" icon in the bottom right-hand side of your browser window.