DevZero Logo
DevZero

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 ls

This will usually be the network that has current next to it. For example, dz network ls

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 ls

For example,

dz cluster ls

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-kubeconfig

Access the current kubeconfig to view the resources in the cluster,

kubectl get services -A

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-9f8c8bfece3b44ac97103ab79e495aa0

Expose the service on that network.

dz cluster service expose cluster-0901025e6f604624bf1296791c7b64b3 default user-store

Then, get its URL

dz cluster service list

Interact with the service.

curl https://default-frontend.team-03f3f9b48aa3465ca-9f8c8bfece3b44ac97103ab79e495aa0.dv0.io/ping

Developing/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.

Service Stack on K8s

If the user is working on user-store, they can either:

  1. build a new container image and deploy it into the cluster to see it working end-to-end (slower)
  2. reroute traffic for the user-store service to their instance of user-store running in the workspace or laptop (faster)

Service Stack on K8s with interception

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.9

Restore

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-store

Exposing 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.

On this page