Remove a Service


  1. An existing Grey Matter deployment running on Kubernetes _(tutorial)

  2. kubectl or oc setup with access to the cluster

  3. greymatter cli setup with access to the deployment


  1. Delete service from the Grey Matter application

  2. Delete Edge routes

  3. Delete pod with the service and sidecar

  4. Delete Service Configurations

NOTE: The exact configurations and commands done here assume you've gone through the service launch tutorial to setup this service. For any other service; you'll just need to substitute your object keys and service deployments where appropriate.


1. Delete Catalog Entry

The first step is to remove the service entry from the Catalog server so that users will not see it and expect to be able to use it.

greymatter delete catalog-service fibonacci

This will remove the service card from display.

2. Edge Routing

Next we'll remove any Edge routing configuration. This will prevent users from using the service.

First delete the cluster object.

greymatter delete cluster edge-to-fibonacci-cluster

Then delete the route and shared_rules. We can delete these both with a single call because they're explicitly linked by object keys.

greymatter delete --deep=true route edge-to-fibonacci-route
greymatter delete route edge-to-fibonacci-route-slash

Shortly after these steps (generally a few seconds) the Edge will have removed the configuration to route to this service and users can no longer call the service.

3. Delete Deployment

Now that the service is no longer routed to from the edge, we can fully spin down the pod so that it no longer can receive any traffic and stops announcing into the mesh. This can be done in any way supported by k8s:

  • Scale the deployment/replicaset to 0

  • Delete the resources (deployment, replicaset, pod)

Assuming you've followed out tutorial, the deployment set can be removed the kubectl command:.

kubectl delete deployment fibonacci

4. Delete Sidecar config

NOTE This step is optional for removing a service, and should only be done if this service is not expected to spin back up. These configuration objects are not sent to any Sidecar now that the pod is spun down, and nothing is referencing them for routing.

The last step is to delete the configuration objects in the API for this service.

First we'll delete the cluster for the Sidecar to talk to it's local microservice.

greymatter delete cluster fibonacci-cluster

Then we'll delete the domain, and use the --deep option to make sure no other Sidecars are using it.

greymatter delete --deep domain fibonacci-domain

Third, delete the listener:

greymatter delete listener fibonacci-listener

Then we can delete the route and shared_rules together

greymatter delete --deep route fibonacci-local-route

Finally, we'll delete the overarching proxy object.

greymatter delete proxy fibonacci-proxy

The service and all configs are now removed from GreyMatter.