重置和重新安装kubernetes中的coreDNS

一、删除coreDNS

执行以下命令删除coreDNS

kubectl delete svc kube-dns -n kube-system

kubectl delete deployment coredns -n kube-system 

kubectl delete configmaps coredns -n kube-system

kubectl delete clusterrolebindings system:coredns

kubectl delete clusterroles system:coredns

kubectl delete serviceaccounts coredns -n kube-system

二、重新安装coreDNS

1、下载coredns.yaml.sed文件

wget https://raw.githubusercontent.com/coredns/deployment/master/kubernetes/coredns.yaml.sed

2、下载部署脚本文件

wget https://raw.githubusercontent.com/coredns/deployment/master/kubernetes/deploy.sh

3、更改权限

chmod +x deploy.sh

4、安装依赖

因下面部署时需要依赖jquery,这里可提前先安装:

dnf -y install jq

5、修改clusterIP

默认的clusterIP为10.96.0.10,若需要修改,可执行以下命令,将其指定为自己的clusterIP,这里里不作修改,仅作演示。

./deploy.sh -i 10.96.0.10 > coredns.yaml

6、应用部署

kubectl apply -f coredns.yaml

你可能感兴趣的:(Kubernetes,kubernetes,docker,linux)