zoukankan      html  css  js  c++  java
  • 配置k8s拉取Harbor镜像

    创建Secret

    # 认证名称为:docker-harbor-registry
    kubectl create secret docker-registry docker-harbor-registry 
    --docker-server=10.170.128.9:83/ 
    --docker-username=jexcins 
    --docker-password='TTnbdfi002'
    

    将 secret 添加到 ServiceAccount

    # 认证名称为:docker-harbor-registry
    kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "docker-harbor-registry"}]}'
    

    在Deployment文件中添加认证

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: testapi-prod-node
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: testapi-prod
      template:
        metadata:
          labels:
            app: testapi-prod
        spec:
          containers:
            - name: testapi-prod-instance
              image: {IMAGE-URL}
              command: [ "dotnet", "DotNetCore.API.dll" ]
              ports:
              - containerPort: 5000
          imagePullSecrets:
            - name: docker-harbor-registry
    
  • 相关阅读:
    shell命令--stat
    英文段子
    OCP读书笔记(16)
    shell命令--uptime
    OCP读书笔记(15)
    shell命令--dmesg
    OCP读书笔记(14)
    shell命令--hostname
    OCP读书笔记(13)
    shell命令--uname
  • 原文地址:https://www.cnblogs.com/zhang-guansheng/p/13752872.html
Copyright © 2011-2022 走看看