项目环境搭建【Docker+k8s】三 || 准备签发证书环境
1、部署主机
- YN101-100.host.com(运维主机)
2、安装证书签发工具CFSSL:R1.2
#CFSSL
wget "https://pkg.cfssl.org/R1.2/cfssl_linux-amd64" -O /usr/bin/cfssl
#CFSSL-json
wget "https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64" -O /usr/bin/cfssl-json
#CFSSL-certinfo
wget "https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64" -O /usr/bin/cfssl-certinfo
#给执行权限
chmod +x /usr/bin/cfssl*
#查看路径
which cfssl,cfssl-json,cfssl-certinfo
3、创建生成CA证书签名请求(csr)的json配置文件
在/opt/目录下,创建certs目录和ca-csr.json文件
mkdir -p /opt/certs
vi ca-csr.json
json文件配置内容如下:
{
"CN": "KevinEdu",
"hosts": [ ],
"key": {
"algo": "rsa",
"size": 2048
},
"names": [
{
"C": "CN",
"ST": "YN",
"L": "KM",
"O": "kevin",
"OU": "edu"
}
],
"ca": {
"expiry": "175200h"
}
}
执行生成证书命令,查看目录下已经生成根证书ca.pem和根证书的私钥ca-key.pem
[root@yn101-100 certs]# cfssl gencert -initca ca-csr.json | cfssl-json -bare ca
[root@yn-100 certs]# ls
ca.csr ca-csr.json ca-key.pem ca.pem