Kubernetes升級coredns1.8.3


日常工作中,我們有時會對一些比較低的組件做升級。

版本的升級,可以解決一下bug和漏洞,穩定系統的性能。

這次我升級對coredns升級。

coredns主要是Kubernetes中對域名和ip解析,可以作為內網的dns解析服務器。

一、查看當前coredns版本

[root@k8s-master01 ~]# kubectl get pod -n kube-system coredns-7ff77c879f-h2jw9 -oyaml | grep image
            f:image: {}
            f:imagePullPolicy: {}
    image: registry.aliyuncs.com/google_containers/coredns:1.6.7
    imagePullPolicy: IfNotPresent
    image: registry.aliyuncs.com/google_containers/coredns:1.6.7
    imageID: docker-pullable://registry.aliyuncs.com/google_containers/coredns@sha256:695a5e109604331f843d2c435f488bf3f239a88aec49112d452c1cbf87e88405

二、升級

2.1、查詢最新版coredns的版本

# coredns官網:https://github.com/coredns/coredns
# 老版本用:kube-dns
# 新版的都用:coredns


# 部署文檔:https://github.com/coredns/deployment/tree/master/kubernetes

最新版地址:https://github.com/coredns/deployment/blob/master/kubernetes/coredns.yaml.sed

現在最新版是1.8.3

2.2、備份原來的cm、deploy、clusterrole、clusterrolebinding

切記:日常我們做任何操作(升級,刪除,修改),一定要備份,防止錯誤操作,導致數據丟失,或者功能無法使用

備份好處,可以確保數據安全性,如果出現功能不能使用,可以立刻回滾,不長時間影響業務

mkdir coredns && cd coredns
kubectl get cm -n kube-system coredns -oyaml > coredns-config.yaml
kubectl get deploy -n kube-system coredns -oyaml > coredns-controllers.yaml
kubectl get clusterrole system:coredns -oyaml > coredns-clusterrole.yaml
kubectl get clusterrolebinding  system:coredns -oyaml > coredns-clusterrolebinding.yaml

2.3、升級coredns

下載地址:git clone https://github.com/coredns/deployment.git

# 1、下載文件
git clone https://github.com/coredns/deployment.git

# 2、升級
cd deployment/kubernetes/
./deploy.sh -s | kubectl apply -f -




[root@k8s-master01 ~]# cd deployment/kubernetes/
[root@k8s-master01 kubernetes]# ./deploy.sh -s | kubectl apply -f -
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
serviceaccount/coredns configured
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
clusterrole.rbac.authorization.k8s.io/system:coredns configured
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
clusterrolebinding.rbac.authorization.k8s.io/system:coredns configured
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
configmap/coredns configured
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
deployment.apps/coredns configured
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
service/kube-dns configured

已經升級成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM