# cfssl gencert -initca ca-csr.json | cfssljson -bare ca2019/12/1314:35:52 [INFO] generating a new CA key and certificate from CSR2019/12/1314:35:52 [INFO] generate received request2019/12/1314:35:52 [INFO] received CSR2019/12/1314:35:52 [INFO] generating key: rsa-20482019/12/1314:35:52 [INFO] encoded CSR2019/12/1314:35:52 [INFO] signed certificate with serial number 248379771349454958117219047414671162179070747780
# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=kubernetes kubernetes-csr.json | cfssljson -bare kubernetes
2019/12/1314:40:28 [INFO] generate received request2019/12/1314:40:28 [INFO] received CSR2019/12/1314:40:28 [INFO] generating key: rsa-20482019/12/1314:40:28 [INFO] encoded CSR2019/12/1314:40:28 [INFO] signed certificate with serial number 3927952993851917324582113868616965426283051893742019/12/1314:40:28 [WARNING] This certificate lacks a "hosts" field. This makes it unsuitable forwebsites.FormoreinformationseetheBaselineRequirementsfortheIssuanceandManagementofPublicly-TrustedCertificates,v.1.1.6,fromtheCA/BrowserForum (https://cabforum.org);specifically,section10.2.3 ("Information Requirements").
# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=kubernetes admin-csr.json | cfssljson -bare admin
2019/12/1314:52:37 [INFO] generate received request2019/12/1314:52:37 [INFO] received CSR2019/12/1314:52:37 [INFO] generating key: rsa-20482019/12/1314:52:37 [INFO] encoded CSR2019/12/1314:52:37 [INFO] signed certificate with serial number 4654229834734442240507650041412176887482597573712019/12/1314:52:37 [WARNING] This certificate lacks a "hosts" field. This makes it unsuitable forwebsites.FormoreinformationseetheBaselineRequirementsfortheIssuanceandManagementofPublicly-TrustedCertificates,v.1.1.6,fromtheCA/BrowserForum (https://cabforum.org);specifically,section10.2.3 ("Information Requirements").
# cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=kubernetes kube-proxy-csr.json | cfssljson -bare kube-proxy
2019/12/1319:37:48 [INFO] generate received request2019/12/1319:37:48 [INFO] received CSR2019/12/1319:37:48 [INFO] generating key: rsa-20482019/12/1319:37:48 [INFO] encoded CSR2019/12/1319:37:48 [INFO] signed certificate with serial number 5267127497656924436424912550938161361543245317412019/12/1319:37:48 [WARNING] This certificate lacks a "hosts" field. This makes it unsuitable forwebsites.FormoreinformationseetheBaselineRequirementsfortheIssuanceandManagementofPublicly-TrustedCertificates,v.1.1.6,fromtheCA/BrowserForum (https://cabforum.org);specifically,section10.2.3 ("Information Requirements").
# openssl x509 -noout -text -in kubernetes.pemCertificate:Data:Version:3 (0x2)SerialNumber:44:cd:8c:e6:a4:60:ff:3f:09:af:02:e7:68:5e:f2:0f:e6:a0:39:feSignatureAlgorithm:sha256WithRSAEncryptionIssuer:C=CN,ST=ShenZhen,L=ShenZhen,O=k8s,OU=System,CN=kubernetesValidityNotBefore:Dec1306:35:002019GMTNotAfter:Nov1906:35:002119GMTSubject:C=CN,ST=ShenZhen,L=ShenZhen,O=k8s,OU=System,CN=kubernetesSubjectPublicKeyInfo:PublicKeyAlgorithm:rsaEncryptionPublic-Key: (2048 bit)Modulus:00:d7:91:4f:90:56:fb:ab:a9:de:c4:98:9e:d7:e6:45:db:5a:14:9a:76:78:6a:4c:db:3c:47:3c:e7:1c:3c:37:4e:8a:cf:9c:a1:8a:4c:51:4c:cd:45:b0:03:87:06:b9:20:2c:3a:51:f9:21:55:1c:90:7c:f8:93:bc:6a:48:05:3d:8b:74:fd:f2:f1:e6:5e:ad:b4:a8:f6:6d:f9:63:9e:e4:b4:cc:68:9e:90:d7:ef:de:ce:c1:1d:1b:68:59:68:5e:5f:7d:5c:f3:49:4f:18:72:be:b5:c8:af:e2:8d:34:9c:d2:68:b7:8c:26:69:cc:a5:f4:ca:69:2d:d7:21:f5:19:2e:b2:b5:97:16:87:9f:9c:fd:01:97:c2:0e:20:b4:88:27:9a:37:9a:af:0a:cf:82:4f:26:24:cb:07:ac:8c:b1:34:20:42:22:00:b2:b0:98:c5:53:01:fb:32:aa:15:1b:7e:39:44:ae:af:6e:c3:65:96:f6:38:7a:87:37:d0:31:63:d8:a4:15:13:f2:56:da:e6:09:45:2b:46:2c:cb:63:db:f7:ba:7f:44:0a:36:39:7c:cc:5b:42:e5:56:c7:7f:dd:64:5c:f2:4a:af:d3:a9:d1:6e:06:27:57:09:4d:db:08:62:87:66:c8:2c:36:00:41:f1:90:f6:5f:68:20:3dExponent:65537 (0x10001)X509v3extensions:X509v3KeyUsage:criticalDigitalSignature,KeyEnciphermentX509v3ExtendedKeyUsage:TLSWebServerAuthentication,TLSWebClientAuthenticationX509v3BasicConstraints:criticalCA:FALSEX509v3SubjectKeyIdentifier:3D:3F:FA:B8:36:D7:FE:B1:59:BE:B1:F5:C1:5D:88:3D:BC:78:9F:87X509v3AuthorityKeyIdentifier:keyid:40:A2:D4:30:22:12:2E:C2:FB:A2:55:2C:CB:F0:F6:3E:4D:B8:02:03X509v3SubjectAlternativeName: DNS:kubernetes, DNS:kubernetes.default, DNS:kubernetes.default.svc, DNS:kubernetes.default.svc.cluster, DNS:kubernetes.default.svc.cluster.local, IP Address:127.0.0.1, IP Address:172.20.0.112, IP Address:172.20.0.113, IP Address:172.20.0.114, IP Address:172.20.0.115, IP Address:10.254.0.1
SignatureAlgorithm:sha256WithRSAEncryption63:50:f6:2a:03:c7:35:dd:e9:10:8d:2f:b3:27:9a:64:f3:e1:11:8a:18:1e:fa:6d:85:30:11:b4:59:a3:6c:86:cd:2b:5c:67:17:4f:aa:0d:bb:4c:ee:c8:af:e7:3d:61:6d:03:9d:14:6f:00:48:56:59:b5:76:13:a9:30:23:e0:b2:d2:12:64:0c:60:0d:76:ec:c6:4f:b1:bc:24:01:7a:48:c6:fd:9e:5d:68:da:b9:a1:ad:30:7a:ba:90:e2:e3:4e:b4:92:1b:c5:f2:8c:c1:b0:3d:fc:14:d2:46:e8:f8:22:8f:d9:4d:85:4f:58:6b:0f:84:78:06:b4:b9:92:b9:0d:bd:1d:95:e9:0d:42:d3:fd:dd:2a:59:60:3f:63:35:eb:07:25:d2:ea:0d:19:a6:f3:dc:92:8e:ee:73:04:15:5e:97:e8:da:51:c3:69:49:96:36:c7:cc:5b:e5:e5:cb:e5:ce:9f:21:6f:6b:56:16:bf:85:ad:1c:8c:91:c1:91:0a:90:18:e2:4a:b0:32:58:33:ef:55:8e:8f:4a:e3:0f:b8:f7:41:04:65:89:e1:1b:d8:41:28:6e:84:c3:1c:8e:a9:a0:8a:42:e4:fe:d7:fe:0e:24:dc:74:37:fa:5e:be:20:69:c5:9a:5a:e6:83:1c:0b:9e:e1:43:ef:4f:7a:37
字段说明:
确认 Issuer 字段的内容和 ca-csr.json 一致;
确认 Subject 字段的内容和 kubernetes-csr.json 一致;
确认 X509v3 Subject Alternative Name 字段的内容和 kubernetes-csr.json 一致;