K8S集群安装部署 之 证书服务器安装

一、下载证书服务器的三个软件在运维主机上。
~]# wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O /usr/bin/cfssl
~]# wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O /usr/bin/cfssl-json
~]# wget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 -O /usr/bin/cfssl-certinfo
~]# chmod +x /usr/bin/cfssl*
~]# cd /opt/
opt]# mkdir certs
opt]# cd certs/
certs]# vi ca-csr.json          #ca证书申请文件
{
    "CN": "OldboyEdu",
    "hosts": [
    ],
    "key": {
        "algo": "rsa",
        "size": 2048
    },
    "names": [
        {
            "C": "CN",
            "ST": "beijing",
            "L": "beijing",
            "O": "od",
            "OU": "ops"
        }
    ],
    "ca": {
        "expiry": "175200h"
    }
}
certs]# cfssl gencert -initca ca-csr.json | cfssl-json -bare ca     #生成CA根证书与私钥
[ certs]# ll | grep ca
-rw-r--r-- 1 root root  836 Feb  1 00:19 ca-config.json
-rw-r--r-- 1 root root  993 Jan 31 08:09 ca.csr
-rw-r--r-- 1 root root  328 Jan 31 08:09 ca-csr.json
-rw------- 1 root root 1675 Jan 31 08:09 ca-key.pem      #ca根证书私钥
-rw-r--r-- 1 root root 1346 Jan 31 08:09 ca.pem        #ca根证书

相关推荐