我已经为我的kubernetes集群创建了自签名用户证书,现在想将各个kubeconfig文件分发给用户。

如何将用于该过程的.crt和.key文件转换为kubeconfig内联格式?

这是crt文件的编辑后的示例内联表示形式:

LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMrekNDQWVPZ0F3SUJBZ0lNRlFwTllCZ2hwSWFBclNJYU1BMEdDU3FHU0liM0RRRUJDd1VBTUJVeEV6QVIKQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13SGhjTk1UZ3dNVEUwTVRNeU9ERTVXaGNOTWpnd01URTBNVE15T0RFNQpXakFyTVJjd0ZRWURWUVFLRXc1emVYTjBaVzA2YldGemRHVnljekVRTUE0R0ExVUVBeE1IYTNWaVpXTm1aekNDCkFTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTWkraGFFb1d6Mk8yYUN5d3JhOHo4UHAKem9jUTBHK2JnTVFGQSttZzZCQkhRWCt1UFhQbVBpM2FOSjBmcXBsM0sySjkvbkNodVo4T0JRT1ZHa3ZGaDdIbApWQmR6WG9qOHZ6ZUplUko4SFBlNDV5NXJYQnZtUkRUYUhGSWJ1ZWdGYzlYRFNCemtob21jYTlKOHdXSS9nUHdpCnNaaTczd2o1TVdtbnk3MlRyQ1RuZktUTzVXY1IyT2txRGNCalhPb2thWTFqckkrSlpSdmpIa1FobnB2bTNrWW4KVnNo-----------xdTZiS1k1WVFYYUwvNXNRcTFKNXMyVnh1ckRaQ2c5anA4ZlQrMEUzbWwvM1lkTEF0MjI0NG1Ec1MKdFFjM2k5Nk8rM0xFeU90REsraW5vKzB1WnZWZ0lrazZhOG9LS0hxaks5b21oOWg3WjE1UjVwWkxIa3dTVmluYwpLbHZGOUt4WXJrekdidmFiRUZZd0p1ejFTdW02ZkJ4dDQ5THkvWDFKQkZ1K1pnWDFPWjdnM2ZPeGt3WWdtVVBnCmt5Mmx1Zk1MZWI2SzdwOVdkaUxsUFAyRWk4aG9CWTNXQk9UQk1kcXY1Wm01VWpUUm9sZkIrTXZwTEp0ZlFOST0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=

最佳答案

只需使用Base 64对其进行编码:cat mycert.crt | base64 -w0

关于base64 - 将SSL .crt转换为kubernetes内联格式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48341240/

10-12 23:01