起因:
起初 kubesphere 的 devOps 是可以的,后来有给关了, 然后又停止了几个服务,具体忘记了。 后来想着把 devOps 重新安装。
删除 devOps 步骤:
更改 cc 中的 devOps 的 enabled 为 false。等待 kubesphere 重启完成后,发现 **kubesphere-devops-system** 的命名空间仍然存在,且工作负载也在运行中。于是我直接 kubectl delete namespace **kubesphere-devops-system** .
问题来了:
我再次把 cc 中的 devOps 的 enabled 为 true。直接就启动 devOps 失败了。
错误信息:
"stderr": "Error from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused\nError from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused\nError from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused",
"stderr_lines": [
"Error from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused",
"Error from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused",
"Error from server (InternalError): Internal error occurred: failed calling webhook \"s2ibuildertemplate.kb.io\": Post \"https://webhook-server-service.kubesphere-devops-system.svc:443/validate-devops-kubesphere-io-v1alpha1-s2ibuildertemplate?timeout=10s\": dial tcp 10.233.55.96:443: connect: connection refused"
解决方案:
-删除 DevOps Application
############ DevOps Application Deletion ############
# Uninstall DevOps application
helm uninstall -n kubesphere-devops-system devops
# Remove DevOps installation status
kubectl patch -nkubesphere-system cc ks-installer --type=json -p='[{"op": "remove", "path": "/status/devops"}]'
# Disable DevOps application
kubectl patch -nkubesphere-system cc ks-installer --type=json -p='[{"op": "replace", "path": "/spec/devops/enabled", "value": false}]'
2- 删除 DevOps Resource
############# DevOps Resource Deletion ##############
# Remove all resources related with DevOps
for devops_crd in $(kubectl get crd -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep "devops.kubesphere.io"); do
# Get all resource
for ns in $(kubectl get ns -ojsonpath='{.items..metadata.name}'); do
for devops_res in $(kubectl get $devops_crd -n $ns -oname); do
kubectl patch $devops_res -n $ns -p '{"metadata":{"finalizers":[]}}' --type=merge
done
done
done
# Remove all DevOps CRDs
kubectl get crd -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | grep "devops.kubesphere.io" | xargs -I crd_name kubectl delete crd crd_name
# Remove unused namespaces
kubectl delete namespace kubesphere-devops-system
然后再次开启, 完美解决
欢迎来撩 : 汇总all