接前一篇《CICD搭建之 kubernetes-dashboard》,驗(yàn)證一下從registry拉取鏡像部署應(yīng)用。
還是用nginx進(jìn)行部署,先重命名
[root@localhost tmp]# docker tag nginx:latest localhost:7501/nginx
推送到私服,并查看一下本地鏡像
[root@localhost tmp]# docker push localhost:7501/nginx
The push refers to repository [localhost:7501/nginx]
8032102adebe: Pushed
8eb80f066de2: Pushed
7230cfe05cc1: Pushed
822ae9fef1d8: Pushed
07cab4339852: Mounted from redis
latest: digest: sha256:416d511ffa63777489af47f250b70d1570e428b67666567085f2bece3571ad83 size: 1362
[root@localhost tmp]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 992e3b7be046 2 days ago 133MB
localhost:7501/nginx latest 992e3b7be046 2 days ago 133MB
jenkinsci/blueocean 1.24.0 8bc6e31b0d6a 6 days ago 755MB
刪除本地鏡像
[root@localhost tmp]# docker rmi localhost:7501/nginx
Untagged: localhost:7501/nginx:latest
Untagged: localhost:7501/nginx@sha256:416d511ffa63777489af47f250b70d1570e428b67666567085f2bece3571ad83
[root@localhost tmp]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 992e3b7be046 2 days ago 133MB
jenkinsci/blueocean 1.24.0 8bc6e31b0d6a 6 days ago 755MB
修改部署配置,如下圖,修改為我們私服的鏡像名。

image.png
點(diǎn)擊更新,pod會(huì)進(jìn)行滾動(dòng)更新。

圖1.查看pod
如圖1和2,查看pod,選擇其中一個(gè)點(diǎn)擊如下圖,可以看到更新日志,拉取的鏡像為"localhost:7501/nginx"

圖2.更新日志
訪問(wèn)正常

image.png