[Solution] Not able to re-Install meshery with the helm charts

Installed meshery and uninstalled it. Now When I tried to install again, I was getting below error from the helm chart deployment command.

Unable to continue with install: ClusterRole "meshery-server" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; 
label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; 
annotation validation error: missing key "meta.helm.sh/release-name": must be set to "meshery"; 
annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "meshery"

when we uninstall meshery from cluster, it does not delete all the component in the k8s cluster. So whenever we try to install it again , Helm identifies there are some objects which already exist so the helm chart fails.

As of now we observed there are only few clusterRole and RoleBindings which are the leftover mesher k8s cluster components. So we you need to cleanup those stale objects before we install meshery again.

Step 1. Know what is left:

kubectl get clusterrole| grep -i meshery
kubectl get clusterrolebinding| grep -i meshery

Step 2. Delete all the clusterrole and clusterrolebinding

kubectl delete clusterrolebinding meshery-leader-election-rolebinding
kubectl delete clusterrolebinding meshery-operator-rolebinding
kubectl delete clusterrolebinding meshery-proxy-rolebinding
kubectl delete clusterrolebinding meshery-controller-rolebinding
kubectl delete clusterrole meshery-leader-election-role
kubectl delete clusterrole meshery-operator-role
kubectl delete clusterrole meshery-proxy-role
kubectl delete clusterrole meshery-controller-role

you have successfully deleted all the leftover k8s objects related to meshery

Step 3: Also delete the Namespace if it is exiting

kubectl delete ns meshery

Now you are all set to reinstall meshery to your kubernetes cluster .

Run below commands to install it in your cluster via helm:

 helm repo add meshery https://meshery.io/charts/
 helm install meshery meshery/meshery --namespace meshery --create-namespace

optionally, run the below command to define authentication flow callback URL:

 helm install meshery meshery/meshery --namespace meshery --set env.MESHERY_SERVER_CALLBACK_URL=https://custom-host --create-namespace

Even you can run mesheryctl native command to setup meshery in your k8s.

for AKS :

mesheryctl system config aks
meshery system start

Hope this helps !

Thanks a lot @samirparhi-dev, I think this is also being needed to be done automatically and your comments are so helpful in getting the the direction.
So nice of you to post a solution. Thanks.

1 Like

@Abhi : Is there a active issue on this topic , if so can you give me the issue no here for my reference.

@hexxdump @piyushsingariya @Ritesh_Karankal @navendu