当前位置:网站首页>Harbor image pull voucher configuration
Harbor image pull voucher configuration
2022-06-10 19:49:00 【51CTO】
Mirror pull voucher
The theme : stay k8s establish Pod In the process , from Harbor The private image warehouse downloads images .Harbor To ensure the security of the image , You need to configure Secret Only from Harbor Download mirroring . Public warehouses do not need to be configured .
Before in my column 《Harbor Treasure 》 I share Harbor Series of articles .
This issue will continue to share in k8s How to pull from the container Harbor Private image in .
Harbor We can pull the public image in , However, some private images cannot be directly pulled to . We can use Secret Pull the private image from the resource object , The following are the detailed operation steps .
Harbor Address : https://192.168.2.250:443
Harbor user :admin
Harbor password :Harbor12345
At the end of the paper, record the problems encountered and solutions !
1、 Sign in Harbor
After successful login, it will be in ~/.docker/config.json Record login information in the file , Then, based on this information, create Secret, Through the container imagePullSecret Specify the Secret To implement authentication , To pull the private image .
If you log in Harbor Failure , Please check the problem solving in the column .
# docker login -u admin -p Harbor12345 192.168.2.250:443
WARNING! Using
--password via the CLI is insecure. Use
--password
-stdin.
WARNING! Your password will be stored unencrypted
in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/
#credentials-store
Login Succeeded // Login successful
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
2、 use BASH64 Encode and parse key data
Click Create Secret You need to use the parsed results when ;-w 0 Indicates that the generated secret key does not transfer to another line , If the default line conversion is not in the correct format, an error will occur .
3、 establish Secret Mirror pull voucher
.dockerconfigjson The value of is the second 2 The result of step analysis ( Copy the results there )
# vim harbor-image-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: harbor-pull
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: ewoJImF1dGhzIjogewoJCSIxOTIuMTY4LjIuMjUwOjQ0MyI6IHsKCQkJImF1dGgiOiAiWVdSdGFXNDZTR0Z5WW05eU1USXpORFU9IgoJCX0KCX0sCgkiSHR0cEhlYWRlcnMiOiB7CgkJIlVzZXItQWdlbnQiOiAiRG9ja2VyLUNsaWVudC8xOS4wMy44IChsaW51eCkiCgl9Cn0=
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
Command line creation secret The method of is shown in kubectl create secret -h To create , We will not elaborate here .
4、 Use image pull credentials in the container to pull private images
This office pulls the private image 192.168.2.250:443/muli/tomcat:8.5.34-jre8-alpine For example .
# cat tomcat-pod1.yaml
kind: Pod
apiVersion: v1
metadata:
name: tomcat-v2.3.1
namespace: test
spec:
imagePullSecrets:
- name: image-secret
containers:
- name: tomcat-po
image: 192.168.2.250:443/muli/tomcat:8.5.34-jre8-alpine
imagePullPolicy: IfNotPresent
# kubectl apply -f tomcat-pod1.yaml
pod/tomcat-v2.3.1 created
# kubectl get pods
NAME READY STATUS RESTARTS AGE
tomcat-v2.3.1 1/1 Running 0 20h
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
边栏推荐
- 领域驱动设计(六) - 架构设计浅谈
- TiDB - 快速入门,集群搭建
- Source code analysis and practical testing openfeign load balancing
- Apicloud visual development novice graphic tutorial
- One article explains in detail the exploration and practice of eventmesh landing on Huawei cloud
- Source code analysis of Tencent libco collaboration open source library (III) -- Exploring collaboration switching process assembly register saving and efficient collaboration environment
- [C language] have you mastered these classic questions? Learn these questions in one article
- Mongodb 唯一索引
- 腾讯Libco协程开源库 源码分析 全系列总结博客
- SAR image focusing quality evaluation plug-in
猜你喜欢

2022 software test interview strategy for the strongest version of fresh students to help you get directly to the big factory

2022.05.29 (lc_6079_price reduction)

DDD落地实践复盘 - 记理论培训&事件风暴

Implementation analysis of single image haze removal using dark channel prior

掌握高性能计算前,我们先了解一下它的历史

Morris traversal of binary tree

100003 words, take you to decrypt the system architecture under the double 11 and 618 e-commerce promotion scenarios

【C语言】一不小心写出bug?凡人教你如何写出好代码【详解vs中调试技巧】

源码分析及实践测试OpenFeign负载均衡

轻松学Pytorch-全卷积神经网络实现表情识别
随机推荐
【C语言】一不小心写出bug?凡人教你如何写出好代码【详解vs中调试技巧】
China pufuteng hotels and resorts launched new spa products to celebrate the global health day on June 11
【C语言】还搞不明白结构体吗?不妨来看看这篇文章,带你初步了解结构体
SAR回波信号基本模型与性质
详细解读TPH-YOLOv5 | 让目标检测任务中的小目标无处遁形
Key and encryption mechanism in financial industry
轻松学Pytorch-全卷积神经网络实现表情识别
【C语言进阶】指针的进阶【上篇】
My first work: tensorflow2 x
Analyse du code source de Tencent libco CO CO - Process open source library
Some questions often asked during the interview. Come and see how many correct answers you can get
[C language] have you mastered these classic questions? Learn these questions in one article
Writing technical articles is a fortune for the future
2022.05.29 (lc_6079_price reduction)
In the all digital era, how can enterprise it complete transformation?
Design and development of hospital reservation registration platform based on JSP Zip (thesis + project source code)
MicroNet实战:使用MicroNet实现图像分类
马斯克称自己不喜欢做CEO,更想做技术和设计;吴恩达的《机器学习》课程即将关闭注册|极客头条
掌握高性能计算前,我们先了解一下它的历史
SQL statement to view the basic table structure and constraint fields, primary codes and foreign codes in the table (simple and effective)