Skip to content

service (legacy)

1ctl service manages the Kubernetes Services that sit in front of your pods. A Service gives a deployment a stable internal address: as pods restart and their IPs change, the Service IP stays constant. Other workloads inside the cluster reach your app through this address without ever needing to track individual pod IPs.

pods (ephemeral IPs) → K8s Service (stable ClusterIP) → public route → public traffic

1ctl deploy creates a Service automatically. Use these commands when you need direct control — for example, to expose multiple ports, replace a broken Service, or wire up a manually managed deployment.

1ctl service list

Lists all Services associated with the current organisation. The output shows each Service’s name, namespace, target deployment, and the port it exposes.

Flags

FlagShortDefaultDescription
--output-otableOutput format: table or json.

Under the hood:

  1. GET /v1/cli/services — the API returns all Service records scoped to the authenticated org
  2. Results are read from the services table and sorted by creation time (newest last)

Examples

Terminal window
# List all services in the active org
1ctl service list
# Output as JSON for scripting
1ctl service list -o json

1ctl service upsert --deployment-id <id> --name <name> --port <port> [--namespace <ns>]

Creates a new Kubernetes ClusterIP Service for a deployment, or updates it if one with the same name already exists in the target namespace. This is idempotent — running it twice with the same arguments is safe.

Flags

FlagShortDefaultDescription
--deployment-id <id>requiredID of the deployment the Service should select pods for.
--name <name>requiredName of the Service. Also becomes the DNS label: <name>.<namespace>.svc.cluster.local.
--port <port>requiredPort number the Service exposes. Must match the container port your app listens on.
--namespace <ns>org namespaceKubernetes namespace to create the Service in. Defaults to your organisation’s namespace.

Under the hood:

  1. POST /v1/cli/services/upsert with the provided parameters
  2. The API looks up the deployment to retrieve its app label
  3. A ClusterIP Service is created (or patched) in Kubernetes via client-go — the selector targets pods carrying that app label
  4. The Service record is written to the services table with its cluster-assigned ClusterIP

Examples

Terminal window
# Create a service named "api" on port 8080
1ctl service upsert \
--deployment-id dep_01abc \
--name api \
--port 8080
# Same, but target a specific namespace
1ctl service upsert \
--deployment-id dep_01abc \
--name api \
--port 8080 \
--namespace production

Once created, your Service is reachable inside the cluster at:

api.production.svc.cluster.local:8080

1ctl service delete --service-id <id> [-y]

Deletes a Service. The Kubernetes resource is removed immediately, which means any public routes pointing to it will stop routing traffic. If 1ctl deploy originally created the Service, deleting it manually may cause your deployment to become unreachable until you recreate it.

Flags

FlagShortDefaultDescription
--service-id <id>requiredID of the Service to delete. Use 1ctl service list to look up IDs.
--yes-yfalseSkip the confirmation prompt.

Under the hood:

  1. DELETE /v1/cli/services/{serviceID}
  2. The API calls client-go to delete the K8s Service resource from the cluster
  3. The row is removed from the services table

Examples

Terminal window
# Delete with confirmation prompt
1ctl service delete --service-id svc_04xyz
# Delete without prompting — useful in scripts
1ctl service delete --service-id svc_04xyz -y