Remove a service cluster

In removing a service cluster, Interlock removes all of the services that are used internally to manage the service cluster, while leaving all of the user services intact. For continued function, however, you may need to update, modify, or remove the user services that remain. For instance:

  • Any remaining user service that depends on functionality provided by the removed service cluster will need to be provisioned and managed by different means.

  • All load balancing that is managed by the service cluster will no longer be available following its removal, and thus must be reconfigured.

Following the removal of the service cluster, all ports that were previously managed by the service cluster will once again be available. Also, any manually created networks will remain in place.


To remove a service cluster:

  1. Obtain the current Interlock configuration file:

    CURRENT_CONFIG_NAME=$(docker service inspect --format '{{ \
    (index .Spec.TaskTemplate.ContainerSpec.Configs 0).ConfigName }}' \
    ucp-interlock)
    docker config inspect --format '{{ printf "%s" .Spec.Data }}' \
    $CURRENT_CONFIG_NAME > old_config.toml
    
  2. Open the old_config.toml file.

  3. Remove the subsection from [Extensions] that corresponds with the service cluster that you want to remove, but leave the [Extensions] section header itself in place. For example, remove the entire [Extensions.east] subsection from the config.toml file generated in Configure service clusters.

  4. Create a new docker config object from the old_config.toml file:

    NEW_CONFIG_NAME="com.docker.ucp.interlock.conf-$(( \
    $(cut -d '-' -f 2 <<< "$CURRENT_CONFIG_NAME") + 1 ))"
    docker config create $NEW_CONFIG_NAME config.toml
    
  5. Update the ucp-interlock service to use the new configuration:

     docker service update \
     --config-rm $CURRENT_CONFIG_NAME \
     --config-add source=$NEW_CONFIG_NAME,target=/config.toml \
    ucp-interlock
    
  6. Wait for two minutes, and then verify that Interlock has removed the services that were previously associated with the service cluster:

    docker service ls