Kubernetes学习笔记 – 安装Harbor仓库
安装部署
创建SSL证书
注意创建时,harbor节点主机名为:harbor
配置/etc/hosts 中全域名为: harbor harbor.goblin.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| # 创建根证书
openssl genrsa -out ca.key 4096
openssl req -x509 -new -nodes -sha512 -days 3650 \ -subj "/C=CN/ST=Fujian/L=FuZhou/O=LQ/OU=Goblin/CN=harbor.goblin.com" \ -key ca.key \ -out ca.crt # 生成服务端证书 # openssl genrsa -out harbor.goblin.com.key 4096 # openssl req -sha512 -new \ -subj "/C=CN/ST=Fujian/L=FuZhou/O=LQ/OU=Goblin/CN=harbor.goblin.com" \ -key harbor.goblin.com.key \ -out harbor.goblin.com.csr # cat > v3.ext <<-EOF authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment extendedKeyUsage = serverAuth subjectAltName = @alt_names
[alt_names] DNS.1=harbor.goblin.com DNS.2=harbor.goblin DNS.3=harbor EOF # openssl x509 -req -sha512 -days 3650 \ -extfile v3.ext \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -in harbor.goblin.com.csr \ -out harbor.goblin.com.crt
# 配置Docker客户端证书 # openssl x509 -inform PEM -in harbor.goblin.com.crt -out harbor.goblin.com.cert # mkdir -p /etc/docker/certs.d/harbor.goblin.com:<https_port> cp harbor.goblin.com.cert /etc/docker/certs.d/harbor.goblin.com:<https_port> cp harbor.goblin.com.key /etc/docker/certs.d/harbor.goblin.com:<https_port> cp ca.crt /etc/docker/certs.d/harbor.goblin.com:<https_port>
#
# docker login lqdocker.goblin.com:18443 -u admin
|
关于免费SSL证书
在letsencrypt可以申请到免费的SSL证书,并且配合certbot能够自动更新,用户只要拥有一个合法域名基本上就可以获得无限期的SSL证书。
参考
安装包地址
配置SSL