Remove a Service

Prerequisites

    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

Overview

    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.

Steps

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.
1
greymatter delete catalog-service fibonacci
Copied!
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.
1
greymatter delete cluster edge-to-fibonacci-cluster
Copied!
Then delete the route and shared_rules. We can delete these both with a single call because they're explicitly linked by object keys.
1
greymatter delete --deep=true route edge-to-fibonacci-route
2
greymatter delete route edge-to-fibonacci-route-slash
Copied!
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:.
1
kubectl delete deployment fibonacci
Copied!

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 its local microservice.
1
greymatter delete cluster fibonacci-cluster
Copied!
Then we'll delete the domain, and use the --deep option to make sure no other Sidecars are using it.
1
greymatter delete --deep domain fibonacci-domain
Copied!
Third, delete the listener:
1
greymatter delete listener fibonacci-listener
Copied!
Then we can delete the route and shared_rules together
1
greymatter delete --deep route fibonacci-local-route
Copied!
Finally, we'll delete the overarching proxy object.
1
greymatter delete proxy fibonacci-proxy
Copied!
The service and all configs are now removed from GreyMatter.
Last modified 2mo ago