master节点执行以下命令

curl --insecure -sfL https://192.168.3.138/v3/import/8vl4tv75xk7kggb4hf2w6qnz8z74ztwfg2t7w5sbjfw5m2ln7xmcgb_c-m-j64lt48t.yaml | kubectl apply -f -

报错

clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver unchanged
clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master unchanged
Warning: Detected changes to resource cattle-system which is currently being deleted.
namespace/cattle-system unchanged
clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding unchanged
clusterrole.rbac.authorization.k8s.io/cattle-admin unchanged
Error from server (Forbidden): error when creating "STDIN": serviceaccounts "cattle" is forbidden: unable to create new content in namespace cattle-system because it is being terminated
Error from server (Forbidden): error when creating "STDIN": secrets "cattle-credentials-aa1c3d8" is forbidden: unable to create new content in namespace cattle-system because it is being terminated
Error from server (Forbidden): error when creating "STDIN": deployments.apps "cattle-cluster-agent" is forbidden: unable to create new content in namespace cattle-system because it is being terminated
Error from server (Forbidden): error when creating "STDIN": services "cattle-cluster-agent" is forbidden: unable to create new content in namespace cattle-system because it is being terminated

查看命名空间

[root@zyj5 ~]# kubectl get ns
NAME                          STATUS        AGE
cattle-impersonation-system   Active        5d21h
cattle-system                 Terminating   5d21h
default                       Active        25d
ingress-nginx                 Active        10d
istio-system                  Terminating   10d
jenkins-k8s                   Active        25d
kube-node-lease               Active        25d
kube-public                   Active        25d
kube-system                   Active        25d
local                         Active        5d21h

删除namespace(cattle-system)

kubectl patch namespace cattle-system -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-system --grace-period=0 --force

kubectl patch namespace cattle-global-data -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system
kubectl delete namespace cattle-global-data --grace-period=0 --force

kubectl patch namespace local -p '{"metadata":{"finalizers":[]}}' --type='merge' -n cattle-system

for resource in `kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -o name -n local`; do kubectl patch $resource -p '{"metadata": {"finalizers": []}}' --type='merge' -n local; done

kubectl delete namespace local --grace-period=0 --force

查看状态

[root@zyj5 ~]# kubectl get ns
NAME                          STATUS        AGE
cattle-impersonation-system   Terminating   5d21h
default                       Active        25d
ingress-nginx                 Active        10d
istio-system                  Terminating   10d
jenkins-k8s                   Active        25d
kube-node-lease               Active        25d
kube-public                   Active        25d
kube-system                   Active        25d

重新再rancher中添加

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐