k8-dashboard从docker私服拉取镜像部署应用

接前一篇《CICD搭建之 kubernetes-dashboard》,验证一下从registry拉取镜像部署应用。
还是用nginx进行部署,先重命名

[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

点击更新,pod会进行滚动更新。


图1.查看pod

如图1和2,查看pod,选择其中一个点击如下图,可以看到更新日志,拉取的镜像为"localhost:7501/nginx"
图2.更新日志

访问正常


image.png

你可能感兴趣的:(k8-dashboard从docker私服拉取镜像部署应用)