docker registry 部署
生成 htpasswd 文件
<username> <password>
改成自己想配置的,如果密码有特殊字符,要用单引号包起来
docker run --rm \
docker.m.daocloud.io/httpd:latest \
htpasswd -Bbn <username> <password> > htpasswd
生成 secret 文件
kubectl create secret generic docker-registry-auth \
-n registry \
--from-file=htpasswd
生成 registry 配置文件
因为涉及到 MinIO 的
accesskey
和secretkey
,这里采用 secret 的方式来生成配置文件
---
apiVersion: v1
kind: Secret
metadata:
name: docker-registry-cm
namespace: registry
stringData:
config.yml: |-
version: 0.1
log:
level: info
fields:
service: registry
storage:
delete:
enabled: true
cache:
blobdescriptor: inmemory
s3:
accesskey: wJpkHB8rznvZBRLfKmBz
secretkey: ZHIyklv5tktYvGR0iFqBiL9NKh7JKbhyDR9SNAYp
region: default
regionendpoint: http://minio.api.devops.icu
forcepathstyle: true
accelerate: false
bucket: docker-registry
encrypt: false
secure: false
v4auth: true
chunksize: 5242880
multipartcopymaxconcurrency: 10
http:
addr: :5000
debug:
addr: :5001
prometheus:
enabled: true
path: /metrics
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
auth:
htpasswd:
realm: basic-realm
path: /auth/htpasswd