当前位置:网站首页>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.
边栏推荐
- Longest ascending subsequence (LIS) Logu
- 2022.05.26 (lc_1143_longest common subsequence)
- 【C语言进阶】数据的存储【下篇】【万字总结】
- C (pointer-02)
- [advanced C language] data storage [part I] [ten thousand words summary]
- This article introduces you to j.u.c's futuretask, fork/join framework and BlockingQueue
- Detailed interpretation of tph-yolov5 | making small targets in target detection tasks invisible
- 一文帶你了解J.U.C的FutureTask、Fork/Join框架和BlockingQueue
- 2022.05.28 (lc_5_longest palindrome substring)
- 【C语言】还搞不明白结构体吗?不妨来看看这篇文章,带你初步了解结构体
猜你喜欢

2022.05.25 (lc_718_longest repeating subarray)

【C语言进阶】指针的进阶【中篇】

仅需三步学会使用低代码ThingJS与森数据DIX数据对接

SAR image focusing quality evaluation plug-in

Before we learn about high-performance computing, let's take a look at its history

Go language learning notes - cross domain configuration, global exception capture | web framework gin (IV)

100003字,带你解密 双11、618电商大促场景下的系统架构体系
![[advanced C language] advanced pointer [Part 2]](/img/fe/44e7f7c39bd77239b9a70628768ecc.png)
[advanced C language] advanced pointer [Part 2]

2022.05.29 (lc_6079_price reduction)

改变世界的开发者丨玩转“俄罗斯方块”的瑶光少年
随机推荐
SAR回波信号基本模型与性质
Rmarkdown easily input mathematical formula
叮咚抢菜-派送时段监听及推送工具
Rmarkdown 轻松录入数学公式
Writing technical articles is a fortune for the future
【C语言】这些经典题型大家都掌握了吗?一文学会这些题
Docker/Rancher2部署redis:5.0.9
Super simple course design SSM student management system (including simple addition, deletion, modification and query of source code)
Apicloud visual development - one click generation of professional source code
腾讯Libco协程开源库 源码分析(二)---- 柿子先从软的捏 入手示例代码 正式开始探究源码
C knowledge exercise
【C语言】一不小心写出bug?凡人教你如何写出好代码【详解vs中调试技巧】
Computer:成功教你如何使用一招—就能找回以前的密码(曾经保存的密码但当前显示为******号的密码)
My first work: tensorflow2 x
Basic improvement - tree DP supplement
Tencent cloud database tdsql- a big guy talks about the past, present and future of basic software
深入理解LightGBM
100003字,带你解密 双11、618电商大促场景下的系统架构体系
DataScience&ML:金融科技领域之风控之风控指标/字段相关概念、口径逻辑之详细攻略
C (pointer-02)