【Kubernetes系列】Harbor配置HTTPS访问


一、创建目录

mkdir -p /opt/certs

二、生成自签名证书

cd /opt 
sudo openssl req -newkey rsa:4096 -nodes -sha256 -keyout \
 ./certs/registry.key -x509 -days 365 -out ./certs/registry.crt
[root@localhost opt]# sudo openssl req -newkey rsa:4096 -nodes -sha256 -keyout  ./certs/registry.key -x509 -days 365 -out ./certs/registry.crt
Generating a RSA private key
...................................++++
...........................................................++++
writing new private key to './certs/registry.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:GX
Locality Name (eg, city) [Default City]:NN
Organization Name (eg, company) [Default Company Ltd]:chaoyue
Organizational Unit Name (eg, section) []:qxq
Common Name (eg, your name or your server's hostname) []:harbor
Email Address []:

三、查看证书

[root@localhost certs]# ll
total 8
-rw-r--r--. 1 root root 1992 Jun 17 18:04 registry.crt
-rw-------. 1 root root 3272 Jun 17 18:03 registry.key

四、配置 Harbor

vi harbor.yml
# https related config
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /opt/certs/registry.crt
  private_key: /opt/certs/registry.key

五、启用

执行以下命令:

./prepare

六、验证

输入 https://192.168.1.48 访问。

猜你喜欢

转载自blog.csdn.net/u012069313/article/details/125332172