首页 > 其他分享 >pod使用凭据连接harbor仓库

pod使用凭据连接harbor仓库

时间:2023-01-26 11:11:26浏览次数:39  
标签:name harbor cicd 凭据 -- ubuntu pod docker

1. 配置secret

kubectl create secret docker-registry harbor-registry-creds --docker-server="https://harbor.dreame.tech" [email protected] --docker-username='ci_autobuild'  --docker-password='7cmTieZ3L7RURZ' -n ci-test
注意:这里用户一定要有这个镜像的访问权限。

2. 使用secret去拉取镜像

# 实例:与containers平级     
       imagePullSecrets:
        - name: harbor-registry-creds #添加刚才配置的凭据



apiVersion: apps/v1
kind: Deployment
metadata:
  name: cicd-ubuntu
  namespace: ci-test
  labels:
    app: cicd-ubuntu
spec:
  replicas: 3
  selector:
    matchLabels:
      app: cicd-ubuntu
  template:
    metadata:
      labels:
        app: cicd-ubuntu
    spec:
      volumes:
        - name: mypd
          persistentVolumeClaim:
            claimName: cicd
      containers:
      - name: cicd
        image: harbor.dreame.tech/devops/wangkang/ci_base:V2
        command: ["/usr/bin/tail"]
        args: ["-f", "/etc/hosts"]
        resources:
          limits:
            cpu: '1'
            memory: 1Gi
        volumeMounts:
          - name: mypd
            mountPath: /home/ujenkins
      imagePullSecrets:
        - name: harbor-registry-creds #添加刚才配置的凭据
      nodeSelector:
        storagenode: cicd
      tolerations:
      - key: "cicd"
        operator: "Equal"
        value: "schedulable"
        effect: "NoSchedule"
      # affinity:
      #   podAntiAffinity:
      #     requiredDuringSchedulingIgnoredDuringExecution:
      #       nodeSelectorTerms:
      #       - matchExpressions:
      #         - key: cicd
      #           operator: In
      #           values:
      #           - schedulable
参数: imagePullSecrets    

标签:name,harbor,cicd,凭据,--,ubuntu,pod,docker
From: https://www.cnblogs.com/Mercury-linux/p/17067630.html

相关文章

  • 【云原生kubernetes】k8s中pod使用详解
    一、前言在之前k8s组件一篇中,我们谈到了pod这个组件,了解到pod是k8s中资源管理的最小单位,可以说Pod是整个k8s对外提供服务的最基础的个体,有必要对Pod做深入的学习和探究。二......
  • 登录Harbor仓库报错:Error response from daemon: Get
    登录Harbor仓库报错:dockerlogin-uadmin-pHarbor1234520.20.10.162WARNING!Using--passwordviatheCLIisinsecure.Use--password-stdin.Errorresponse......
  • Node异常时Pod状态分析
    场景一:停止kubelet并恢复操作和现象操作节点上运行Pod后把kubelet进程停掉。现象 node状态变为NotReady,不同类型的Pod情况不同。Deployment在默......
  • 创建harbor镜像仓库密钥
    1、创建密钥kubectlcreatesecretdocker-registryharbor-keys--docker-server=skg.harbor.bjshxg.com:80--docker-username=admin--docker-password=harbor123456......
  • Harbor企业级镜像仓库的安装
    1、概述Harbor是VMware公司开源的一个企业级DockerRegistry项目,项目地址:https://github.com/goharbor/harborHarbor作为一个企业级私有Registry服务器,提供......
  • k8s pod 抓包
    首先安装tcpdump:yuminstalltcpdumpkubectlgetpod-owide查看pod在哪个节点上dockerps查看container的id查看pid:dockerinspect-f{{.State.Pid}}$containeri......
  • helm 安装 harbor
    harborhelm安装harbor官方文档https://goharbor.io/docs/2.7.0/install-config/harbor-ha-helm/#installation官方demoHelm2:helminstall--namemy-releaseharb......
  • 最新xcode安装pods
    https://www.jianshu.com/p/9701aeab74behttps://blog.csdn.net/BlackMonkey_xj/article/details/124466716https://blog.csdn.net/ZCC361571217/article/details/127333......
  • windows远程桌面之前用于连接到xxx的凭据无法工作
    使用windows远程桌面连接时报错提示:之前用于连接到xxx的凭据无法工作确认输入的用户名密码没有问题解决方法:打开gpedit.msc组策略管理,依次找到计算机配置>windows......
  • k8s创建busybox POD
    默认busybox容器创建后的状态为completed,需要增加持续运行的参数,以方便进行容器测试工作.[root@k8s-master-10yml]#catbusybox-pod.ymlapiVersion:v1kind:Podmeta......