|NO.Z.00037|——————————|^^ 部署 ^^|——|KuberNetes&二进制部署.V15|5台Server|——|kubernetes组件|coredns|

一、部署CoreDNS
### --- 部署对应版本(推荐)
~~~     # 切换到安装目录下

[root@k8s-master01 calico]# cd /root/k8s-ha-install/
### --- 如果更改了k8s service的网段需要将coredns的serviceIP改成k8s service网段的第十个IP
~~~     # 更改service网段为coredns的k8s-service的第十个IP

[root@k8s-master01 k8s-ha-install]# vim CoreDNS/coredns.yaml        
clusterIP: 10.96.0.10                                           # 查看service的第10个网段地址,与其对应
[root@k8s-master01 k8s-ha-install]# sed -i "s#10.96.0.10#10.96.0.10#g" CoreDNS/coredns.yaml
### --- 创建coredns

[root@k8s-master01 k8s-ha-install]#  kubectl  create -f CoreDNS/coredns.yaml
serviceaccount/coredns created
clusterrole.rbac.authorization.k8s.io/system:coredns created
clusterrolebinding.rbac.authorization.k8s.io/system:coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
二、部署CoreDNS(最新版)
### --- 下载coredns版本包

[root@k8s-master01 ~]# git clone https://github.com/coredns/deployment.git
### --- 切换到部署目录
 
[root@k8s-master01 ~]# cd deployment/kubernetes
### --- 部署coredns

[root@k8s-master01 ~]#  ./deploy.sh -s -i 10.96.0.10 | kubectl apply -f -
serviceaccount/coredns created
clusterrole.rbac.authorization.k8s.io/system:coredns created
clusterrolebinding.rbac.authorization.k8s.io/system:coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
三、查看coredns状态
### --- 查看状态
 
[root@k8s-master01 k8s-ha-install]#  kubectl get po -n kube-system -l k8s-app=kube-dns
NAME                       READY   STATUS    RESTARTS   AGE
coredns-867d46bfc6-sk5dp   1/1     Running   0          32s

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on 2022-03-29 13:21  yanqi_vip  阅读(21)  评论(0)    收藏  举报

导航