System Reboot Engineer System Reboot Engineer
首页
运维
编程

小布江

首页
运维
编程
  • Kubernetes

  • 日常

    • K8s-Minio集群迁移
    • Argocd-ingress 资源状态一直 Progressing
    • Jenkins job卡住导致页面提示Jenkins即将关闭
    • Docker构建多架构镜像
    • Minio备份及恢复
    • Jenkins构建消息webhook发送
    • cert-manager自动签发Lets Encrypt
    • Ansible批量发送密钥
    • ArgoCD 消息通知
    • Containerd配置私有Harbor镜像仓库
      • kvm虚拟机修改密码
      • Nexus
      • Nginx之tcp转发
      • Arthas
      • 开启telnet登录
      • CPU亲和
      • Harbor复制镜像
      • KVM虚拟机根目录扩容
    • Prometheus

    • Ci

    • 运维
    • 日常
    小布江
    2024-10-31
    目录

    Containerd配置私有Harbor镜像仓库


    现在K8s集群大多少都是使用containerd来跑,相比之前的docker,确实拉取推送镜像略微麻烦了点.


    # 1. 配置containerd认证Harbor,本地harbor使用的http方式
    [root@master01 containerd]# cat /etc/containerd/config.toml
    version = 2
    root = "/data/containerd"
    state = "/run/containerd"
    oom_score = -999
    
    [grpc]
      max_recv_message_size = 16777216
      max_send_message_size = 16777216
    
    [debug]
      level = "info"
    
    [metrics]
      address = ""
      grpc_histogram = false
    
    [plugins]
      [plugins."io.containerd.grpc.v1.cri"]
        sandbox_image = "registry.custom.local:12480/kubeadm-ha/pause:3.7"
        max_container_log_line_size = -1
        [plugins."io.containerd.grpc.v1.cri".containerd]
          default_runtime_name = "runc"
          snapshotter = "overlayfs"
          [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
            [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
              runtime_type = "io.containerd.runc.v2"
              runtime_engine = ""
              runtime_root = ""
              [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
                SystemdCgroup = true
        [plugins."io.containerd.grpc.v1.cri".registry]
        #######################################新增#######################################
            [plugins."io.containerd.grpc.v1.cri".registry.mirrors."10.20.58.50:5000"]
              endpoint = ["http://10.20.58.50:5000"] # Harbor-1
    
            [plugins."io.containerd.grpc.v1.cri".registry.mirrors."registry.custom.local:12480"]
              endpoint = ["http://registry.custom.local:12480"] # Harbor-2
    
          [plugins."io.containerd.grpc.v1.cri".registry.configs."10.20.58.50:5000".tls]
            insecure_skip_verify = true # 跳过证书认证
          [plugins."io.containerd.grpc.v1.cri".registry.configs."10.20.58.50:5000".auth]
            username = "admin"   # Harbor的账号密码
            password = "Harbor12345"
    
          [plugins."io.containerd.grpc.v1.cri".registry.configs."registry.custom.local:12480".tls]
            insecure_skip_verify = true
          [plugins."io.containerd.grpc.v1.cri".registry.configs."registry.custom.local:12480".auth]
            username = "admin"
            password = "Harbor12345"
          ##############################################################################   
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    # 2.重启containerd
    [root@master01 containerd]# systemctl restart containerd
    # 配置多个私有镜像仓库如上
    
    1
    2
    # 3. 拉取镜像
    [root@node06 ~]# crictl pull registry.custom.local:12480/kubeadm-ha/etcd:3.5.6-0
    Image is up to date for sha256:fce326961ae2d51a5f726883fd59d2a8c2ccc3e45d3bb859882db58e422e59e7
    
    1
    2
    #containerd
    上次更新: 2025/04/25, 03:40:17
    ArgoCD 消息通知
    kvm虚拟机修改密码

    ← ArgoCD 消息通知 kvm虚拟机修改密码→

    最近更新
    01
    Harbor复制镜像
    04-15
    02
    CPU亲和
    04-10
    03
    开启telnet登录
    04-09
    更多文章>
    Theme by Vdoing
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式