从 KubeSphere 上卸载可插拔组件

启用 KubeSphere 的可插拔组件之后,您也可以使用以下命令来卸载这些组件。卸载之前,请将必要的数据进行备份。

应用商店

  1. kubectl delete ns openpitrix-system

Metrics Server

  1. helm delete metrics-server -n kube-system

事件

  1. helm delete ks-events -n kubesphere-logging-system

审计

  1. helm delete kube-auditing -n kubesphere-logging-system

日志

  1. kubectl delete ns kubesphere-logging-system

可选:

  1. # Uninstall es and curator
  2. helm uninstall -n kubesphere-logging-system elasticsearch-logging
  3. helm uninstall -n kubesphere-logging-system elasticsearch-logging-curator
  4. # Uninstall fluent bit operator and fluent bit
  5. kubectl delete -f https://github.com/kubesphere/fluentbit-operator/tree/v0.2.0/manifests/logging-stack
  6. kubectl delete -f https://github.com/kubesphere/fluentbit-operator/tree/v0.2.0/manifests/setup
  7. # Uninstall log sidecar injector
  8. helm uninstall -n kubesphere-logging-system logsidecar-injector

告警和通知

  1. kubectl delete ns kubesphere-alerting-system

仅卸载告警

  1. kubectl delete deployment -n kubesphere-alerting-system alerting-client alerting-executor alerting-manager alerting-watcher
  2. kubectl delete svc -n kubesphere-alerting-system alerting-client-server alerting-manager-server

仅卸载通知

  1. kubectl delete deployment -n kubesphere-alerting-system notification-deployment
  2. kubectl delete svc -n kubesphere-alerting-system notification

备注

告警和通知通常同时启用,两者在命名空间 kubesphere-alerting-system 中一起运行。

服务网格

  1. helm -n istio-system delete istio-init
  2. helm -n istio-system delete istio
  3. helm -n istio-system delete jaeger-operator
  4. kubectl delete ns istio-system

DevOps

  1. helm -n kubesphere-devops-system delete ks-jenkins
  2. helm -n kubesphere-devops-system delete uc
  1. # Delete DevOps projects
  2. for devopsproject in `kubectl get devopsprojects -o jsonpath="{.items[*].metadata.name}"`
  3. do
  4. kubectl patch devopsprojects $devopsproject -p '{"metadata":{"finalizers":null}}' --type=merge
  5. done
  6. for pip in `kubectl get pipeline -A -o jsonpath="{.items[*].metadata.name}"`
  7. do
  8. kubectl patch pipeline $pip -n `kubectl get pipeline -A | grep $pip | awk '{print $1}'` -p '{"metadata":{"finalizers":null}}' --type=merge
  9. done
  10. for s2ibinaries in `kubectl get s2ibinaries -A -o jsonpath="{.items[*].metadata.name}"`
  11. do
  12. kubectl patch s2ibinaries $s2ibinaries -n `kubectl get s2ibinaries -A | grep $s2ibinaries | awk '{print $1}'` -p '{"metadata":{"finalizers":null}}' --type=merge
  13. done
  14. for s2ibuilders in `kubectl get s2ibuilders -A -o jsonpath="{.items[*].metadata.name}"`
  15. do
  16. kubectl patch s2ibuilders $s2ibuilders -n `kubectl get s2ibuilders -A | grep $s2ibuilders | awk '{print $1}'` -p '{"metadata":{"finalizers":null}}' --type=merge
  17. done
  18. for s2ibuildertemplates in `kubectl get s2ibuildertemplates -A -o jsonpath="{.items[*].metadata.name}"`
  19. do
  20. kubectl patch s2ibuildertemplates $s2ibuildertemplates -n `kubectl get s2ibuildertemplates -A | grep $s2ibuildertemplates | awk '{print $1}'` -p '{"metadata":{"finalizers":null}}' --type=merge
  21. done
  22. for s2iruns in `kubectl get s2iruns -A -o jsonpath="{.items[*].metadata.name}"`
  23. do
  24. kubectl patch s2iruns $s2iruns -n `kubectl get s2iruns -A | grep $s2iruns | awk '{print $1}'` -p '{"metadata":{"finalizers":null}}' --type=merge
  25. done
  26. kubectl delete devopsprojects --all 2>/dev/null
  1. kubectl delete ns kubesphere-devops-system

备注

对于组件 NetworkPolicy,无需卸载组件就能禁用该组件,因为该组件的控制器现在位于 ks-controller-manager 中。若想将组件 NetworkPolicy 从 KubeSphere 的控制台中移除,请在 ks-installer 中将 networkPolicy.enabled 更改为 false