Uninstall NGINX Service Mesh

This topic explains how to uninstall NGINX Service Mesh.

Overview

This document contains instructions for uninstalling NGINX Service Mesh.

For Helm users, see how to uninstall using Helm.

For OpenShfit users, removal behaves differently in order to ensure all injected Pods are serviced. See the Remove section of the OpenShift Considerations document for more information.

Uninstalling does the following:

  1. Removes the control plane and its contents from Kubernetes.
  2. Deletes all NGINX Service Mesh traffic policies.

The nginx-meshctl command-line utility prints a list of resources that contain the sidecar proxies when the uninstall completes. You must re-roll the Deployments in Kubernetes to remove the sidecars. Until you re-roll the resources, the sidecar proxies still exist, but they don’t apply any rules to the traffic.

Uninstall the Control Plane

Before uninstalling the Service Mesh control plane, make sure your Kubernetes user has the permissions to access the internal NGINX Service Mesh API endpoints needed for removal. Below is an example of a ClusterRole with the necessary remove permissions:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: nsm-remove
rules:
- apiGroups:
  - nsm.nginx.com
  resources:
  - clear
  verbs:
  - create
- apiGroups:
  - nsm.nginx.com
  resources:
  - resources
  verbs:
  - list
Note:
If your Kubernetes user account has the ClusterAdmin role, then no additional permissions are necessary to run the remove command.

To uninstall the Service Mesh control plane using the nginx-meshctl command-line utility, run the command shown below.

nginx-meshctl remove

When prompted for confirmation, specify y or n.

Tip:

If you want to skip the confirmation prompt, add the -y flag as shown in the example below.

nginx-meshctl remove -y

Remove the Sidecar Proxy from Deployments

If your resources support Rolling Updates (Deployments, DaemonSets, and StatefulSets), run the following kubectl command for each resource to complete the uninstall.

kubectl rollout restart <resource type>/<resource name>

For example:

kubectl rollout restart deployment/frontend
Note:
If you want to redeploy NGINX Service Mesh after removing it, you need to re-roll the resources after the new NGINX Service Mesh is installed. Sidecars from an earlier NGINX Service Mesh installation won’t work with a new installation.
See Also:
Refer to the Kubernetes kubectl Cheat Sheet documentation for more information about rolling resources.