Uninstalling Submariner
Starting with Submariner 0.12, the recommended way to uninstall Submariner is via the subctl uninstall command.
This will automatically remove Submariner and its components from a given cluster. For previous versions, Submariner would need to be
uninstalled manually.
Automated Uninstall
Issue the subctl uninstall command against the cluster you want to uninstall Submariner from. Example
output:
$ subctl uninstall --kubeconfig output/kubeconfigs/cluster1
? This will completely uninstall Submariner from the cluster cluster1. Are you sure you want to continue? Yes
✓ Checking if the connectivity component is installed
✓ The connectivity component is installed
✓ Deleting the Submariner resource - this may take some time
✓ Deleting the Submariner cluster roles and bindings
✓ Deleted the "submariner-diagnose" cluster role and binding
✓ Deleted the "submariner-gateway" cluster role and binding
✓ Deleted the "submariner-globalnet" cluster role and binding
✓ Deleted the "submariner-lighthouse-agent" cluster role and binding
✓ Deleted the "submariner-lighthouse-coredns" cluster role and binding
✓ Deleted the "submariner-networkplugin-syncer" cluster role and binding
✓ Deleted the "submariner-operator" cluster role and binding
✓ Deleted the "submariner-routeagent" cluster role and binding
✓ Deleting the Submariner namespace "submariner-operator"
✓ Deleting the broker namespace "submariner-k8s-broker"
✓ Deleting the Submariner custom resource definitions
✓ Deleted the "brokers.submariner.io" custom resource definition
✓ Deleted the "clusterglobalegressips.submariner.io" custom resource definition
✓ Deleted the "clusters.submariner.io" custom resource definition
✓ Deleted the "endpoints.submariner.io" custom resource definition
✓ Deleted the "gateways.submariner.io" custom resource definition
✓ Deleted the "globalegressips.submariner.io" custom resource definition
✓ Deleted the "globalingressips.submariner.io" custom resource definition
✓ Deleted the "servicediscoveries.submariner.io" custom resource definition
✓ Deleted the "submariners.submariner.io" custom resource definition
✓ Unlabeling gateway nodes
Manual Uninstall
To manually uninstall Submariner from a cluster, follow the steps below:
Make sure KUBECONFIG for all participating clusters is exported and all participating clusters are accessible via kubectl.
-
Delete Submariner-related namespaces
For each participating cluster, issue the following command:
kubectl delete namespace submariner-operatorFor the Broker cluster, issue the following command:
kubectl delete namespace submariner-k8s-brokerFor
submarinerversion 0.9 and above, also deletesubmariner-operatornamespace from the Broker cluster by issuing the following command:kubectl delete namespace submariner-operator -
Delete the Submariner CRDs
For each participating cluster, issue the following command:
for CRD in `kubectl get crds | grep -iE 'submariner|multicluster.x-k8s.io'| awk '{print $1}'`; do kubectl delete crd $CRD; done -
Delete Submariner’s
ClusterRoles andClusterRoleBindingsFor each participating cluster, issue the following command:
roles="submariner-operator submariner-operator-globalnet submariner-lighthouse submariner-networkplugin-syncer" kubectl delete clusterrole,clusterrolebinding $roles --ignore-not-found -
Remove the Submariner gateway labels
For each participating cluster, issue the following command:
kubectl label --all node submariner.io/gateway- -
For OpenShift deployments, delete Lighthouse entry from
defaultDNS.For each participating cluster, issue the following command:
kubectl apply -f - <<EOF apiVersion: operator.openshift.io/v1 kind: DNS metadata: finalizers: - dns.operator.openshift.io/dns-controller name: default spec: servers: [] EOFThis deletes the Lighthouse entry from the
Datasection inCorefileof the configmap.#lighthouse-start AUTO-GENERATED SECTION. DO NOT EDIT clusterset.local:53 { forward . 100.3.185.93 } #lighthouse-endVerify that the Lighthouse entry is deleted from
Corefileofdns-defaultconfigmap by running following command on an OpenShift clusterkubectl describe configmap dns-default -n openshift-dnsFor Kubernetes deployments, manually edit the
Corefileofcorednsconfigmap and delete the Lighthouse entry by issuing below commandskubectl edit cm coredns -n kube-systemThis will also restart the
coredns. Below command can also be issued to manually restartcoredns.kubectl rollout restart -n kube-system deployment/corednsVerify that the Lighthouse entry is deleted from
Datasection inCorefileofdns-defaultconfig map by running following command on a Kubernetes clusterkubectl describe configmap coredns -n kube-systemNoteFollowing commands need to be executed from inside the cluster nodes.
-
Remove Submariner’s iptables chains
On all nodes in each participating cluster, issue the following commands:
iptables --flush SUBMARINER-INPUT iptables -D INPUT $(iptables -L INPUT --line-numbers | grep SUBMARINER-INPUT | awk '{print $1}') iptables --delete-chain SUBMARINER-INPUT iptables -t nat --flush SUBMARINER-POSTROUTING iptables -t nat -D POSTROUTING $(iptables -t nat -L POSTROUTING --line-numbers | grep SUBMARINER-POSTROUTING | awk '{print $1}') iptables -t nat --delete-chain SUBMARINER-POSTROUTING iptables -t mangle --flush SUBMARINER-POSTROUTING iptables -t mangle -D POSTROUTING $(iptables -t mangle -L POSTROUTING --line-numbers | grep SUBMARINER-POSTROUTING | awk '{print $1}') iptables -t mangle --delete-chain SUBMARINER-POSTROUTING ipset destroy SUBMARINER-LOCALCIDRS ipset destroy SUBMARINER-REMOTECIDRSIf Globalnet is enabled in the setup, additionally issue the following commands on gateway nodes:
iptables -t nat --flush SUBMARINER-GN-INGRESS iptables -t nat -D PREROUTING $(iptables -t nat -L PREROUTING --line-numbers | grep SUBMARINER-GN-INGRESS | awk '{print $1}') iptables -t nat --delete-chain SUBMARINER-GN-INGRESS iptables -t nat --flush SUBMARINER-GN-EGRESS iptables -t nat --delete-chain SUBMARINER-GN-EGRESS iptables -t nat -t nat --flush SUBMARINER-GN-MARK iptables -t nat --delete-chain SUBMARINER-GN-MARK -
Delete the
vx-submarinerinterfaceOn all nodes in each participating cluster, issue the following command:
ip link delete vx-submariner -
If Globalnet release 0.9 (or earlier) is enabled in the setup, issue the following commands to remove the annotations from all the Pods and Services.
For each participating cluster, issue the following command:
for ns in `kubectl get ns -o jsonpath="{.items[*].metadata.name}"`; do kubectl annotate pods -n $ns --all submariner.io/globalIp- kubectl annotate services -n $ns --all submariner.io/globalIp- done