• 02:配置k8s-master为镜像仓库


    配置master为镜像仓库

    #master节点

    #替换配置文件中的这行,使用下面的内容
    #配置docker加速,和信任私有仓库(注意,系统自带或者我们后安装的docker版本,配置文件是/etc/docker/daemon.jason)
    [root@k8s-master ~]#vim /etc/sysconfig/docker
    OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --registry-mirror=https://aeckruos.mirror.aliyuncs.com --insecure-registry=192.168.6.129:5000'

    #重启docker
    [root@k8s-master ~]#systemctl restart docker

    #起仓库容器(普通的registry) 前面docker文件里面有单独一遍讲解如何安装registry,这里不在描述
    [root@k8s-master ~]# docker run -d -p 5000:5000 --restart=always --name registry -v /opt/myregistry:/var/lib/registry registry
    Unable to find image 'registry:latest' locally
    Trying to pull repository docker.io/library/registry ...
    latest: Pulling from docker.io/library/registry

    c87736221ed0: Pull complete
    1cc8e0bb44df: Pull complete
    54d33bcb37f5: Pull complete
    e8afc091c171: Pull complete
    b4541f6d3db6: Pull complete
    Digest: sha256:8004747f1e8cd820a148fb7499d71a76d45ff66bac6a29129bfdbfdc0154d146
    917d5def661733464c5039695917255b0270cb28f4173c450374734c7298b00a
    [root@k8s-master ~]# docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    docker.io/busybox latest 020584afccce 2 weeks ago 1.22 MB
    docker.io/registry latest f32a97de94e1 8 months ago 25.76 MB

    #上传一个镜像到私有仓库
    [root@k8s-master ~]# docker tag docker.io/busybox:latest 192.168.6.129:5000/busybox:latest

    ----------
    #node节点(镜像加速,信任129registry仓库)
    [root@k8s-node-1 ~]#vim /etc/sysconfig/docker
    OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --registry-mirror=https://aeckruos.mirror.aliyuncs.com --insecure-registry=192.168.6.129:5000'
    [root@k8s-node-2 ~]#vim /etc/sysconfig/docker
    OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --registry-mirror=https://aeckruos.mirror.aliyuncs.com --insecure-registry=192.168.6.129:5000'
    [root@k8s-node-1 ~]#

    #重启docker
    [root@k8s-node-1 ~]#systemctl restart docker
    [root@k8s-node-1 ~]#systemctl restart docker

    #测试,从主master 129仓库pull 下载镜像
    #node-1
    [root@k8s-node-1 ~]# docker pull 192.168.6.129:5000/busybox:latest
    Trying to pull repository 192.168.6.129:5000/busybox ...
    latest: Pulling from 192.168.6.129:5000/busybox
    Digest: sha256:679b1c1058c1f2dc59a3ee70eed986a88811c0205c8ceea57cec5f22d2c3fbb1
    [root@k8s-node-1 ~]# docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    192.168.6.129:5000/busybox latest 020584afccce 2 weeks ago 1.22 MB
    docker.io/busybox latest 020584afccce 2 weeks ago 1.22 MB
    #node-2
    [root@k8s-node-2 ~]# docker pull 192.168.6.129:5000/busybox:latest
    Trying to pull repository 192.168.6.129:5000/busybox ...
    latest: Pulling from 192.168.6.129:5000/busybox
    Digest: sha256:679b1c1058c1f2dc59a3ee70eed986a88811c0205c8ceea57cec5f22d2c3fbb1
    [root@k8s-node-2 ~]# docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    192.168.6.129:5000/busybox latest 020584afccce 2 weeks ago 1.22 MB
    docker.io/busybox latest 020584afccce 2 weeks ago 1.22 MB
    [root@k8s-node-2 ~]#

    仓库搭好了。
    ===============================
    再次确认k8s三台的起的容器能网络是通的:
    [root@k8s-master ~]# docker run -it busybox /bin/sh #三台都起一个容器,互相ping
    / # ping 172.16.16.2
    PING 172.16.16.2 (172.16.16.2): 56 data bytes
    ^C
    --- 172.16.16.2 ping statistics ---
    5 packets transmitted, 5 packets received, 0% packet loss
    round-trip min/avg/max = 0.538/0.824/1.728 ms
    / # ^C
    / # ping 172.16.83.2
    PING 172.16.83.2 (172.16.83.2): 56 data bytes
    64 bytes from 172.16.83.2: seq=0 ttl=60 time=1.453 ms
    ^C
    --- 172.16.83.2 ping statistics ---
    1 packets transmitted, 1 packets received, 0% packet loss
    round-trip min/avg/max = 1.453/1.453/1.453 ms
    / #

  • 相关阅读:
    js 产生随机数
    基于bootstrap的multiple-select下拉控件使用
    jqgrid 单列排序和组合排序
    jqgrid 配置行号及行号的宽度
    jqgrid 配置分页大小及下拉项
    jqgrid 滚动分页
    jqgrid 宽度自适应
    jqgrid 行选中multiboxonly属性说明
    jqgrid 谈谈给表格设置列头事件、行事件、内容事件
    jqgrid 加入右键菜单按钮管理
  • 原文地址:https://www.cnblogs.com/jim-xu/p/11874315.html
Copyright © 2020-2023  润新知