上面 consul cluster 启动 时会生成证书,一个是证书, 这CA-cert 是CA的,这是根证书。一个是私钥
# k get secrets consul-ca-cert -oyaml apiVersion: v1 data: tls.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURRVENDQXVpZ0F3SUJBZ0lVWm54b0hPNzNwSTY0NlRCMGhKQy9YR1dVTUt3d0NnWUlLb1pJemowRUF3SXcKZ1pFeEN6QUpCZ05WQkFZVEFsVlRNUXN3Q1FZRFZRUUlFd0pEUVRFV01CUUdBMVVFQnhNTlUyRnVJRVp5WVc1agphWE5qYnpFYU1CZ0dBMVVFQ1JNUk1UQXhJRk5sWTI5dVpDQlRkSEpsWlhReERqQU1CZ05WQkJFVEJUazBNVEExCk1SY3dGUVlEVlFRS0V3NUlZWE5vYVVOdmNuQWdTVzVqTGpFWU1CWUdBMVVFQXhNUFEyOXVjM1ZzSUVGblpXNTAKSUVOQk1CNFhEVEl6TVRJeU5UQXpNVEV5T1ZvWERUTXpNVEl5TWpBek1USXlPVm93Z1pFeEN6QUpCZ05WQkFZVApBbFZUTVFzd0NRWURWUVFJRXdKRFFURVdNQlFHQTFVRUJ4TU5VMkZ1SUVaeVlXNWphWE5qYnpFYU1CZ0dBMVVFCkNSTVJNVEF4SUZObFkyOXVaQ0JUZEhKbFpYUXhEakFNQmdOVkJCRVRCVGswTVRBMU1SY3dGUVlEVlFRS0V3NUkKWVhOb2FVTnZjbkFnU1c1akxqRVlNQllHQTFVRUF4TVBRMjl1YzNWc0lFRm5aVzUwSUVOQk1Ga3dFd1lIS29aSQp6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVJaUZ5MmYwb1dKWUIweGhZSjZGU2tReVZ0RXhJdHhzbjVHV1pReXA4Cm55ZVFEUUpvb1ZMQWllV21Vd0xKQW1JVXB2WW1HamhqRzREVStMWVc1d1hNcXFPQ0FSb3dnZ0VXTUE0R0ExVWQKRHdFQi93UUVBd0lCaGpBZEJnTlZIU1VFRmpBVUJnZ3JCZ0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lMbU52Ym5OMWJET0NGV052Ym5OMWJDMXpaWEoyWlhJdVkyOXVjM1ZzTTRJYktpNWoKYjI1emRXd3RjMlZ5ZG1WeUxtTnZibk4xYkRNdWMzWmpnaGxqYjI1emRXd3RjMlZ5ZG1WeUxtTnZibk4xYkRNdQpjM1pqZ2hNcUxuTmxjblpsY2k1bWMyOHVZMjl1YzNWc2doRnpaWEoyWlhJdVpuTnZMbU52Ym5OMWJJSUpiRzlqCllXeG9iM04waHdSL0FBQUJNQW9HQ0NxR1NNNDlCQU1DQTBnQU1FVUNJQm9SZ2d6NjN5T3d6LytHTUE3VWlwSWYKalF1VFJ3Z1U3L2t0UzNhS09mVFFBaUVBOWxGR3dJdmV5NTUyM2hvMHpuU1EweU4ya0hLdUowOTc5djc3aTRLdwpNL2c9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
tls.key: LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1IY0NBUUVFSVAxcDJEeGtoVStIU1hUNWlzWFNuNVVLeFd4QTVhUE4xRlBHK29JdXd4Z1dvQW9HQ0NxR1NNNDkKQXdFSG9VUURRZ0FFYTlwOVhwZTlXelUzUG5jY1pGY1BENWVCYmRjRkxSbU53aGFXRzF4VnZOVjFRZ0N4RjRTawpYeks1Q0U4dGFjaXhCaHVNRlJPUXhSV2dzOHZFRVoyazlRPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
上面公钥 先 base64 解码, 再 解析内容。 这里有公钥,签发者等信息。证书可以到处传,私钥只是自己保存
-----BEGIN CERTIFICATE----- MIIDQTCCAuigAwIBAgIUZnxoHO73pI646TB0hJC/XGWUMKwwCgYIKoZIzj0EAwIw gZExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNU2FuIEZyYW5j aXNjbzEaMBgGA1UECRMRMTAxIFNlY29uZCBTdHJlZXQxDjAMBgNVBBETBTk0MTA1 MRcwFQYDVQQK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